gcc - 无法链接 gmp:找不到 -lgmp 的库
问题描述
我正在尝试fastecdsa
通过运行安装在 macOS BigSur(M1 芯片)上
(venv) $ pip3 install fastecdsa
即使我以前安装过gmp
:
$ brew install gmp
无论我做什么,它都找不到库
src/curve.h:4:10: fatal error: 'gmp.h' file not found
#include "gmp.h"
虽然在我创建符号链接时错误发生了变化
ln -s /opt/homebrew/include/gmp.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
现在我得到:
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
我也试过:
- 通过 env 传递路径
CFLAGS
,LDFLAGS
并且都通过全局 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
- 无休止
brew uninstall gmp
的和brew install gmp
,甚至brew reinstall gmp
和brew unlink gmp
- 安装rosetta2
- 将其关闭并再次打开
我不能把我的手指放在它上面:(
解决方案
你现在可能已经解决了这个问题,但只是说我遇到了类似的事情,我的解决方案是告诉我ld
查看自制库路径。运行此/将其添加到~/.profile
:
export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib
export INCLUDE_PATH=$INCLUDE_PATH:/opt/homebrew/include
(在我的情况下,我不需要 INCLUDE_PATH,但看起来你可能需要!)
在那之后,也许您的 python 命令将开始工作!
推荐阅读
- excel - Excel:查找具有数字范围的匹配行
- javascript - 父模型中没有任何字段的Django动态内联表单集不起作用
- amazon-dynamodb - 我可以使用适用于 NodeJS 的 AWS DynamoDB 开发工具包检索查询执行时间和其他统计信息吗?
- angular - Angular 提供在子组件的 viewProviders 中的父组件的 viewProviders 创建的服务
- reinforcement-learning - RL 环境 - OpenAI Gym Taxi-v2 与 Taxi-v3
- r - 匹配具有不同列名的两个数据框,并创建具有另一个平均值的新列
- swift - 如何计算Swift数组中的维数
- queue - 在 octobercms 中使用 laradock nohup php artisan queue:work --daemon & does not work.but手动运行works.how解决?
- html - 响应式 flexbox 和重新排序子子项
- javascript - 将不同的 CSS 样式应用于 Joomla 智能搜索自动完成建议