Search code examples
crystal-lang

Errors when running Crystal Play


I have check and libevent is installed, GCC is installed. LLVM is updated. Running Crystal Play works and then crashes with the below error. I can see the localhost output. But it will try to run the code then it will crash.

    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`

Solution

  • Have a look to the OSX installation page: http://crystal-lang.org/docs/installation/on_mac_osx_using_homebrew.html

    You'll may have to execute these actions for xcode to find libevent:

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