ruby - 安装 Gem phashion 时出错:ld: library not found for -ljpeg
问题描述
Pashion
当我在我的 gemfile 中捆绑安装我的项目时。
我遇到了故障排除:
ld: library not found for -ljpeg
.
确认的东西是我jpeg, libjpeg, libpng
通过以下命令安装的。
brew install jpeg
和brew install libjpeg
brew install libpng
gem install phashion -v '1.2.0'
会得到同样的错误。
Machine: MacBook Air (M1, 2020)
Os: macOS BigSur 11.2 (20D64)
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: arm64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Related:
I use homebrew, which has full support on NEW Mac(M1), to install pacakges.
I use rvm(1.29.12) to manage ruby(2.6.3 as default).
解决方案
经过大量搜索和尝试,解决方案如下:
gem install phashion -v '1.2.0'
您将获得故障排除:ld: library not found for -ljpeg
使用 config 安装 phashion
LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/opt/libjpeg/lib gem install phashion -v '1.2.0'
然后您将得到故障排除:fatal error: 'jpeglib.h' file not found
最后的故障排除是因为铿锵路径错误。所以
添加export CPLUS_INCLUDE_PATH=/opt/homebrew/include
到~/.zshrc
不要忘记source ~/.zshrc
。LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/opt/libjpeg/lib gem install phashion -v '1.2.0'
再次运行。
然后您将获得故障排除:ld: library not found for -lpng
LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/opt/libjpeg/lib:/opt/homebrew/opt/libpng/lib gem install phashion -v '1.2.0'
再次运行。
安装成功!
推荐阅读
- python - 使用 cx_Oracle 中 csv 文件中的变量更新数据库
- ruby-on-rails - 表单未使用 form_with 提交
- mysql - 要执行什么类型的查询 (SQL)
- json - RavenDB 批量加载 Json 文档
- wcf - BizTalk WCF 发送端口错误:System.Net.WebException:远程服务器返回意外响应:(413)请求实体太大
- azure-pipelines - Pabot - 并行运行异常
- javascript - 当模块仅导出明文时,为什么动态导入的 ESModule 返回 JSON?
- python - 开始日期和结束日期之间的相关月份-Python
- blazor - OnInitializedAsync VS OnParametersSetAsync 调用 Web API
- spring - Ignite Communication 临时端口范围的列表是什么?