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

mac arm64, asdf from homebrew, "crystal play" can't find libssl #51

Open
megatux opened this issue Oct 10, 2022 · 1 comment
Open

mac arm64, asdf from homebrew, "crystal play" can't find libssl #51

megatux opened this issue Oct 10, 2022 · 1 comment

Comments

@megatux
Copy link

megatux commented Oct 10, 2022

crystal play                                                   
Listening on http://127.0.0.1:8080
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/megatux/.cache/crystal/crystal-run-play-1-1.tmp  -rdynamic -L/Users/megatux/.asdf/installs/crystal/1.5.1/embedded/lib -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 -L/opt/homebrew/Cellar/libevent/2.1.12/lib -levent -liconv`

I only tried setting the LIBRARY_PATH variable like this export LIBRARY_PATH=/opt/homebrew/Cellar/[email protected]/1.1.1q/lib but it fails:

crystal play                                                   
Listening on http://127.0.0.1:8080
Undefined symbols for architecture arm64:
  "_ERR_load_crypto_strings", referenced from:
      ___crystal_main in _main.o
  "_OPENSSL_add_all_algorithms_noconf", referenced from:
      ___crystal_main in _main.o
  "_SSL_library_init", referenced from:
      ___crystal_main in _main.o
  "_SSL_load_error_strings", referenced from:
      ___crystal_main in _main.o
  "_SSLv23_method", referenced from:
      _*OpenSSL::SSL::Context::default_method:Pointer(Void) in O-penS-S-L-5858S-S-L-5858C-ontext.o
  "_sk_free", referenced from:
      _~procProc(Pointer(Void), Nil)@/Users/megatux/.asdf/installs/crystal/1.5.1/src/openssl/ssl/hostname_validation.cr:71 in _main.o
      _~proc2Proc(Pointer(Void), Nil)@/Users/megatux/.asdf/installs/crystal/1.5.1/src/openssl/ssl/hostname_validation.cr:71 in _main.o
      _~proc3Proc(Pointer(Void), Nil)@/Users/megatux/.asdf/installs/crystal/1.5.1/src/openssl/ssl/hostname_validation.cr:71 in _main.o
      _~proc4Proc(Pointer(Void), Nil)@/Users/megatux/.asdf/installs/crystal/1.5.1/src/openssl/ssl/hostname_validation.cr:71 in _main.o
      _~proc5Proc(Pointer(Void), Nil)@/Users/megatux/.asdf/installs/crystal/1.5.1/src/openssl/ssl/hostname_validation.cr:71 in _main.o
      _~proc6Proc(Pointer(Void), Nil)@/Users/megatux/.asdf/installs/crystal/1.5.1/src/openssl/ssl/hostname_validation.cr:71 in _main.o
  "_sk_num", referenced from:
      _*OpenSSL::SSL::HostnameValidation::matches_subject_alternative_name<String, Pointer(Void)>:OpenSSL::SSL::HostnameValidation::Result in O-penS-S-L-5858S-S-L-5858H-ostnameV-alidation.o
  "_sk_pop_free", referenced from:
      _*OpenSSL::SSL::HostnameValidation::matches_subject_alternative_name<String, Pointer(Void)>:OpenSSL::SSL::HostnameValidation::Result in O-penS-S-L-5858S-S-L-5858H-ostnameV-alidation.o
  "_sk_value", referenced from:
      _*OpenSSL::SSL::HostnameValidation::matches_subject_alternative_name<String, Pointer(Void)>:OpenSSL::SSL::HostnameValidation::Result in O-penS-S-L-5858S-S-L-5858H-ostnameV-alidation.o
ld: symbol(s) not found for architecture arm64
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/megatux/.cache/crystal/crystal-run-play-1-1.tmp  -rdynamic -L/Users/megatux/.asdf/installs/crystal/1.5.1/embedded/lib -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 -L/opt/homebrew/Cellar/libevent/2.1.12/lib -levent -liconv`
@stufro
Copy link

stufro commented Jul 23, 2023

I've resolved issues like this before by setting

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(brew --prefix openssl)/lib/pkgconfig/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants