'Cannot link gmp: library not found for -lgmp
I'm trying to install fastecdsa
on macOS BigSur (M1 chip) by running
(venv) $ pip3 install fastecdsa
and even though I previously installed gmp
:
$ brew install gmp
it cant find the lib, no matter what I do
src/curve.h:4:10: fatal error: 'gmp.h' file not found
#include "gmp.h"
Although the error changed when I created a symlink
ln -s /opt/homebrew/include/gmp.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
and now I get:
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/gcc' failed with exit code 1
I also tried:
- passing the path via env
CFLAGS
,LDFLAGS
and both via global env export (export CFLAGS=...
)
LDFLAGS=-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib pip3 install fastecdsa
CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include pip3 install fastecdsa
xcode-select --install
- endlessly
brew uninstall gmp
andbrew install gmp
, evenbrew reinstall gmp
andbrew unlink gmp
- installing rosetta2
- turning it off and on again
I can't put my finger on it :(
Solution 1:[1]
Solution 2:[2]
You may have resolved this by now, but just to say that I ran into something similar, and the solution for me was to tell ld
to look in the homebrew library path. Run this/add it to ~/.profile
:
export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib
export INCLUDE_PATH=$INCLUDE_PATH:/opt/homebrew/include
(I didn't need INCLUDE_PATH in my case, but it looks like you might!)
After that, perhaps your python commands will start working!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jack |
Solution 2 | jsdw |