jlouis / enacl

Erlang bindings for NaCl / libsodium
MIT License
197 stars 59 forks source link

problems compiling enacl #55

Closed shashank-halloapp closed 3 years ago

shashank-halloapp commented 3 years ago

Hi there!

I've been trying for a while now, I initially thought the issue was that I didn't have libsodium installed (compiler couldn't find the header file sodium.h, but I fixed that and now I'm getting this new set of errors. Any chance I could be pointed in the right direction? Thank you!

cc -I/usr/local/opt/openssl/include -I/usr/local/include -I/usr/local/opt/expat/include -fPIC -I /usr/local/Cellar/erlang@22/22.3.4.12/lib/erlang/erts-10.7.2.5/include/ -I /usr/local/Cellar/erlang@22/22.3.4.12/lib/erlang/lib/erl_interface-3.13.2/include -I/usr/local/opt/openssl/include/ -I/usr/local/include -I/usr/local/opt/expat/include -c -o /Users/test-user/test/testejabberd/deps/enacl/c_src/enacl_nif.o /Users/test-user/test/testejabberd/deps/enacl/c_src/enacl_nif.c
cc /Users/test-user/test/testejabberd/deps/enacl/c_src/enacl_nif.o -L/usr/local/opt/openssl/lib -L/usr/local/lib -L/usr/local/opt/expat/lib -shared -L /usr/local/Cellar/erlang@22/22.3.4.12/lib/erlang/lib/erl_interface-3.13.2/lib -lerl_interface -lei -lsodium -o /Users/test-user/test/testejabberd/deps/enacl/c_src/../priv/enacl_nif.so
Undefined symbols for architecture x86_64:
  "_enif_alloc_binary", referenced from:
      _enif_crypto_box_keypair in enacl_nif.o
      _enif_crypto_box in enacl_nif.o
      _enif_crypto_box_open in enacl_nif.o
      _enif_crypto_box_beforenm in enacl_nif.o
      _enif_crypto_box_afternm in enacl_nif.o
      _enif_crypto_box_open_afternm in enacl_nif.o
      _enif_crypto_sign_keypair in enacl_nif.o
      ...
  "_enif_alloc_resource", referenced from:
      _enif_crypto_generichash_init in enacl_nif.o
  "_enif_get_resource", referenced from:
      _enif_crypto_generichash_update in enacl_nif.o
      _enif_crypto_generichash_final in enacl_nif.o
  "_enif_get_uint", referenced from:
      _enif_randombytes in enacl_nif.o
      _enif_crypto_generichash in enacl_nif.o
      _enif_crypto_generichash_init in enacl_nif.o
      _enif_crypto_generichash_update in enacl_nif.o
      _enif_crypto_generichash_final in enacl_nif.o
  "_enif_get_ulong", referenced from:
      _enif_crypto_stream_chacha20 in enacl_nif.o
      _enif_crypto_stream in enacl_nif.o
  "_enif_inspect_binary", referenced from:
      _enif_crypto_box in enacl_nif.o
      _enif_crypto_box_open in enacl_nif.o
      _enif_crypto_box_beforenm in enacl_nif.o
      _enif_crypto_box_afternm in enacl_nif.o
      _enif_crypto_box_open_afternm in enacl_nif.o
      _enif_crypto_sign in enacl_nif.o
      _enif_crypto_sign_open in enacl_nif.o
      ...
  "_enif_inspect_iolist_as_binary", referenced from:
      _enif_crypto_box in enacl_nif.o
      _enif_crypto_box_open in enacl_nif.o
      _enif_crypto_box_afternm in enacl_nif.o
      _enif_crypto_box_open_afternm in enacl_nif.o
      _enif_crypto_sign in enacl_nif.o
      _enif_crypto_sign_open in enacl_nif.o
      _enif_crypto_sign_detached in enacl_nif.o
      ...
  "_enif_make_atom", referenced from:
      _enif_crypto_sign_verify_detached in enacl_nif.o
      _enif_crypto_auth_verify in enacl_nif.o
      _enif_crypto_onetimeauth_verify in enacl_nif.o
      _enif_crypto_verify_16 in enacl_nif.o
      _enif_crypto_verify_32 in enacl_nif.o
      _enif_sodium_memzero in enacl_nif.o
      _enif_crypto_pwhash in enacl_nif.o
      ...
  "_enif_make_badarg", referenced from:
      _enif_crypto_box_keypair in enacl_nif.o
      _enif_crypto_box in enacl_nif.o
      _enif_crypto_box_open in enacl_nif.o
      _enif_crypto_box_beforenm in enacl_nif.o
      _enif_crypto_box_afternm in enacl_nif.o
      _enif_crypto_box_open_afternm in enacl_nif.o
      _enif_crypto_sign_keypair in enacl_nif.o
      ...
  "_enif_make_binary", referenced from:
      _enif_crypto_box_keypair in enacl_nif.o
      _enif_crypto_box in enacl_nif.o
      _enif_crypto_box_open in enacl_nif.o
      _enif_crypto_box_beforenm in enacl_nif.o
      _enif_crypto_box_afternm in enacl_nif.o
      _enif_crypto_box_open_afternm in enacl_nif.o
      _enif_crypto_sign_keypair in enacl_nif.o
      ...
  "_enif_make_long", referenced from:
      _enif_crypto_box_NONCEBYTES in enacl_nif.o
      _enif_crypto_box_ZEROBYTES in enacl_nif.o
      _enif_crypto_box_BOXZEROBYTES in enacl_nif.o
      _enif_crypto_box_PUBLICKEYBYTES in enacl_nif.o
      _enif_crypto_box_SECRETKEYBYTES in enacl_nif.o
      _enif_crypto_box_BEFORENMBYTES in enacl_nif.o
      _enif_crypto_sign_PUBLICKEYBYTES in enacl_nif.o
      ...
  "_enif_make_resource", referenced from:
      _enif_crypto_generichash_init in enacl_nif.o
      _enif_crypto_generichash_update in enacl_nif.o
  "_enif_make_sub_binary", referenced from:
      _enif_crypto_box in enacl_nif.o
      _enif_crypto_box_open in enacl_nif.o
      _enif_crypto_box_afternm in enacl_nif.o
      _enif_crypto_box_open_afternm in enacl_nif.o
      _enif_crypto_sign in enacl_nif.o
      _enif_crypto_sign_open in enacl_nif.o
      _enif_crypto_secretbox in enacl_nif.o
      ...
  "_enif_make_tuple", referenced from:
      _enif_make_tuple2 in enacl_nif.o
      _enif_make_tuple3 in enacl_nif.o
  "_enif_open_resource_type", referenced from:
      _enif_crypto_load in enacl_nif.o
  "_enif_release_binary", referenced from:
      _enif_crypto_box_open in enacl_nif.o
      _enif_crypto_box_open_afternm in enacl_nif.o
      _enif_crypto_sign_open in enacl_nif.o
      _enif_crypto_box_seal_open in enacl_nif.o
      _enif_crypto_secretbox_open in enacl_nif.o
      _enif_crypto_pwhash in enacl_nif.o
      _enif_crypto_pwhash_str in enacl_nif.o
      ...
  "_enif_release_resource", referenced from:
      _enif_crypto_generichash_init in enacl_nif.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [/Users/test-user/test/testejabberd/deps/enacl/c_src/../priv/enacl_nif.so] Error 1
ERROR: Command [compile] failed!
make: *** [deps/.built] Error 1
jlouis commented 3 years ago

All of the missing symbols are the from Erlang NIF library. So for some reason the linker isn't linking with that library in its load path. I'm guessing it's pointing to the wrong version of Erlang, or it can't find the necessary libraries in the load path. I don't have a MacOS based machine handily available, so I can't reproduce it.

shashank-halloapp commented 3 years ago

Turns out it was a dependency issue, thanks very much!