After the upgrade I reinstalled xcode command line tools.
I've removed and reinstalled OpenSSL, MariaDB, Crystal via homebrew and added it back via crenv.
I get the following error.
ld: library not found for -lssl (this usually means you need to install the development package for libssl)
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/bradleyhintze/workspace/nikola/truck/bin/truck' -rdynamic -lyaml -lz
command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'
-lpcre -lgc -lpthread /usr/local/Cellar/crystal/0.26.1_1/src/ext/libcrystal.a -levent -liconv -ldl -L/usr/lib -L/usr/local/lib
Solution:
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
Fish Shell: set -U -x PKG_CONFIG_PATH /usr/local/opt/openssl/lib/pkgconfig
To add to what @jasdeepsingh is saying. Ensure you have installed pkg-config
. This can be done running brew install pkg-config
. OpenSSL also need to be installed brew install openssl
.
Let pkg-config
know about your OpenSSL installation.
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig
Verify PKG_CONFIG_PATH
is set by running echo $PKG_CONFIG_PATH
. Now, reinstall crystal brew uninstall crystal
and brew install crystal
.
In my case all I had to do was add
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig
to my .bash_profile
file.
Should this be in the docs or installation feedback so people don't have to find it via the Googles?
Happy to write a PR for that.
@joshuapinter thanks, It's already submitted in a PR https://github.com/crystal-lang/crystal-book/pull/312
Beauty, thanks! 馃憤
I first encountered this issue while install Crystal on my Mac and second time while installing icr
(Crystal Interactive Shell)
Easiest way I was able to make it work was by doing:
ln -s /usr/local/Cellar/openssl/1.0.2q/lib/libssl.dylib /usr/local/lib/
(Make sure your openssl version is correct)
and then
ln -s /usr/local/opt/openssl/lib/libcrypto.dylib /usr/local/lib
Then continue with installation...
I'd suggest re-opening this until the packaging can be updated to "link directly to OpenSSL in brew" or what not...
Most helpful comment
To add to what @jasdeepsingh is saying. Ensure you have installed
pkg-config
. This can be done runningbrew install pkg-config
. OpenSSL also need to be installedbrew install openssl
.Let
pkg-config
know about your OpenSSL installation.export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig
Verify
PKG_CONFIG_PATH
is set by runningecho $PKG_CONFIG_PATH
. Now, reinstall crystalbrew uninstall crystal
andbrew install crystal
.