go-oci8: Cross compile get error: undefined: OCI8Connector

Please note this is issue is only about cross compile go get error. If you are getting a cross compile build error, that can be fixed. Please look at other issues for fixes.

Getting undefined: OCI8Connector on go get cross compile. This works:

go get github.com/mattn/go-oci8

This:

set GOOS=linux
go get github.com/mattn/go-oci8

Gives this error:

# github.com/mattn/go-oci8
..\src\github.com\mattn\go-oci8\connector.go:20:22: undefined: OCI8Connector

Tried this from Windows to Linux as well as from Linux to Windows.

The cross compile seems to work, just not the go get. Any ideas? A Go bug?

Tried on Windows Go version 1.10.3 and Linux Go version 1.11.1.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

It is doing a lot of stuff and it is still using cgo.

Inside the rainycape/dl package there is a call to import “C”. Once an import to C is called in any package anywhere in the program the binary has to switch to running cgo instead of pure Go. One of the great features of pure Go is the easy cross-compile. That is why for monitoring applications like Telegraf or Prometheus there is support for many many databases but not Oracle. There is no pure Go driver for Oracle. Telegraf and Prometheus want to keep there project pure Go so they can use Go’s easy cross-compile features.

Telegraf inputs: https://github.com/influxdata/telegraf#input-plugins

Prometheus database exporters: https://prometheus.io/docs/instrumenting/exporters/#databases

I would love to see/have/use a pure Go driver. It might be possible but would be a lot of work.

Note: Any interest in an experiment creating a pure Go Oracle driver? https://github.com/mattn/go-oci8/issues/216

It is not pure Go, it is cgo. It is using https://github.com/rainycape/dl which loads the Oracle instant client which is written in C

The cause of this issue is that you probably use host C compiler instead of cross C compiler.