Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during install in windows #75

Closed
JunedS opened this issue Jan 7, 2016 · 28 comments
Closed

Error during install in windows #75

JunedS opened this issue Jan 7, 2016 · 28 comments

Comments

@JunedS
Copy link

@JunedS JunedS commented Jan 7, 2016

I am facing below error in windows 7 64bit with TDM-GCC-64 (64bit) and GO 1.5.2 64bit and Oracle server 64 bit.

Error: cc1: sorry, unimplemented: 64-bit mode not compiled in

oci8.pc as below

prefix=/devel/target/1.0
exec_prefix=${prefix}

libdir=C:/app/IBM_ADMIN/product/11.2.0/dbhome_1/OCI/lib/MSVC
includedir=C:/app/IBM_ADMIN/product/11.2.0/dbhome_1/OCI/include

gcclib=C:/MyFiles/ProgramFiles/TDM-GCC-64/lib
gccinclude=C:/MyFiles/ProgramFiles/TDM-GCC-64/include

glib_genmarshal=glib-genmarshal
gobject_query=gobject-query
glib_mkenums=glib-mkenums

Name: oci8
Version: 11.2
Description: oci8 library
Libs: -L${libdir} -L${gcclib} -loci
Libs.private:
Cflags: -I${includedir} -I${gccinclude}

Not able to figure out where are things going wrong. Please help

@ricsmania

This comment has been minimized.

Copy link
Contributor

@ricsmania ricsmania commented Jan 7, 2016

Does your PATH environment variable include the 64 bit GCC bin folder?

@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 7, 2016

Yes I have included C:/MyFiles/ProgramFiles/TDM-GCC-64/bin; in Path environmental variable.

@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 7, 2016

Thanks for the reply @ricsmania. I have placed pkg-config.exe, libglib-2.0-0.dll in the same GCC bin folder and are 64bits. Can it be issue with pkg-config.exe?

@ricsmania

This comment has been minimized.

Copy link
Contributor

@ricsmania ricsmania commented Jan 7, 2016

Can you try putting it before anything else on the PATH? You could also try using Process Monitor to see if you are getting the right GCC. From the error message it might be using a 32 bit version of GCC with the 64 bit version of Go. I did the same with pkg-config as you did, I put it on the same folder as mingw64 (the C compiler I'm using) and it works fine. But you could also use procmon to check if the oci8.pc file is being read properly.

@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 7, 2016

Thanks again for the tips. I just put the variable before anything and started getting these errors.

github.com/mattn/go-oci8

In file included from C:/app/IBM_ADMIN/product/11.2.0/dbhome_1/OCI/include/oci.h:535:0,
from ..\src\github.com\mattn\go-oci8\oci8.go:4:
C:/app/IBM_ADMIN/product/11.2.0/dbhome_1/OCI/include/oratypes.h:236:25: error: expected '=', ',', ';', 'asm' or 'attribute' before 'ubig_ora'
typedef unsigned _int64 ubig_ora;
^
C:/app/IBM_ADMIN/product/11.2.0/dbhome_1/OCI/include/oratypes.h:237:25: error: expected '=', ',', ';', 'asm' or 'attribute' before 'sbig_ora'
typedef signed _int64 sbig_ora;
^
In file included from C:/app/IBM_ADMIN/product/11.2.0/dbhome_1/OCI/include/oci.h:3024:0,
from ..\src\github.com\mattn\go-oci8\oci8.go:4:
C:/app/IBM_ADMIN/product/11.2.0/dbhome_1/OCI/include/ociap.h:7452:40: error: unknown type name 'ubig_ora'
OraText *path, ubig_ora *lenp );
^
C:/app/IBM_ADMIN/product/11.2.0/dbhome_1/OCI/include/ociap.h:7464:36: error: unknown type name 'ubig_ora'
uword origin, ubig_ora offset, sb1 dir );
^
C:/app/IBM_ADMIN/product/11.2.0/dbhome_1/OCI/include/ociap.h:8271:23: error: unknown type name 'sbig_ora'
sbig_ora bufferLength, sbig_ora *returnLength,
^
C:/app/IBM_ADMIN/product/11.2.0/dbhome_1/OCI/include/ociap.h:8271:46: error: unknown type name 'sbig_ora'
sbig_ora bufferLength, sbig_ora *returnLength,

@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 7, 2016

Is Oracle 11g not supported?

@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 7, 2016

I downloaded installClient sdk 12.1 and pointed lib and include to sdk/lib/msvc and sdk/include but now facing this error

github.com/mattn/go-oci8

C:/MyFiles/Softwares/instantclient-sdk-windows.x64-12.1.0.2.0/instantclient_12_1/sdk/lib/msvc/oci.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status

Need to make this up. Please help!

@mattn

This comment has been minimized.

Copy link
Owner

@mattn mattn commented Jan 7, 2016

did you download 64bit sdk not 32bit ?

@mattn

This comment has been minimized.

Copy link
Owner

@mattn mattn commented Jan 7, 2016

I could build with following oci8.pc

includedir=c:/dev/instantclient_12_1/sdk/include
libdir=c:/dev/instantclient_12_1/sdk/lib/msvc

Name: oci8
Description: Oracle Instant Client
Version: 12.1
Cflags: -I${includedir}
Libs: -L${libdir} -loci
@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 8, 2016

@mattn Thanks for the reply. Yes i have downloaded 64 bit. I just changed oci8.pc accordingly and now it throws error

fatal error: oci.h: No such file or directory in oci8.go resource

I did pkg-config.exe --libs oci8 and can see
-LC:/MyFiles/Softwares/instantclient_12/instantclient_12_1/sdk/include -loci

What am I missing.

oci h

@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 8, 2016

My bad I had reversed the paths for includedir and libdir and I am back to same issue
msvc/oci.lib: error adding symbols: File in wrong format.

@mattn

This comment has been minimized.

Copy link
Owner

@mattn mattn commented Jan 8, 2016

Hmm, strange. my compiler is below installed from msys2/mingw64.

gcc (Rev1, Built by MSYS2 project) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 8, 2016

Can you please provide download link and I had downloaded 64bit instantclient of oracle 12.1 or should I had downloaded 32bit?

@mattn

This comment has been minimized.

Copy link
Owner

@mattn mattn commented Jan 8, 2016

No, if you are on 64bit, you should use 64bit sdk-installer.

@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 8, 2016

I will try with the Gcc which u have used can u please provide the download link. Thanks

@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 8, 2016

Can u please make the installation process user friendly. I cant even think of how this can be used in production env's. You can even mention in Read Me, what are the compatible versions of Oracle, Gcc and so on to make things more clearer and so that users can see if they are good to go for it. I am struggling big time to just get it compiled and not able to. I think I have to finally give up on this if continue getting errors :)

@mattn

This comment has been minimized.

Copy link
Owner

@mattn mattn commented Jan 8, 2016

okay, will do.

@ricsmania

This comment has been minimized.

Copy link
Contributor

@ricsmania ricsmania commented Jan 8, 2016

@JunedS yesterday I created a package for internal use here that has everything needed to compile:

Go
Mingw
pkg-config
Oracle Instant Client

It also has a bat that copies everything and sets the environment variables. Send me an email: my GitHub username at gmail, and I'll send you a link with everything.

Also, you mentioned it's hard to install. Yes it is, but this is not Go's fault or especially people like @mattn who work hard to provide us with the drivers. It's actually Oracle's fault, because the driver is hard to install on basically any open language or framework. It's one of the main reasons I stopped using Node.Js. However Go has a huge advantage: it's compiled, so you will only need to follow these steps on your development machine. On the production environment you just need the compiled executable and the instant client, and maybe some configuration environment variables.

The bat is this:

echo off
chdir "%~dp0"
net session >nul 2>&1
if %errorLevel% NEQ 0 (    
    echo Permission denied. Please run as admin.
    pause
    goto fim
)

git version
if %errorLevel% NEQ 0 (    
    echo GIT not found. Please install and add to PATH before continuing.
    pause
    goto fim
)

echo Copying files
arquivos\7za x arquivos\Arquivos.7z -aos -oc: 

echo off
echo Configuring environment variables
setx /m GOROOT "c:\go"
setx /m GOPATH "c:\projetos\go"

setx /m PATH "%PATH%;c:\go\bin;c:\projetos\go\bin;C:\Oracle\instantclient_12_1_64;C:\Oracle\instantclient_12_1;c:\mingw_64\bin"
setx /m CGO_CFLAGS "-IC:\Oracle\instantclient_12_1_64\sdk\include"
setx /m CGO_LDFLAGS "-LC:\Oracle\instantclient_12_1_64\sdk\lib\msvc -loci"
setx /m PKG_CONFIG_PATH "c:\projetos\go"
setx /m GO_EXTLINK_ENABLED 0
set GOROOT=c:\go
set GOPATH=c:\projetos\go
set PATH=%PATH%;c:\go\bin;c:\projetos\go\bin;C:\Oracle\instantclient_12_1_64;C:\Oracle\instantclient_12_1;c:\mingw_64\bin
set CGO_CFLAGS=-IC:\Oracle\instantclient_12_1_64\sdk\include
set CGO_LDFLAGS=-LC:\Oracle\instantclient_12_1_64\sdk\lib\msvc -loci
set PKG_CONFIG_PATH=c:\projetos\go
set GO_EXTLINK_ENABLED=0
echo %PATH%
echo Installing Oracle drivers (64 bit)
echo on
go get github.com/mattn/go-oci8
go get gopkg.in/rana/ora.v3
go get gopkg.in/goracle.v1
echo Installing Oracle drivers (32 bit)
call c:\projetos\go\go_32.bat
go get github.com/mattn/go-oci8
go get gopkg.in/rana/ora.v3
go get gopkg.in/goracle.v1
pause

:fim
@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 8, 2016

@ricsmania Thanks for the reply. I completely agree @mattn has done a great job to provide us the driver but got little irritated with the process may be as you say it Oracle's fault but I personally feel its not this difficult to make things up in Java. Simple as adding ojdbc jar and get things up and running. May be its oracle who need to make things simpler when it comes to Go too and provide something which makes users life easy as I see even Go is picking up and gained popularity

Thanks once again @ricsmania and @mattn

@ricsmania I will surely take a look at the bat file u have provide if I still face problems will drop u mail for the links. Thank you guys once again for the quick reply and @mattn for all the hard work

@JunedS

This comment has been minimized.

Copy link
Author

@JunedS JunedS commented Jan 8, 2016

@ricsmania, the resources you provided worked like charm. Thanks

@JunedS JunedS closed this Jan 8, 2016
@mahaben

This comment has been minimized.

Copy link

@mahaben mahaben commented Feb 9, 2017

@ricsmania

Hello, do you still have the package containing all installs?

I've been running into a trouble since 2 days, I still cannot make it work on my windows 64 bit machine.

I have installed TDM 64 bits, pkg config and oracle 64 bits.

When I run go get I have these following errors:

c:/oraclexe/app/oracle/product/11.2.0/server/oci/include/oratypes.h:235:25: erro
r: expected '=', ',', ';', 'asm' or 'attribute' before 'ubig_ora'
typedef unsigned _int64 ubig_ora;
^
c:/oraclexe/app/oracle/product/11.2.0/server/oci/include/oratypes.h:236:25: erro
r: expected '=', ',', ';', 'asm' or 'attribute' before 'sbig_ora'
typedef signed _int64 sbig_ora;
^
In file included from c:/oraclexe/app/oracle/product/11.2.0/server/oci/include/o
ci.h:3029:0,
from ......\github.com\mattn\go-oci8\oci8.go:4:
c:/oraclexe/app/oracle/product/11.2.0/server/oci/include/ociap.h:7452:40: error:
unknown type name 'ubig_ora'
OraText *path, ubig_ora *lenp );
^
c:/oraclexe/app/oracle/product/11.2.0/server/oci/include/ociap.h:7464:36: error:
unknown type name 'ubig_ora'
uword origin, ubig_ora offset, sb1 dir );
^
c:/oraclexe/app/oracle/product/11.2.0/server/oci/include/ociap.h:8271:23: error:
unknown type name 'sbig_ora'
sbig_ora bufferLength, sbig_ora *returnLength,
^
c:/oraclexe/app/oracle/product/11.2.0/server/oci/include/ociap.h:8271:46: error:
unknown type name 'sbig_ora'
sbig_ora bufferLength, sbig_ora *returnLength,

Any idea how to solve it?

Thanks in advance

@oqamar

This comment has been minimized.

Copy link

@oqamar oqamar commented May 14, 2017

@mahaben not sure if you were able to solve your problem. But I was just able to figure out a possibly related issue on my end. I was installing on a Windows 7 64-bit machine.

The problem is that TDM_GCC 64 bits has a bug and is not compatible for compiling this oci8 package. Here is a link that I stumbled across (for an unrelated package) that helped me out with this:

http://stackoverflow.com/questions/35629255/undefined-reference-to-vkcreateinstance

So, I uninstalled TDM_GCC and installed MinGW instead from here:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/

I used version : x86_64-5.3.0-release-posix-seh-rt_v4-rev0

I extracted the files and put the mingw64 folder directly on my C:\ drive. I added this folder to the PATH variable.

I was then able to successfully get oci8 installed and working

A few other points that may be helpful to others:

  • Download the SDK instant client from Oracle (instantclient-sdk-windows.x64-12.2.0.1.0), extract and place files on your local drive, and then add the main folder to your PATH. The "basic / regular" instant client does not contain all the files needed for compiling oci8

  • You will need to have pkg-config.exe on your system. You can download it from here: https://sourceforge.net/projects/pkgconfiglite/ (It is 32 bit but serves the purpose). The purpose of pkg-configlite is that it doesn't need other dependencies to work (from GTK+, which is the case with pkg-config)

  • You will need to place pkg-config.exe file in the bin directory of mingw64. In my case, it was C:\mingw64\bin

@mattn perhaps you can put in the main notes that for Windows platform, make sure to use mingw64 and NOT TDM_Gcc

Hope that helps others!

@oqamar

This comment has been minimized.

Copy link

@oqamar oqamar commented May 14, 2017

Two more helpful items:

  1. The error that I kept getting with TDD_GCC was:

C:/oracle/instantclient_12_2/sdk/lib/msvc/oci.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status

This was solved by using mingw64

  1. The contents of my oci8.pc file are:

libdir=C:/oracle/instantclient_12_2/sdk/lib/msvc
includedir=C:/oracle/instantclient_12_2/sdk/include
gcclib=C:/mingw64/lib
gccinclude=C:/mingw64/include

glib_genmarshal=glib-genmarshal
gobject_query=gobject-query
glib_mkenums=glib-mkenums

Name: oci8
Description: oci8 library
Libs: -L${libdir} -L${gcclib} -loci
Libs.private:
Cflags: -I${includedir} -I${gccinclude}
Version: 12.2

@mattn

This comment has been minimized.

Copy link
Owner

@mattn mattn commented May 14, 2017

I'm using msys2 and installed mingw-w64-x86_64-gcc. This is native Windows compiler that can compile go-oci8 on Windows.

@AndrewWPhillips

This comment has been minimized.

Copy link

@AndrewWPhillips AndrewWPhillips commented Nov 14, 2018

I have both TDM and MSYS gcc (64-bit) installed. (TDM is only way I could get CGO to work. MSYS is needed for some C++ projects.) I eventually solved the "sdk/lib/msvc/oci.lib: error adding symbols: File in wrong format" by removing TDM from my PATH but now I get lots of these messages:

C:/oracle/ora12.2/oci/lib/msvc/oci.lib(OCI.dll.b):(.text+0x2): relocation truncated to fit: R_X86_64_32 against symbol __imp_OCIAttrGet' defined in .idata$5 section in C:/oracle/ora12.2/oci/lib/msvc/oci.lib(OCI.dll.b) C:/oracle/ora12.2/oci/lib/msvc/oci.lib(OCI.dll.b):(.text+0x2): relocation truncated to fit: R_X86_64_32 against symbol __imp_OCIAttrSet' defined in .idata$5 section in C:/oracle/ora12.2/oci/lib/msvc/oci.lib(OCI.dll.b)
...

Using Windows 10 with:
go version go1.10.3 windows/amd64
gcc (GCC) 5.3.0

What is recommended version of gcc?

@MichaelS11

This comment has been minimized.

Copy link
Contributor

@MichaelS11 MichaelS11 commented Nov 14, 2018

I am using https://mingw-w64.org/doku.php/download on Windows 10.

@AndrewWPhillips

This comment has been minimized.

Copy link

@AndrewWPhillips AndrewWPhillips commented Nov 14, 2018

I upgraded and am now using latest mingw (pacman -S mingw64/mingw-w64-x86_64-gcc) and it's working fine.
gcc (Rev2, Built by MSYS2 project) 6.2.0

@MichaelS11

This comment has been minimized.

Copy link
Contributor

@MichaelS11 MichaelS11 commented Nov 14, 2018

Wonderful! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.