Skip to content

Instantly share code, notes, and snippets.

@bluematt
Last active January 17, 2018 16:53
Show Gist options
  • Save bluematt/5649835d5ec53efc6f81dc9ec4e26218 to your computer and use it in GitHub Desktop.
Save bluematt/5649835d5ec53efc6f81dc9ec4e26218 to your computer and use it in GitHub Desktop.
SSL issues with Crystal

Ubuntu 16.4

Trying to use the http library with Crystal, I kept getting this SSL error.

$ crystal app.cr
_main.o: In function `__crystal_main':
/usr/share/crystal/src/openssl/lib_ssl.cr:213: undefined reference to `SSL_library_init'
/usr/share/crystal/src/openssl/lib_ssl.cr:213: undefined reference to `SSL_load_error_strings'
/usr/share/crystal/src/openssl/lib_ssl.cr:213: undefined reference to `OPENSSL_add_all_algorithms_noconf'
/usr/share/crystal/src/openssl/lib_ssl.cr:213: undefined reference to `ERR_load_crypto_strings'
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o '/home/vagrant/.cache/crystal/crystal-run-app.tmp'  -rdynamic  `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/share/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib

Workaround:

$ sudo apt-get install libssl1.1
# update crystal
$ sudo apt-get update
$ sudo apt-get install crystal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment