我检查并安装了libevent,GCC也安装了。LLVM已更新。运行Crystal Play正常工作,然后崩溃,出现以下错误。我可以看到localhost的输出。但它会尝试运行代码,然后就会崩溃。
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.2.0
CPUs-MacBook-Air:~ cpu$ crystal play
Listening on http://localhost:8080
ld: library not found for -levent
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/cpu/Documents/homebrew/.crystal/crystal-run-play-1-1.tmp" "${@}" -rdynamic -lssl -lcrypto -lz /usr/local/Cellar/crystal-lang/0.14.2/src/ext/libcrystal.a -levent -lpcre -liconv -lgc -lpthread -ldl`
查看OSX安装页面:http://crystal-lang.org/docs/installation/on_mac_osx_using_homebrew.html
您可能需要为xcode执行以下操作才能找到libevent:
$ xcode-select --install
$ xcode-select --switch /Library/Developer/CommandLineTools