
php小编香蕉在使用openssl时遇到了一个错误,提示"ld:警告:找不到选项'-L/usr/local/opt/openssl/lib'的目录"。这个错误通常是由于openssl的库文件路径未正确配置所导致的。解决这个问题的方法是在编译选项中添加正确的openssl库文件路径。
编译与 openssl 调用相关的 tdlib 程序时出现错误。
/opt/homebrew/opt/go/libexec/pkg/tool/darwin_arm64/link: running cc failed: exit status 1 ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib' ld: library not found for -lssl clang: error: linker command failed with exit code 1 (use -v to see invocation)
openssl 已随brew 安装:
which openssl /opt/homebrew/bin/openssl
==> openssl@3: stable 3.1.2 (bottled) Cryptography and SSL/TLS Toolkit https://openssl.org/ /opt/homebrew/Cellar/openssl@3/3.1.2 (6,495 files, 28.4MB) * Poured from bottle using the formulae.brew.sh API on 2023-09-21 at 14:06:03 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/o/[email protected] License: Apache-2.0
我尝试使用 pkg-config 并暴露下一个环境来解决此问题,但没有任何帮助。
export CGO_CFLAGS=$(pkg-config --cflags openssl) export CGO_LDFLAGS=$(pkg-config --libs openssl)
你也可以检查这些标志吗(.~/bashrc 或 ~/.zshrc):
export CGO_CFLAGS="-I/opt/homebrew/include" export CGO_LDFLAGS="-L/opt/homebrew/lib -lssl -lcrypto"
或者你可以使用pkg-config:
export CGO_CFLAGS="$(pkg-config --cflags openssl)" export CGO_LDFLAGS="$(pkg-config --libs openssl)"
以上就是openssl 错误 ld:警告:找不到选项 '-L/usr/local/opt/openssl/lib 的目录的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号