go-goracle / goracle

Go database/sql driver for connecting to Oracle Database, using the ODPI-C library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

govendor test +local failing with vendor/gopkg.in/goracle.v2/conn.go:20:10: fatal error: 'dpiImpl.h' file not found #include "dpiImpl.h"

chakrapani123 opened this issue · comments

go version
go version go1.11.5 darwin/amd64

error message:

vendor/gopkg.in/goracle.v2/conn.go:20:10: fatal error: 'dpiImpl.h' file not found
#include "dpiImpl.h"
^~~~~~~~~~~

I ran into this as well, I'm not at all familiar with how Oracle drivers work. Here's what I did:

  • Downloaded the "basic" version, not basic lite
  • Extracted all of the shared object files in the zip file to and placed it under /abs/path/project/vendor/include/oracle/
  • Set CGO_CFLAGS="-I /abs/path/project/vendor/include/oracle"
  • go install -v -buildmode pie .

I still get the same error. Am I missing a step or placing things incorrectly?

You've vendored goracle, but missed the "odpi" directory under goracle.v2, with its contents (embed, include and src dirs with .h and .c files).

@tgulacsi thanks for the hint, I found the problem!

For future folks, I had taken this as a dependency with go modules via go get gopkg.in/goracle.v2. It turns out that go mod -vendor does not bring the entire tree, only packages it sees fit. There was a tool that @nomad-software wrote called vend, which vendored the entire tree. Once the tree was vendored as you recommended, things worked as intended.