mattn / go-oci8

Oracle driver for Go using database/sql
https://mattn.kaoriya.net/
MIT License
630 stars 212 forks source link

Install Problems Windows #318

Closed wegoodwin closed 5 years ago

wegoodwin commented 5 years ago

I just tried to install go-oci8 on a windows 7 machine with go version 1.11.1

Here is the error I get:

github.com/mattn/go-oci8

In file included from C:/instantclient_11_2/sdk/include/oci.h:541:0, from ./oci8.go.h:1, from C:\Users\WOG\go\src\github.com\mattn\go-oci8\cHelpers.go:3: C:/instantclient_11_2/sdk/include/oratypes.h:236:25: error: expected '=', ',', ';', 'asm' or 'attribute' before 'ubig_ora' typedef unsigned _int64 ubig_ora; ^ C:/instantclient_11_2/sdk/include/oratypes.h:237:25: error: expected '=', ',', ';', 'asm' or 'attribute' before 'sbig_ora' typedef signed _int64 sbig_ora; ^ In file included from C:/instantclient_11_2/sdk/include/oci.h:3045:0, from ./oci8.go.h:1, from C:\Users\WOG\go\src\github.com\mattn\go-oci8\cHelpers.go:3: C:/instantclient_11_2/sdk/include/ociap.h:7459:40: error: unknown type name 'ubig_ora' OraText path, ubig_ora lenp ); ^ C:/instantclient_11_2/sdk/include/ociap.h:7471:36: error: unknown type name 'ubig_ora' uword origin, ubig_ora offset, sb1 dir ); ^ C:/instantclient_11_2/sdk/include/ociap.h:8278:23: error: unknown type name 'sbig_ora' sbig_ora bufferLength, sbig_ora returnLength, ^ C:/instantclient_11_2/sdk/include/ociap.h:8278:46: error: unknown type name 'sbig_ora' sbig_ora bufferLength, sbig_ora returnLength,

MichaelS11 commented 5 years ago

This is an issue with oratypes.h, in the past I have just edited the header file to fix it. Suggest Googling it.

wegoodwin commented 5 years ago

MichaelS11,

I've looked out on google, for editing the header file but I can't make heads or tails of what to do. Do you have a specific URL you can point me to?

MichaelS11 commented 5 years ago

https://github.com/mattn/go-oci8/issues/75#issuecomment-301313054

MichaelS11 commented 5 years ago

Or maybe: https://www.linuxquestions.org/questions/programming-9/why-the-expected-%3D-%3B-asm-or-__attribute__-before-typedef-error-786428/

I had to reinstall the 11.x version instant client recently and had the same (or very similar) issue as you. I choose to installed the newer 12.x version which solved the problem for me. So I did not solve the problem with the 11.x version recently. Know it is possible from when I did it in the past, just do not recall exactly what I did. Should have wrote it down. ;)

MichaelS11 commented 5 years ago

@wegoodwin Everything good now? Close this?

wegoodwin commented 5 years ago

@MichaelS11

I am now getting the following error:

C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-min gw32/bin/ld.exe: skipping incompatible C:/instantclient_12_2/sdk/lib/msvc/oci.li b when searching for -loci C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-min gw32/bin/ld.exe: skipping incompatible C:/instantclient_12_2/sdk/lib/msvc/oci.li b when searching for -loci C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-min gw32/bin/ld.exe: skipping incompatible C:/instantclient_12_2/sdk/lib/msvc\oci.li b when searching for -loci C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-min gw32/bin/ld.exe: cannot find -loci collect2.exe: error: ld returned 1 exit status

Have you seen this before?

MichaelS11 commented 5 years ago

Please try searching the internet first, it holds all kinds of answers.

https://github.com/mattn/go-oci8/search?q=cannot+find+-loci&type=Issues

https://www.google.com/search?q="cannot+find+-loci"

MichaelS11 commented 5 years ago

@wegoodwin If you have specific question, please let us know. Otherwise, could you please close this?

MichaelS11 commented 5 years ago

Found my sed command for instant client 11.2

sed -i 's/typedef unsigned _int64 ubig_ora;/typedef unsigned __int64 ubig_ora;/g' /usr/local/oracle/instantclient_11_2_64/sdk/include/oratypes.h
sed -i 's/typedef   signed _int64 sbig_ora;/typedef   signed __int64 sbig_ora;/g' /usr/local/oracle/instantclient_11_2_64/sdk/include/oratypes.h