I am currently trying to install pycrypto and when I execute python setup.py build I receive this following error:
cc -bundle -undefined dynamic_lookup -arch
I noticed recently that I needed brew to install gmp to get pip install pycrypto working again after upgrading OSX 10.9 and Xcode 5. But then the gmp build started failing on illegal text-relocation. It seems a known issue 12946 causes the compiler to fail compiling position independent code:
cc -bundle -undefined dynamic_lookup -Wl,-F. -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future build/temp.macosx-10.9-intel-2.7/src/_fastmath.o -lgmp -o build/lib.macosx-10.9-intel-2.7/Crypto/PublicKey/_fastmath.so
ld: illegal text-relocation to '___gmp_binvert_limb_table' in /usr/local/lib/libgmp.a(mp_minv_tab.o) from '___gmpn_divexact_1' in /usr/local/lib/libgmp.a(dive_1.o) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
Similar to the answer provided by radiofrequency I symlinked the shared library of gmp into the system's /usr/lib directory as a workaround:
sudo ln -s /usr/local/Cellar/gmp/5.1.3/lib/libgmp.dylib /usr/lib/libgmp.dylib
The gmp developer should add --with-pic.
Side point: the number of warnings building pycrypto does not provide comfort.
I'm a new comer to python; I experienced this problem also; and it vexed me. None of the solutions posted worked for me, so I archived libgmp.a
and libgmp.la
temporarily, and pip
then installed Crypto
without error. Is this an acceptable approach? I have no understanding as to why this worked...