2

I am trying to install pycrypto package on Mac OS X by running following command :

ARCHFLAGS=-Wno-error CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib sudo -E pip install pycrypto**

But it fails and show following error :

/usr/bin/clang -bundle -undefined dynamic_lookup -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -L/opt/local/lib -Wno-error -L/opt/local/lib -I/opt/local/include -Wno-error build/temp.macosx-10.6-x86_64-3.4/src/_fastmath.o -lgmp -o build/lib.macosx-10.6-x86_64-3.4/Crypto/PublicKey/_fastmath.so

ld: library not found for -lSystem

clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: command '/usr/bin/clang' failed with exit status 1

Michael
  • 32,527
  • 49
  • 210
  • 370
Gaurav
  • 1,891
  • 1
  • 17
  • 20

3 Answers3

5
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1

For the error above, the following works for me on Yosemite.

brew install gmp
export LIBRARY_PATH=/usr/local/lib
pip install pycrypto
ronnefeldt
  • 2,083
  • 23
  • 24
2

I have fixed this by running following command -

CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I/usr/local/include" LDFLAGS="-L/usr/local/lib" pip install pycrypto

Issue was that my default '-isysroot' was pointing to 10.6 SDK and clang file was from 10.9 SDK.

-Gaurav

Gaurav
  • 1,891
  • 1
  • 17
  • 20
  • this worked for me, thanks! (used sdk 10.11 on osx 10.11.2) – verboze Mar 29 '16 at 19:40
  • Thanks. Changing 10.9.sdk to 10.11.sdk worked for me too. – Singletoned Apr 27 '16 at 09:45
  • For 10.13 I did CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -I/usr/local/include" LDFLAGS="-L/usr/local/lib" pip install pycrypto` – Sebastian Mar 20 '18 at 00:18
0

I had this issue on MacOs Catalina and I don't have /Applications/Xcode.app folder (I guess because I don't have Xcode App), so I used another SDK path

 CFLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include" LDFLAGS="-L/usr/local/lib" pip install pycrypto

and it worked.

Semant1ka
  • 647
  • 10
  • 26