I am trying to install cx_Oracle on my Mac Mavericks. Met with the following error. Any help, please.

The sequence is:

sudo easy_install cx_Oracle
...
Processing cx_Oracle-5.1.2.tar.gz
Writing /tmp/easy_install-eFOU_a/cx_Oracle-5.1.2/setup.cfg
Running cx_Oracle-5.1.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-eFOU_a/cx_Oracle-5.1.2/egg-dist-tmp-g2eCKt
ld: file not found: crt3.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: Setup script exited with error: command '/usr/bin/clang' failed with exit status 1
有帮助吗?

解决方案

I did not dig deeply but I found some workaround for this issue. I cloned repo from https://bitbucket.org/anthony_tuininga/cx_oracle and ran

python setup.py build

Got an error:

/usr/bin/clang -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib build/temp.macosx-10.4-x86_64-2.7-11g/cx_Oracle.o -L/opt/instantclient_11_2 -lclntsh -o build/lib.macosx-10.4-x86_64-2.7-11g/cx_Oracle.so -shared-libgcc
ld: file not found: crt3.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1

After that I just copy & paste the command from output

/usr/bin/clang -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib build/temp.macosx-10.4-x86_64-2.7-11g/cx_Oracle.o -L/opt/instantclient_11_2 -lclntsh -o build/lib.macosx-10.4-x86_64-2.7-11g/cx_Oracle.so -shared-libgcc

And ran

python setup.py install

SUDDENLY egg has been successfully installed.

Hope this helps.

其他提示

  1. First download oracle mac client files from Oracle site, the two below

Instant Client Package - Basic: All files required to run OCI, OCCI

Instant Client Package - SQLPlus: Additional libraries and executable for running SQLPlus with Instant Client

  1. Then unzip all and put in single folder. Now point that path to "LD LIBRARY PATH" for mac as two environment variable exports shown below

export DYLD_LIBRARY_PATH=/Users/myUserName/Desktop/ORA_CLIENT/oracle_client export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: /Users/myUserName/Desktop/ORA_CLIENT/oracle_client

  1. Now download cx_oracle source code tar ball, unzip it go to the source folder, run

pip setup.py install

  1. Will get the below error

ld: file not found: crt3.o

  1. Now copy the gcc bundle command just above the command line run output (sample pasted below)

gcc -bundle -undefined dynamic_lookup build/temp.macosx-10.4-x86_64-2.7-11g/cx_Oracle.o -L/Users/myUserName/Desktop/ORA_CLIENT/oracle_client -lclntsh -o build/lib.macosx-10.4-x86_64-2.7-11g/cx_Oracle.so -shared-libgcc

  1. Paste it in command line, hit enter. It will go thru. Now run “python setup.py install”. It will be done
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top