K2InformaticsGmbH / erloci

Erlang Oracle native driver - DEPRECATED, see https://github.com/K2InformaticsGmbH/oranif instead
Apache License 2.0
37 stars 11 forks source link

compile failed in my mac #11

Closed homeway closed 9 years ago

homeway commented 9 years ago
~/erlang/research/erloci (master) 326h18m $ rebar co
==> erloci (compile)
c++ -ggdb -Wall -I/Users/homeway/erlang/erts/17.3/lib/erl_interface-3.7.18/include  -Ic_src/erloci_drv -Ic_src/erloci_lib -I/Users/homeway/Applications/oracle_client_sdk_11_2/sdk/include   -c -o c_src/erloci_drv/threads.o c_src/erloci_drv/threads.cpp
c_src/erloci_drv/threads.cpp:181:3: error: use of undeclared identifier 'pthread_yield'
                pthread_yield();
                ^
1 error generated.
make: *** [c_src/erloci_drv/threads.o] Error 1
ERROR: Command [compile] failed!
c-bik commented 9 years ago

I don't have a mac to test a fix for this, but I know someone has already fixed and tested it. Asked for a patch for it, hopefully will get it soon.

c-bik commented 9 years ago

Please confirm if https://github.com/k2informatics/erloci/commit/aabf37b4e8104db248e9073eadb53e1712055520 works for you?

c-bik commented 9 years ago

@homeway can you please verify and provide some feedback on this? (or close the issue if its fixed for you)

homeway commented 9 years ago

I m very sorry!! But I still got an error to building yet : (

ld: library not found for -locci?

$ rebar co
==> erloci (compile)
g++ -Wall -L/Users/homeway/erlang/erts/17.3/lib/erl_interface-3.7.18/lib -Lpriv -L/Users/homeway/Applications/oracle_client_sdk_11_2/lib priv/liberloci.a c_src/erloci_drv/cmd_queue.o c_src/erloci_drv/command.o c_src/erloci_drv/erloci.o c_src/erloci_drv/logger.o c_src/erloci_drv/marshal.o c_src/erloci_drv/port.o c_src/erloci_drv/term.o c_src/erloci_drv/threadpool.o c_src/erloci_drv/threads.o c_src/erloci_drv/transcoder.o -levent -lpthread -lerl_interface -lei -lerloci -locci -lclntsh -lnnz11 -o priv/ocierl
ld: library not found for -locci
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [priv/ocierl] Error 1
ERROR: Command [compile] failed!
homeway commented 9 years ago

I have an oracle client lib in /opt/oracle/instantclient_11_2

$ ls -l /opt/oracle/instantclient_11_2/
total 382912
-rw-rw-rw-@ 1 homeway  wheel        484  2 15  2013 BASIC_README
-rw-rw-rw-@ 1 homeway  wheel        488  3 15  2013 SQLPLUS_README
-rwxrwxrwx@ 1 homeway  wheel      10252  2 15  2013 adrci
-rwxrwxrwx@ 1 homeway  wheel      40768  2 15  2013 genezi
-r--r--r--@ 1 homeway  wheel        368  4 10  2011 glogin.sql
lrwxr-xr-x  1 root     wheel         20  9 10  2013 libclntsh.dylib -> libclntsh.dylib.11.1
-rwxrwxrwx@ 1 homeway  wheel   64771444 12 19  2012 libclntsh.dylib.11.1
-rwxrwxrwx@ 1 homeway  wheel    2808528  2 15  2013 libnnz11.dylib
-rwxrwxrwx@ 1 homeway  wheel    1897664 12 19  2012 libocci.dylib.11.1
-rwxrwxrwx@ 1 homeway  wheel  118379468  2 15  2013 libociei.dylib
-rwxrwxrwx@ 1 homeway  wheel     158924 12 19  2012 libocijdbc11.dylib
-rwxrwxrwx@ 1 homeway  wheel    1385860  3 15  2013 libsqlplus.dylib
-rwxrwxrwx@ 1 homeway  wheel    1504252  3 15  2013 libsqlplusic.dylib
-rw-rw-rw-@ 1 homeway  wheel    2095661  5 29  2012 ojdbc5.jar
-rw-rw-rw-@ 1 homeway  wheel    2714016  5 29  2012 ojdbc6.jar
drwxrwxrwx@ 8 homeway  wheel        272  9 10  2013 sdk
-rwxr-xr-x@ 1 homeway  wheel       8744  3 15  2013 sqlplus
-rwxrwxrwx@ 1 homeway  wheel     162324  2 15  2013 uidrvci
-rw-rw-rw-@ 1 homeway  wheel      66779 12 19  2012 xstreams.jar

this is my bash_profile:

$ cat ~/.bash_profile
...
## oracle client setting
export ORACLE_HOME=/opt/oracle/instantclient_11_2/
export DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2
export INSTANT_CLIENT_LIB_PATH=/Users/homeway/Applications/oracle_client_sdk_11_2/lib
export INSTANT_CLIENT_INCLUDE_PATH=/Users/homeway/Applications/oracle_client_sdk_11_2/sdk/include
export ERL_INTERFACE_DIR=/Users/homeway/erlang/erts/17.4/lib/erl_interface-3.7.20/
...
c-bik commented 9 years ago

DYLD_LIBRARY_PATH and INSTANTCLIENT* has different path prefix

Can you try with a single copy of the library?

homeway commented 9 years ago

I try it and got a same result:

$ cat ~/.bash_profile
## oracle client setting
export ORACLE_HOME=/opt/oracle/instantclient_11_2/
export DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2
export INSTANT_CLIENT_LIB_PATH=/opt/oracle/instantclient_11_2
export INSTANT_CLIENT_INCLUDE_PATH=/opt/oracle/instantclient_11_2/sdk/include/
export ERL_INTERFACE_DIR=/Users/homeway/erlang/erts/17.4/lib/erl_interface-3.7.20/
...

$ . ~/.bash_profile

$ rebar co
==> erloci (compile)
g++ -Wall -L/Users/homeway/erlang/erts/17.4/lib/erl_interface-3.7.20//lib -Lpriv -L/opt/oracle/instantclient_11_2 priv/liberloci.a c_src/erloci_drv/cmd_queue.o c_src/erloci_drv/command.o c_src/erloci_drv/erloci.o c_src/erloci_drv/logger.o c_src/erloci_drv/marshal.o c_src/erloci_drv/port.o c_src/erloci_drv/term.o c_src/erloci_drv/threadpool.o c_src/erloci_drv/threads.o c_src/erloci_drv/transcoder.o -levent -lpthread -lerl_interface -lei -lerloci -locci -lclntsh -lnnz11 -o priv/ocierl
ld: library not found for -locci
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [priv/ocierl] Error 1
ERROR: Command [compile] failed!
c-bik commented 9 years ago

This is clearly a library file availability issue. And perhaps a path problem. Can you compile any c/c++ that links to occi?

acautin commented 9 years ago

Hi, probably there is a step missing on the documentation, libocci.dylib.11.1 should have a symbolic link or be renamed to libocci.dylib to be found. Should be the same for other libs.

c-bik commented 9 years ago

@Agustin,

If you have it working with a symbolic link will you please make a pull request to erloci/README with that mac specific info?

That will be super great!

Thanks a lot.

@homeway Can you try what @acautin proposed?

homeway commented 9 years ago

Yes ! compiled!!!

$ ln libocci.dylib.11.1 libocci.dylib

Thanks @acautin and @c-bik !

$ rebar co
==> erloci (compile)
g++ -Wall -L/Users/homeway/erlang/erts/17.4/lib/erl_interface-3.7.20//lib -Lpriv -L/opt/oracle/instantclient_11_2 priv/liberloci.a c_src/erloci_drv/cmd_queue.o c_src/erloci_drv/command.o c_src/erloci_drv/erloci.o c_src/erloci_drv/logger.o c_src/erloci_drv/marshal.o c_src/erloci_drv/port.o c_src/erloci_drv/term.o c_src/erloci_drv/threadpool.o c_src/erloci_drv/threads.o c_src/erloci_drv/transcoder.o -levent -lpthread -lerl_interface -lei -lerloci -locci -lclntsh -lnnz11 -o priv/ocierl
erloci compiled!!!
Compiled src/erloci.erl
Compiled src/oci_logger.erl
Compiled src/oci_port.erl
Compiled src/oci_util.erl