jlouis / enacl

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

trouble compiling on centos6 (libsodium-16 & libsodium-16-devel installed) #46

Closed mynameisajay closed 4 years ago

mynameisajay commented 4 years ago

Hi, I am trying to compile this (release 0.17.2 and 0.16.0 tried) on centos 6 with OTP 22. The sodium.h is installed in /usr/include and points to files in /usr/include/sodium (both of which I checked to make sure).

`Erlang/OTP 22 [erts-10.6.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Eshell V10.6.3 (abort with ^G) 1> `

I keep getting this error:

make: Entering directory/home/xxx/core/_build/default/lib/enacl/c_src' cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -fPIC -I /usr/lib/erlang/erts-10.6.3/include/ -I /usr/lib/erlang/lib/erl_interface-3.13.1/include -c -o /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.o /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c: In function ‘enif_crypto_load’: /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:16: warning: ignoring return value of ‘sodium_init’, declared with attribute warn_unused_result /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c: In function ‘enif_crypto_box’: /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:285: warning: ignoring return value of ‘crypto_box’, declared with attribute warn_unused_result /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c: In function ‘enif_crypto_box_beforenm’: /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:350: warning: ignoring return value of ‘crypto_box_beforenm’, declared with attribute warn_unused_result /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c: In function ‘enif_crypto_kx_SECRETKEYBYTES’: /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1035: error: ‘crypto_kx_SECRETKEYBYTES’ undeclared (first use in this function) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1035: error: (Each undeclared identifier is reported only once /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1035: error: for each function it appears in.) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c: In function ‘enif_crypto_kx_PUBLICKEYBYTES’: /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1040: error: ‘crypto_kx_PUBLICKEYBYTES’ undeclared (first use in this function) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c: In function ‘enif_crypto_kx_SESSIONKEYBYTES’: /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1045: error: ‘crypto_kx_SESSIONKEYBYTES’ undeclared (first use in this function) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c: In function ‘enif_crypto_kx_keypair’: /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1057: error: ‘crypto_kx_PUBLICKEYBYTES’ undeclared (first use in this function) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1061: error: ‘crypto_kx_SECRETKEYBYTES’ undeclared (first use in this function) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1065: warning: implicit declaration of function ‘crypto_kx_keypair’ /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c: In function ‘enif_crypto_kx_server_session_keys’: /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1079: error: ‘crypto_kx_PUBLICKEYBYTES’ undeclared (first use in this function) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1080: error: ‘crypto_kx_SECRETKEYBYTES’ undeclared (first use in this function) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1085: error: ‘crypto_kx_SESSIONKEYBYTES’ undeclared (first use in this function) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1093: warning: implicit declaration of function ‘crypto_kx_server_session_keys’ /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c: In function ‘enif_crypto_kx_client_session_keys’: /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1107: error: ‘crypto_kx_PUBLICKEYBYTES’ undeclared (first use in this function) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1108: error: ‘crypto_kx_SECRETKEYBYTES’ undeclared (first use in this function) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1113: error: ‘crypto_kx_SESSIONKEYBYTES’ undeclared (first use in this function) /home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.c:1121: warning: implicit declaration of function ‘crypto_kx_client_session_keys’ make: *** [/home/xxx/core/_build/default/lib/enacl/c_src/enacl_nif.o] Error 1 make: Leaving directory /home/xxx/core/_build/default/lib/enacl/c_src'

I don't know what I could be doing wrong.

mynameisajay commented 4 years ago

Also, just to make sure, I wrote a test file in c that includes and links to it and everything works.

mynameisajay commented 4 years ago

This is was my fault. I had an older version of libsodium compiled from src in /usr/local/include which trumps /usr/include. Hence the issues.

gcc -xc -E -v -

helped me. closing issue.