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

Link failure on OTP 24 #28

Open
whitelynx opened this issue Jan 6, 2022 · 3 comments
Open

Link failure on OTP 24 #28

whitelynx opened this issue Jan 6, 2022 · 3 comments

Comments

@whitelynx
Copy link

I have Erlang 24.2 installed, and I'm getting linker errors when building bcrypt:

 make
/usr/bin/rebar3 compile
===> Verifying dependencies...
===> Fetching poolboy v1.5.2
===> Analyzing applications...
===> Compiling poolboy
make[1]: Entering directory '/home/whitelynx/Development/Other/bcrypt/c_src'
cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -D_DEFAULT_SOURCE -fPIC -I /usr/lib/erlang/erts-12.2/include/ -I /usr/lib/erlang/lib/erl_interface-5.1/include  -c -o bcrypt_port.o bcrypt_port.c
cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -D_DEFAULT_SOURCE -fPIC -I /usr/lib/erlang/erts-12.2/include/ -I /usr/lib/erlang/lib/erl_interface-5.1/include  -c -o blowfish.o blowfish.c
cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -D_DEFAULT_SOURCE -fPIC -I /usr/lib/erlang/erts-12.2/include/ -I /usr/lib/erlang/lib/erl_interface-5.1/include  -c -o bcrypt_nif.o bcrypt_nif.c
cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -D_DEFAULT_SOURCE -fPIC -I /usr/lib/erlang/erts-12.2/include/ -I /usr/lib/erlang/lib/erl_interface-5.1/include  -c -o bcrypt.o bcrypt.c
bcrypt.c: In function ‘encode_salt’:
bcrypt.c:137:38: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
  137 |         snprintf(salt + 4, 4, "%2.2u$", logr);
      |                                      ^
bcrypt.c:137:9: note: ‘snprintf’ output between 4 and 5 bytes into a destination of size 4
  137 |         snprintf(salt + 4, 4, "%2.2u$", logr);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bcrypt.c: In function ‘ts_bcrypt’:
bcrypt.c:241:43: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
  241 |         snprintf(encrypted + i, 4, "%2.2u$", logr);
      |                                           ^
bcrypt.c:241:9: note: ‘snprintf’ output between 4 and 5 bytes into a destination of size 4
  241 |         snprintf(encrypted + i, 4, "%2.2u$", logr);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -D_DEFAULT_SOURCE -fPIC -I /usr/lib/erlang/erts-12.2/include/ -I /usr/lib/erlang/lib/erl_interface-5.1/include  -c -o async_queue.o async_queue.c
cc ./bcrypt_port.o ./blowfish.o ./bcrypt_nif.o ./bcrypt.o ./async_queue.o  -shared -L /usr/lib/erlang/lib/erl_interface-5.1/lib -lei -lpthread -o ./../priv/bcrypt_nif.so
cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -D_DEFAULT_SOURCE -fPIC -I /usr/lib/erlang/erts-12.2/include/ -I /usr/lib/erlang/lib/erl_interface-5.1/include bcrypt_port.o bcrypt.o blowfish.o  -L /usr/lib/erlang/lib/erl_interface-5.1/lib -lei -lpthread -o ../priv/bcrypt
/usr/bin/ld: bcrypt_port.o: in function `process_reply':
bcrypt_port.c:(.text+0x5a): undefined reference to `ei_x_new_with_version'
/usr/bin/ld: bcrypt_port.c:(.text+0x6f): undefined reference to `ei_x_encode_tuple_header'
/usr/bin/ld: bcrypt_port.c:(.text+0x82): undefined reference to `ei_x_encode_long'
/usr/bin/ld: bcrypt_port.c:(.text+0x9f): undefined reference to `ei_x_encode_binary'
/usr/bin/ld: bcrypt_port.c:(.text+0x164): undefined reference to `ei_x_free'
/usr/bin/ld: bcrypt_port.o: in function `process_error_reply':
bcrypt_port.c:(.text+0x1ea): undefined reference to `ei_x_new_with_version'
/usr/bin/ld: bcrypt_port.c:(.text+0x1ff): undefined reference to `ei_x_encode_tuple_header'
/usr/bin/ld: bcrypt_port.c:(.text+0x212): undefined reference to `ei_x_encode_long'
/usr/bin/ld: bcrypt_port.c:(.text+0x225): undefined reference to `ei_x_encode_atom'
/usr/bin/ld: bcrypt_port.c:(.text+0x2f4): undefined reference to `ei_x_free'
/usr/bin/ld: bcrypt_port.o: in function `loop':
bcrypt_port.c:(.text+0x482): undefined reference to `ei_decode_version'
/usr/bin/ld: bcrypt_port.c:(.text+0x49d): undefined reference to `ei_decode_tuple_header'
/usr/bin/ld: bcrypt_port.c:(.text+0x4c0): undefined reference to `ei_decode_long'
/usr/bin/ld: bcrypt_port.c:(.text+0x4d6): undefined reference to `ei_decode_tuple_header'
/usr/bin/ld: bcrypt_port.c:(.text+0x501): undefined reference to `ei_get_type'
/usr/bin/ld: bcrypt_port.c:(.text+0x538): undefined reference to `ei_decode_binary'
/usr/bin/ld: bcrypt_port.c:(.text+0x55a): undefined reference to `ei_decode_long'
/usr/bin/ld: bcrypt_port.c:(.text+0x5a9): undefined reference to `ei_get_type'
/usr/bin/ld: bcrypt_port.c:(.text+0x5db): undefined reference to `ei_decode_binary'
/usr/bin/ld: bcrypt_port.o: in function `main':
bcrypt_port.c:(.text.startup+0x5): undefined reference to `ei_init'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:70: ../priv/bcrypt] Error 1
make[1]: Leaving directory '/home/whitelynx/Development/Other/bcrypt/c_src'
===> Hook for compile failed!

make: *** [Makefile:9: compile] Error 1
@whitelynx
Copy link
Author

Found an issue that mentions some of these errors: alloverse/alloplace#9 (comment)

It looks like it may have to do with linker flags ordering. I'll try messing with those and see if I can get it building.

@mworrell
Copy link
Member

mworrell commented Jan 6, 2022

We do run tests on OTP24, which seem to be fine.

What OS do you use?

@whitelynx
Copy link
Author

I'm on Manjaro Linux. Using the official package for community/erlang 24.2-1.

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

2 participants