gpt4 book ai didi

macos - ld : library not found for -lssl

转载 作者:太空宇宙 更新时间:2023-11-03 14:36:40 25 4
gpt4 key购买 nike

我用自制软件 brew install crystal-lang 安装了 crystal。我能够编译并运行“Hello World!”程序,但是当我尝试编译示例 http 服务器(稍作修改)时,出现错误。

HTTP 服务器:

require "http/server"

port = 3000

server = HTTP::Server.new(port) do |context|
context.response.content_type = "text/plain"
context.response.print "Hello world! The time is #{Time.now}"
end

puts "listening on http://localhost:" + port.to_s
puts "listening on http://localhost:#{port}"
server.listen

错误:

$ crystal server.cr                                                                                                                                        ~/sw/crystal/Lied-Today
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of command failed with code: 1: `cc -o "/Users/Matt/.cache/crystal/crystal-run-server.tmp" "${@}" -rdynamic -lz `command -v pkg-config > /dev/null && pkg-config --libs libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs libcrypto || printf %s '-lcrypto'` -lpcre -lgc -lpthread /usr/local/Cellar/crystal-lang/0.21.1_1/src/ext/libcrystal.a -levent -liconv -ldl -L/usr/lib -L/usr/local/lib`

我试过以下方法:

添加 export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/lib" 到 ~/.zshrc。

$ xcode-select --install
$ xcode-select --switch /Library/Developer/CommandLineTools

最佳答案

我必须添加 LIBRARY_PATH 来解决这个问题。

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/

关于macos - ld : library not found for -lssl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47241650/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com