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

Concerning warning compiling under Nerves #166

Closed
lawik opened this issue Sep 14, 2021 · 16 comments
Closed

Concerning warning compiling under Nerves #166

lawik opened this issue Sep 14, 2021 · 16 comments
Labels
bug Something isn't working

Comments

@lawik
Copy link

lawik commented Sep 14, 2021

Is this something to worry about?

08:41:16.929 [warn]  The on_load function for module Elixir.Exqlite.Sqlite3NIF returned:
{:error,
 {:load_failed,
  'Failed to load NIF library: \'/home/lawik/projects/calendar_gadget/firmware/_build/rpi0_dev/lib/exqlite/priv/sqlite3_nif.so: wrong ELF class: ELFCLASS32\''}}

I haven't tried it yet, maybe it works, I'll update as I do.

@warmwaffles
Copy link
Member

Need some details, is the system a 64 bit system or 32? because that is a 32 bit compiled ELF file. Looks like I need to get #165 done sooner rather than later.

@lawik
Copy link
Author

lawik commented Sep 14, 2021

Building for an Rpi0 in this case. Should be 32 bit.

Definitely ARM.

@lawik
Copy link
Author

lawik commented Sep 30, 2021

It seems to work fine ... :)

@LostKobrakai
Copy link
Contributor

LostKobrakai commented Oct 13, 2021

I just hit a similar warning. Maybe this is somehow cross compiling the NIF, but still trying to load it for the host system arch?

14:39:41.630 [warn]  The on_load function for module Elixir.Exqlite.Sqlite3NIF returned:
{:error,
 {:load_failed,
  'Failed to load NIF library: \'dlopen(/Users/benni/Work/erlang_solutions/Sparkmeter/edith/_build/radia_prod/lib/exqlite/priv/sqlite3_nif.so, 2): no suitable image found.  Did find:\n\t/Users/benni/Work/erlang_solutions/Sparkmeter/edith/_build/radia_prod/lib/exqlite/priv/sqlite3_nif.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x01 0x01 0x01 0x00\n\t/Users/benni/Work/erlang_solutions/Sparkmeter/edith/_build/radia_prod/lib/exqlite/priv/sqlite3_nif.so: stat() failed with errno=35\''}}

Edit: Seems like it's not working for me on the device, so might be something else.

@warmwaffles
Copy link
Member

@LostKobrakai is it ARM32?

@LostKobrakai
Copy link
Contributor

LostKobrakai commented Oct 13, 2021

@warmwaffles yes. It's armv7

@warmwaffles
Copy link
Member

Is that the same as a ARM Cortex-A72? I've got a spare raspberry pi compute module 4 that I've been needing to setup and I could probably use the push to make it happen.

@warmwaffles
Copy link
Member

Ah no, it is "ARMv8-A" but I'll still get it setup regardless tonight and will do some poking.

@LostKobrakai
Copy link
Contributor

The warning is from building the firmware, so no hardware needed, but I guess it's still good to be able to confirm it working on actual hardware as well.

@LostKobrakai
Copy link
Contributor

LostKobrakai commented Oct 14, 2021

I just setup a test nerves project and tried compiling for arm 32 (rpi) and arm 64 (rpi4) and got the same error for both.

@LostKobrakai
Copy link
Contributor

LostKobrakai commented Oct 20, 2021

I've put the example project on github. It seems on linux (CI) I get the error @lawik was talking about:
https://github.com/LostKobrakai/nerves_repro
https://github.com/LostKobrakai/nerves_repro/runs/3948776011#step:7:130

@warmwaffles warmwaffles added the bug Something isn't working label Oct 20, 2021
@warmwaffles
Copy link
Member

I've cleaned up the make file some to have a more organized compilation output. But I still can not figure out why this is error. I'll look in to this more soon.

@RickCarlino
Copy link

Can confirm this is happening to us on a different Nerves project (RPi 3). Happy to provide extra info if needed, though the branch that uses exqlite is unstable at the moment.

@warmwaffles
Copy link
Member

warmwaffles commented Oct 20, 2021

I can not figure out what is up with generating the wrong ELF type. For release 0.7.6 I make the Makefile follow closely to what circuits_gpio does and I can't get it to work.

Compiling circuits_gpio

mkdir -p /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/priv
mkdir -p /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/obj
/home/warmwaffles/.nerves/artifacts/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-1.4.3/bin/armv6-nerves-linux-gnueabihf-gcc -c -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/erts-12.1.2/include -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/lib/erl_interface-5.1/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/include -DTARGET_RPI  -lbcm_host -fPIC -o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/obj/hal_sysfs.o src/hal_sysfs.c
/home/warmwaffles/.nerves/artifacts/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-1.4.3/bin/armv6-nerves-linux-gnueabihf-gcc -c -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/erts-12.1.2/include -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/lib/erl_interface-5.1/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/include -DTARGET_RPI  -lbcm_host -fPIC -o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/obj/hal_sysfs_interrupts.o src/hal_sysfs_interrupts.c
/home/warmwaffles/.nerves/artifacts/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-1.4.3/bin/armv6-nerves-linux-gnueabihf-gcc -c -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/erts-12.1.2/include -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/lib/erl_interface-5.1/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/include -DTARGET_RPI  -lbcm_host -fPIC -o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/obj/hal_rpi.o src/hal_rpi.c
/home/warmwaffles/.nerves/artifacts/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-1.4.3/bin/armv6-nerves-linux-gnueabihf-gcc -c -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/erts-12.1.2/include -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/lib/erl_interface-5.1/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/include -DTARGET_RPI  -lbcm_host -fPIC -o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/obj/nif_utils.o src/nif_utils.c
/home/warmwaffles/.nerves/artifacts/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-1.4.3/bin/armv6-nerves-linux-gnueabihf-gcc -c -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/erts-12.1.2/include -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/lib/erl_interface-5.1/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/include -DTARGET_RPI  -lbcm_host -fPIC -o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/obj/gpio_nif.o src/gpio_nif.c
/home/warmwaffles/.nerves/artifacts/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-1.4.3/bin/armv6-nerves-linux-gnueabihf-gcc -o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/priv/gpio_nif.so -L/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/erts-12.1.2/lib -L/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/lib/erl_interface-5.1/lib -lerts -lei --sysroot=/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging -fPIC -shared /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/obj/hal_sysfs.o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/obj/hal_sysfs_interrupts.o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/obj/hal_rpi.o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/obj/nif_utils.o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/circuits_gpio/obj/gpio_nif.o

Compiling exqlite

mkdir -p /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/exqlite/priv
mkdir -p /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/exqlite/obj
/home/warmwaffles/.nerves/artifacts/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-1.4.3/bin/armv6-nerves-linux-gnueabihf-gcc -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/include -I"/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/erts-12.1.2/include" -Ic_src -fPIC -fvisibility=hidden -DSQLITE_THREADSAFE=1 -DSQLITE_USE_URI=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 -DSQLITE_DQS=0 -DALLOW_COVERING_INDEX_SCAN=1 -DENABLE_FTS3_PARENTHESIS=1 -DENABLE_LOAD_EXTENSION=1 -DENABLE_SOUNDEX=1 -DENABLE_STAT4=1 -DENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1 -DSQLITE_ENABLE_RBU=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_OMIT_DEPRECATED=1 -DNDEBUG=1 -o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/exqlite/obj/sqlite3.o c_src/sqlite3.c
/home/warmwaffles/.nerves/artifacts/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-1.4.3/bin/armv6-nerves-linux-gnueabihf-gcc -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 -I/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/include -I"/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging/usr/lib/erlang/erts-12.1.2/include" -Ic_src -fPIC -fvisibility=hidden -DSQLITE_THREADSAFE=1 -DSQLITE_USE_URI=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 -DSQLITE_DQS=0 -DALLOW_COVERING_INDEX_SCAN=1 -DENABLE_FTS3_PARENTHESIS=1 -DENABLE_LOAD_EXTENSION=1 -DENABLE_SOUNDEX=1 -DENABLE_STAT4=1 -DENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1 -DSQLITE_ENABLE_RBU=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_OMIT_DEPRECATED=1 -DNDEBUG=1 -o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/exqlite/obj/sqlite3_nif.o c_src/sqlite3_nif.c
/home/warmwaffles/.nerves/artifacts/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-1.4.3/bin/armv6-nerves-linux-gnueabihf-gcc -o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/exqlite/priv/sqlite3_nif.so --sysroot=/home/warmwaffles/.nerves/artifacts/nerves_system_rpi-portable-1.17.1/staging -fPIC -shared /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/exqlite/obj/sqlite3.o /home/warmwaffles/src/github.com/ecto/nerves_repro/_build/rpi_dev/lib/exqlite/obj/sqlite3_nif.o

@warmwaffles
Copy link
Member

@RickCarlino I think we resolved it with this commit 57b872a

Was chatting with some other nerves people in the Elixir slack

jonjon: @ityonemo Also made a comment about this at NervesConf/ElixirConf as the warning being a thing with the host vs target process and was negligible. This is prob what he was talking about

jonjon: I’m going to guess because it does not autoload
jonjon: https://github.com/elixir-circuits/circuits_gpio/blob/main/lib/gpio/gpio_nif.ex#L3

So it's a known annoying thing. Looking at bcrypt_elixir it also does the same where autoload is disabled. So I think this will be fine.

@LostKobrakai
Copy link
Contributor

Warning is gone and running the fw built works as well. So seems to be solved from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants