2017-03-16 4 views
3

Ich installierte Kristall mit Homebrew brew install crystal-lang. Ich konnte eine "Hallo Welt!" Kompilieren und ausführen Programm, aber wenn ich versuche, den Beispiel http-Server (mit einer leichten Änderung) zu kompilieren, erhalte ich einen Fehler.ld: Bibliothek nicht gefunden für -lssl

HTTP-Server:

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 

Fehler:

$ 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` 

Ich habe versucht, die folgenden:

Hinzufügen export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/lib" zu ~/.zshrc.

und

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

Antwort

5

Ich brauchte Xcode Finish einbauen zu lassen, bevor die zweite Xcode-Select-Befehl ausgeführt wird.

Verwandte Themen