openssl错误:LD警告:无法找到'-L/usr/local/opt/openssl/lib'目录选项
时间:2024-02-06
浏览:490
作者:佚名
今天golang学习网给大家带来了《openssl错误:LD警告:无法找到'-L/usr/local/opt/openssl/lib'目录选项》,其中涉及到的知识点包括等等,无论你是小白还是老手,都适合看一看哦~有好的建议也欢迎大家在评论留言,若是看完有所收获,也希望大家能多多点赞支持呀!一起加油学习~
问题内容
编译与 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)"
以上就是本文的全部内容了,是否有顺利帮助你解决问题?若是能给你带来学习上的帮助,请大家多多支持golang学习网!更多关于Golang的相关知识,也可关注golang学习网公众号。
本文内容来源于互联网,如有侵权请联系删除。
近期热门
11.18
11.15
站内热门
最新文章
12.01
12.01
12.01
热门专题
