iamseth/oracledb_exporter

Windows support?

mika opened this issue · 9 comments

mika commented

I tried to build oracledb_exporter for windows, but this fails to build for me due to:

/home/mika/src/gopath/src/github.com/mattn/go-oci8/connector.go:14:10: undefined: OCI8Connector
/home/mika/src/gopath/src/github.com/mattn/go-oci8/connector.go:20:22: undefined: OCI8Connector
/home/mika/src/gopath/src/github.com/mattn/go-oci8/connector.go:21:9: undefined: OCI8Driver
[...]
/home/mika/src/gopath/src/github.com/mattn/go-oci8/connector.go:21:9: too many errors

I'm aware that the problem is lying within https://github.com/mattn/go-oci8, but I'm wondering if there are any plans to provide releases for Windows?

Thanks for providing oracledb_exporter!

And what about the Windows Subsystem for Linux (WSL)?

pnrmx commented

I tried to build oracledb_exporter for windows, but this fails to build for me due to:

/home/mika/src/gopath/src/github.com/mattn/go-oci8/connector.go:14:10: undefined: OCI8Connector
/home/mika/src/gopath/src/github.com/mattn/go-oci8/connector.go:20:22: undefined: OCI8Connector
/home/mika/src/gopath/src/github.com/mattn/go-oci8/connector.go:21:9: undefined: OCI8Driver
[...]
/home/mika/src/gopath/src/github.com/mattn/go-oci8/connector.go:21:9: too many errors

I'm aware that the problem is lying within https://github.com/mattn/go-oci8, but I'm wondering if there are any plans to provide releases for Windows?

Thanks for providing oracledb_exporter!

How to compile on windows 64 bit:

  • download Oracle Instant Client 64-Bit version
    basic and sdk versions,
  • extract client (in my opinion this C:\oracle\instantclient_18_5) and extract SDK to the same folder (C:\oracle\instantclient_18_5\sdk)
  • set the environment variables
setx CGO_CFLAGS "C:\oracle\instantclient_18_5\sdk\include"
setx CGO_LDFLAGS "-LC:\oracle\instantclient_18_5 -loci"
  • Then install GCC - I prefer MSYS2 64 bit (for example in c:\msys64)
  • Run the MSYS2 MINGW64 terminal and set dependencies packages:
# Update pacman
pacman -Su
# Close terminal and open a new terminal
# Update all other packages
pacman -Su
# Install pkg-config and gcc
pacman -S mingw64/mingw-w64-x86_64-pkg-config mingw64/mingw-w64-x86_64-gcc
  • go to the pkg-config dir c:/msys64/mingw64/lib/pkgconfig/ and create oci8.pc as this example:
prefix=C:\oracle\instantclient_18_5/sdk/
version=18.5
build=client64
libdir=C:\oracle\instantclient_18_5/sdk/lib/msvc
includedir=C:\oracle\instantclient_18_5/sdk/include
glib_genmarshal=glib-genmarshal
gobject_query=gobject-query
glib_mkenums=glib-mkenums
Name: oci8
Description: Oracle database engine
Version: ${version}
Libs: -L${libdir} -loci
Libs.private:
Cflags: -I${includedir}
  • Set %PKG_CONFIG_PATH% as the environment variable:
    setx PKG_CONFIG_PATH "C:\msys64\mingw64\lib\pkgconfig"
  • Ensure, that %PATH% includes path to the msys64 binares, if not set it: setx path "%path%;C:\msys64\mingw64\bin"
  • everything must comiple, including mattn driver for oracle.

@pnrmx are you ok if I took this instructions and put it directly into the README ?

pnrmx commented

@pnrmx are you ok if I took this instructions and put it directly into the README ?

ok

@pnrmx Sorry on stupid question, but what is the next step after the instructions above?

pnrmx commented

@pnrmx Sorry on stupid question, but what is the next step after the instructions above?

next build ./... in oracledb-exporter dir, or install it.

Hey guys,

I'm trying to setup oracle exporter for prometheus, did all the steps from https://github.com/iamseth/oracledb_exporter
But when i get to the go build ./... i'm getting
go: gopkg.in/alecthomas/kingpin.v2@v2.2.6: Get "https://proxy.golang.org/gopkg.in/alecthomas/kingpin.v2/@v/v2.2.6.mod": dial tcp: lookup proxy.golang.org: no such host

Btw my oracle db machine is on windows has no access to internet so have to do it somehow offline.

Thanks

what should i do?

panic: OCIEnvCreate error

goroutine 1 [running]:
github.com/mattn/go-oci8.init.0()
C:/Users/kingdee/go/pkg/mod/github.com/mattn/go-oci8@v0.0.8/globals.go:177 +0x518

Hello, just an update, i can't compile on windows with that errors :

github.com/iamseth/oracledb_exporter

panic: bad carrier sym for symbol runtime.no_pointers_stackmap (funcdata callRet#1), want go.func.* got ?

goroutine 277 [running]:
cmd/link/internal/ld.writeFuncs(0xc0000b8000, 0xc0076ca000?, {0xc0071e8000, 0x23d2, 0xc0084aeff0?}, 0xc00772bdd8?, {0xc0076ca000, 0x23d2, 0x3e968?}, {0xc004550580, ...}, ...)
c:/go/src/cmd/link/internal/ld/pcln.go:732 +0xd3d
cmd/link/internal/ld.(*pclntab).generateFunctab.func1(0xc0000b8000, 0x3e968?)
c:/go/src/cmd/link/internal/ld/pcln.go:545 +0x16e
cmd/link/internal/ld.writeBlock(0xc0000b8000, 0x1?, 0xc0000ec000, {0xc008e51dd0, 0xc2a, 0xc00772bf68?}, 0x44f3c5?, 0xc005d38000?, {0x8836a0, 0x200, ...})
c:/go/src/cmd/link/internal/ld/data.go:1003 +0x3be
cmd/link/internal/ld.writeBlocks.func1(0x0?, 0x4215a5?, {0xc008e51dd0?, 0xc00772bfd0?, 0x545320?}, 0xc008d43510?, 0xc00772bfb8?, {0x8836a0, 0x200, 0x200})
c:/go/src/cmd/link/internal/ld/data.go:957 +0x76
created by cmd/link/internal/ld.writeBlocks
c:/go/src/cmd/link/internal/ld/data.go:956 +0x57c

Thanks For HELP