erlangpack / bcrypt

Erlang wrapper for OpenBSD's Blowfish password hashing code
https://hex.pm/packages/bcrypt
Other
16 stars 19 forks source link

Fails to compile on OTP 23 due to erl_interface.h #9

Closed codeadict closed 4 years ago

codeadict commented 4 years ago

OTP 23 deprecated erl_interface and this package now fails with:

===> Compiling /Users/codeadict/dev/bcrypt/c_src/bcrypt_port.c
===> /Users/codeadict/dev/bcrypt/c_src/bcrypt_port.c:20:10: fatal error: 'erl_interface.h' file not found
#include <erl_interface.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.
mworrell commented 4 years ago

Looking at the docs this needs to be changed to ei.h and its functions.

http://erlang.org/doc/tutorial/erl_interface.html

codeadict commented 4 years ago

Correct, it needs to use ei.h, all the erl_* functions were removed.

mworrell commented 4 years ago

You can check pull request #10

It does remove support for OTP 19 and 20. As they don't seem to have the newer ei functions.

mworrell commented 4 years ago

There is a problem with the Hex.pm deployment keys. I have asked @ddeboer to have a look or add another user to the erlangpack org on Hex.

codeadict commented 4 years ago

It still fails on 21.0 and 21.2 fyi, seems like will need to up the minimum supported version:

cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -fPIC -I /home/travis/otp/21.2/erts-10.2/include/ -I /home/travis/otp/21.2/lib/erl_interface-3.10.4/include  -c -o /home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src/blowfish.o /home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src/blowfish.c

cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -fPIC -I /home/travis/otp/21.2/erts-10.2/include/ -I /home/travis/otp/21.2/lib/erl_interface-3.10.4/include  -c -o /home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src/async_queue.o /home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src/async_queue.c

cc /home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src/bcrypt.o /home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src/bcrypt_nif.o /home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src/bcrypt_port.o /home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src/blowfish.o /home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src/async_queue.o  -shared -L /home/travis/otp/21.2/lib/erl_interface-3.10.4/lib -lei -lpthread -o /home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src/../priv/bcrypt_nif.so

cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -fPIC -I /home/travis/otp/21.2/erts-10.2/include/ -I /home/travis/otp/21.2/lib/erl_interface-3.10.4/include bcrypt_port.o bcrypt.o blowfish.o  -L /home/travis/otp/21.2/lib/erl_interface-3.10.4/lib -lei -lpthread -o ../priv/bcrypt

bcrypt_port.o: In function `main':

bcrypt_port.c:(.text.startup+0x7): undefined reference to `ei_init'

collect2: error: ld returned 1 exit status

make: *** [/home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src/../priv/bcrypt] Error 1

make: Leaving directory `/home/travis/build/vernemq/vernemq/_build/default/lib/bcrypt/c_src'
mworrell commented 4 years ago

Apparently something changed between 21.0 and 21.3... as the Travis build works ok.

Can you check locally on some other versions? Just to be sure that the Makefile is ok.

If we know which version works then we set the minimal OTP version.

codeadict commented 4 years ago

I've checked and 21.3 is the minimum version that supports this

mworrell commented 4 years ago

Then I will set the min version to 21.3 and move the tag tomorrow.

mworrell commented 4 years ago

I have include merge request #11 which sets the min otp version to 21.3 and also explains this in the readme file.

mworrell commented 4 years ago

Closing this issue, documentation should resolve any questions regarding the OTP version.

mworrell commented 4 years ago

@codeadict Made release 1.1.0 - @ddeboer is working on the GH action to publish it to Hex

ddeboer commented 4 years ago

Done: https://github.com/erlangpack/bcrypt/runs/706471291.