Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crystal not working in Mac OS X Mojave #6875

Closed
thebradhimself opened this issue Sep 26, 2018 · 8 comments
Closed

Crystal not working in Mac OS X Mojave #6875

thebradhimself opened this issue Sep 26, 2018 · 8 comments

Comments

@thebradhimself
Copy link

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

@jasdeepsingh
Copy link

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

@hovsater
Copy link
Contributor

hovsater commented Sep 27, 2018

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.

@joshuapinter
Copy link

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.

@bcardiff
Copy link
Member

bcardiff commented Mar 1, 2019

@joshuapinter thanks, It's already submitted in a PR crystal-lang/crystal-book#312

@joshuapinter
Copy link

Beauty, thanks! 👍

@vinaysolanki
Copy link

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...

@rdp
Copy link
Contributor

rdp commented Nov 20, 2019

I'd suggest re-opening this until the packaging can be updated to "link directly to OpenSSL in brew" or what not...

@ndbroadbent
Copy link

rexim added a commit to tsoding/kgbotka-2 that referenced this issue Mar 11, 2021
makenowjust pushed a commit to crystal-jp/introducing-crystal that referenced this issue Mar 14, 2021
* Especially `kemal-sample` needs to update dependencies to include kemalcr/kemal#570
* If you faced an error as below
 `ld: library not found for -lssl (this usually means you need to install the development package for libssl)`
  on Mac OS X, `export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig` will help you
  ref: crystal-lang/crystal#6875 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants