0

i'm working on Windows 10

in my code i imported oracle package as in http://go-database-sql.org/importing.html

import (
"database/sql"
_ "github.com/mattn/go-oci8"

)

then i followed the instruction to install oracle plugin as in https://github.com/mattn/go-oci8

i installed all written in https://stackoverflow.com/a/22363820/15190000

Then when i ran "go build -x main.go" i get this error:

C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1

c:/bin/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -loci collect2.exe: error: ld returned 1 exit status

no matter what i do i keep getting the same error "cannot find -loci"

under my C:\bin\oracle_client\instantclient_12_2\sdk\lib\msvc i do find oci.lib

also when i call "pkg-config --cflags --libs oci8" i see the oci8.pc file

Vindhya G
  • 1,339
  • 2
  • 21
  • 46
shai engel
  • 61
  • 6
  • You need Go to inform ld.exe (the linker) to add `C:\bin\oracle_client\instantclient_12_2\sdk\lib\msvc` to the list of directories to check for libraries. E.g. via envvar: `@SET CGO_LDFLAGS=-LC:\bin\oracle_client\instantclient_12_2\sdk\lib\msvc` if you build with a script (.bat). – Zyl Aug 01 '21 at 14:21
  • If you choose to use a .bat, might also throw in a `@SETLOCAL` as first line so you don't pollute your terminal's env vars. – Zyl Aug 01 '21 at 14:23

0 Answers0