【发布时间】:2021-02-11 00:29:48
【问题描述】:
我是 macOS 新手,在使用库 libjpeg 时遇到问题。
使用 brew install jpeg 安装后,我什至尝试重新安装。
joshbone@Joshs-Mac-mini ~ % brew reinstall jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-9d.arm64_big_sur.bottl
Already downloaded: /Users/joshbone/Library/Caches/Homebrew/downloads/12e480d7337641afc99230ff2b626197e3206ea378eef8ccbb8b11f587afe7f4--jpeg-9d.arm64_big_sur.bottle.tar.gz
==> Reinstalling jpeg
==> Pouring jpeg-9d.arm64_big_sur.bottle.tar.gz
???? /opt/homebrew/Cellar/jpeg/9d: 21 files, 1001.2KB
然后我尝试查看是否可以找到该库,我在终端中键入以下命令:“gcc -ljpeg”。这给出了以下输出:
ld: library not found for -ljpeg
clang: error: linker command failed with exit code 1 (use -v to see invocation)
为什么找不到库?我能做些什么来修复安装?我是否正确使用了这些终端命令?
编辑:我设法在 /opt/homebrew/Cellar/jpeg/9d/lib 下找到了符号链接 (.dylib)。但是当我运行 gcc -ljpeg -L /opt/homebrew/Cellar/jpeg/9d/lib/ 时,我收到以下错误消息:
Undefined symbols for architecture arm64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
【问题讨论】:
-
尝试添加
-L /usr/local/lib