当尝试从hello运行程序https://github.com/askn/crystal-by-example时,我得到以下输出
$ crystal hello.cr
ld: library not found for -lgc
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/senpo/.cache/crystal/crystal-run-hello.tmp' -rdynamic -lpcre -lgc -lpthread /opt/brew/Cellar/crystal-lang/0.24.1_1/src/ext/libcrystal.a -levent -liconv -ldl -L/usr/lib -L/usr/local/lib`我已经试过
xcode-select --installxcode-select --switch /Library/Developer/CommandLineTools但还是会犯同样的错误。有人能帮我把水晶安装好吗?
发布于 2018-01-23 18:04:32
我在https://github.com/crystal-lang/crystal/issues/3067中找到了一个解决方案。这似乎是一个众所周知的水晶问题。解决方案是将环境变量LIBRARY_PATH设置为自制安装的库文件夹,在我的例子中是/opt/brew/lib。
export LIBRARY_PATH=/opt/brew/lib发布于 2018-01-21 13:06:39
使用run命令运行它
crystal run hello.cr或者您可以构建包并运行生成的代码。
crystal build hello.cr
./hellohttps://stackoverflow.com/questions/48359058
复制相似问题