Build errors for membrane_rtc_engine deps when cross-compiling

I’m trying to put ex_nvr on Nerves. Saw someone else try that a while back. I think I get everything but the WebRTC parts of Membrane compiling.

I was building using this branch (to add media libraries): GitHub - lawik/nerves_system_rpi4 at membrane-media

This is the example app that doesn’t compile unless I comment out the rtc deps: GitHub - lawik/nerves_membrane_test

Since it’s a modified nerves_system_rpi4 the compile is fairly long. I’ll try to get a pre-compiled system in place for download but don’t have it now.

I get this, seems unhappy with the library but it does exist.


/home/lawik/projects/nerves_systems/o/rpi4/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-nerves-linux-gnu/13.2.0/../../../../aarch64-nerves-linux-gnu/bin/ld: skipping incompatible /home/lawik/projects/nerves_systems/o/rpi4/host/lib/erlang/usr/lib/libei.a when searching for -lei
/home/lawik/projects/nerves_systems/o/rpi4/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-nerves-linux-gnu/13.2.0/../../../../aarch64-nerves-linux-gnu/bin/ld: cannot find -lei: No such file or directory
collect2: error: ld returned 1 exit status
could not compile dependency :ex_dtls, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile ex_dtls --force", update it with "mix deps.update ex_dtls" or clean it with "mix deps.clean ex_dtls"
==> foobar2
** (Mix) Bundlex: Failed to build the native part of package ex_dtls. Errors may have been logged above.
Make sure that all required packages are properly installed in your system.
Requirements and installation guide may be found in the readme of package ex_dtls.

Returned code: 1
Build script:

(mkdir -p "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/nif/native_obj") && \
(/home/lawik/projects/nerves_systems/o/rpi4/host/bin/aarch64-nerves-linux-gnu-gcc -mabi=lp64 -fstack-protector-strong -mcpu=cortex-a72 -fPIE -pie -Wl,-z,now -Wl,-z,relro -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 --sysroot /home/lawik/projects/nerves_systems/o/rpi4/staging -fPIC -Wall -Wextra -c -O2 -g -std=c11 -DBUNDLEX_NIF -I/home/lawik/projects/nerves_systems/o/rpi4/staging/usr/include -o "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/nif/native_obj/native.c_5410E45890ABC219767E0EC3BED1CF28E3D95872.o" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch/nif" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex/nif" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/nif" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch/nif" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex/nif" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/nif" -I"/home/lawik/projects/nerves_systems/o/rpi4/host/lib/erlang/usr/include" -I"/home/lawik/projects/foobar2/deps/ex_dtls/c_src" "/home/lawik/projects/foobar2/deps/ex_dtls/c_src/ex_dtls/_generated/nif/native.c"
) && \
(/home/lawik/projects/nerves_systems/o/rpi4/host/bin/aarch64-nerves-linux-gnu-gcc -mabi=lp64 -fstack-protector-strong -mcpu=cortex-a72 -fPIE -pie -Wl,-z,now -Wl,-z,relro -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 --sysroot /home/lawik/projects/nerves_systems/o/rpi4/staging -fPIC -Wall -Wextra -c -O2 -g -std=c11 -DBUNDLEX_NIF -I/home/lawik/projects/nerves_systems/o/rpi4/staging/usr/include -o "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/nif/native_obj/native.c_EAA168AA822A21524D976C585CEB985228B6BF0A.o" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch/nif" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex/nif" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/nif" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch/nif" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex/nif" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/nif" -I"/home/lawik/projects/nerves_systems/o/rpi4/host/lib/erlang/usr/include" -I"/home/lawik/projects/foobar2/deps/ex_dtls/c_src" "/home/lawik/projects/foobar2/deps/ex_dtls/c_src/ex_dtls/native.c"
) && \
(/home/lawik/projects/nerves_systems/o/rpi4/host/bin/aarch64-nerves-linux-gnu-gcc -mabi=lp64 -fstack-protector-strong -mcpu=cortex-a72 -fPIE -pie -Wl,-z,now -Wl,-z,relro -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 --sysroot /home/lawik/projects/nerves_systems/o/rpi4/staging -fPIC -Wall -Wextra -c -O2 -g -std=c11 -DBUNDLEX_NIF -I/home/lawik/projects/nerves_systems/o/rpi4/staging/usr/include -o "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/nif/native_obj/dtls.c_0C08BCA4DB9D85E7538ADA3E550A8E27DBE99D32.o" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch/nif" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex/nif" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/nif" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch/nif" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex/nif" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/nif" -I"/home/lawik/projects/nerves_systems/o/rpi4/host/lib/erlang/usr/include" -I"/home/lawik/projects/foobar2/deps/ex_dtls/c_src" "/home/lawik/projects/foobar2/deps/ex_dtls/c_src/ex_dtls/dtls.c"
) && \
(/home/lawik/projects/nerves_systems/o/rpi4/host/bin/aarch64-nerves-linux-gnu-gcc -mabi=lp64 -fstack-protector-strong -mcpu=cortex-a72 -fPIE -pie -Wl,-z,now -Wl,-z,relro -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 --sysroot /home/lawik/projects/nerves_systems/o/rpi4/staging -fPIC -Wall -Wextra -c -O2 -g -std=c11 -DBUNDLEX_NIF -I/home/lawik/projects/nerves_systems/o/rpi4/staging/usr/include -o "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/nif/native_obj/dyn_buff.c_92302C7051765367C3E581FDA43F463A75950D80.o" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch/nif" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex/nif" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/nif" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch" -I"/home/lawik/projects/foobar2/deps/bunch_native/c_src/bunch/nif" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex" -I"/home/lawik/projects/foobar2/deps/shmex/c_src/shmex/nif" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/nif" -I"/home/lawik/projects/nerves_systems/o/rpi4/host/lib/erlang/usr/include" -I"/home/lawik/projects/foobar2/deps/ex_dtls/c_src" "/home/lawik/projects/foobar2/deps/ex_dtls/c_src/ex_dtls/dyn_buff.c"
) && \
(/home/lawik/projects/nerves_systems/o/rpi4/host/bin/aarch64-nerves-linux-gnu-gcc --sysroot=/home/lawik/projects/nerves_systems/o/rpi4/staging -rdynamic -shared -o "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/nif/native.so" -Wl,--disable-new-dtags,--whole-archive "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/bunch_native/priv/bundlex/lib.a" "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/shmex/priv/bundlex/lib.a" "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/bunch_native/priv/bundlex/nif/bunch.a" "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/shmex/priv/bundlex/nif/shmex.a" "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/unifex/priv/bundlex/nif/unifex.a" -Wl,--no-whole-archive "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/nif/native_obj/native.c_5410E45890ABC219767E0EC3BED1CF28E3D95872.o" "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/nif/native_obj/native.c_EAA168AA822A21524D976C585CEB985228B6BF0A.o" "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/nif/native_obj/dtls.c_0C08BCA4DB9D85E7538ADA3E550A8E27DBE99D32.o" "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/nif/native_obj/dyn_buff.c_92302C7051765367C3E581FDA43F463A75950D80.o"  -lrt -lrt -lpthread -L/home/lawik/projects/nerves_systems/o/rpi4/staging/usr/lib -lssl -lcrypto
) && \
(mkdir -p "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/cnode/native_obj") && \
(/home/lawik/projects/nerves_systems/o/rpi4/host/bin/aarch64-nerves-linux-gnu-gcc -mabi=lp64 -fstack-protector-strong -mcpu=cortex-a72 -fPIE -pie -Wl,-z,now -Wl,-z,relro -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 --sysroot /home/lawik/projects/nerves_systems/o/rpi4/staging -Wall -Wextra -c -O2 -g -std=c11 -DBUNDLEX_CNODE -I/home/lawik/projects/nerves_systems/o/rpi4/staging/usr/include -o "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/cnode/native_obj/native.c_E32A9D3FEA256B1A8DAED2737033FDB583FAE1B0.o" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/cnode" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/cnode" -I"/home/lawik/projects/nerves_systems/o/rpi4/host/lib/erlang/usr/include" -I"/home/lawik/projects/foobar2/deps/ex_dtls/c_src" "/home/lawik/projects/foobar2/deps/ex_dtls/c_src/ex_dtls/_generated/cnode/native.c"
) && \
(/home/lawik/projects/nerves_systems/o/rpi4/host/bin/aarch64-nerves-linux-gnu-gcc -mabi=lp64 -fstack-protector-strong -mcpu=cortex-a72 -fPIE -pie -Wl,-z,now -Wl,-z,relro -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 --sysroot /home/lawik/projects/nerves_systems/o/rpi4/staging -Wall -Wextra -c -O2 -g -std=c11 -DBUNDLEX_CNODE -I/home/lawik/projects/nerves_systems/o/rpi4/staging/usr/include -o "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/cnode/native_obj/native.c_EAA168AA822A21524D976C585CEB985228B6BF0A.o" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/cnode" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/cnode" -I"/home/lawik/projects/nerves_systems/o/rpi4/host/lib/erlang/usr/include" -I"/home/lawik/projects/foobar2/deps/ex_dtls/c_src" "/home/lawik/projects/foobar2/deps/ex_dtls/c_src/ex_dtls/native.c"
) && \
(/home/lawik/projects/nerves_systems/o/rpi4/host/bin/aarch64-nerves-linux-gnu-gcc -mabi=lp64 -fstack-protector-strong -mcpu=cortex-a72 -fPIE -pie -Wl,-z,now -Wl,-z,relro -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 --sysroot /home/lawik/projects/nerves_systems/o/rpi4/staging -Wall -Wextra -c -O2 -g -std=c11 -DBUNDLEX_CNODE -I/home/lawik/projects/nerves_systems/o/rpi4/staging/usr/include -o "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/cnode/native_obj/dtls.c_0C08BCA4DB9D85E7538ADA3E550A8E27DBE99D32.o" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/cnode" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/cnode" -I"/home/lawik/projects/nerves_systems/o/rpi4/host/lib/erlang/usr/include" -I"/home/lawik/projects/foobar2/deps/ex_dtls/c_src" "/home/lawik/projects/foobar2/deps/ex_dtls/c_src/ex_dtls/dtls.c"
) && \
(/home/lawik/projects/nerves_systems/o/rpi4/host/bin/aarch64-nerves-linux-gnu-gcc -mabi=lp64 -fstack-protector-strong -mcpu=cortex-a72 -fPIE -pie -Wl,-z,now -Wl,-z,relro -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -O2 --sysroot /home/lawik/projects/nerves_systems/o/rpi4/staging -Wall -Wextra -c -O2 -g -std=c11 -DBUNDLEX_CNODE -I/home/lawik/projects/nerves_systems/o/rpi4/staging/usr/include -o "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/cnode/native_obj/dyn_buff.c_92302C7051765367C3E581FDA43F463A75950D80.o" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/cnode" -I"/home/lawik/projects/foobar2/deps/unifex/c_src/unifex/cnode" -I"/home/lawik/projects/nerves_systems/o/rpi4/host/lib/erlang/usr/include" -I"/home/lawik/projects/foobar2/deps/ex_dtls/c_src" "/home/lawik/projects/foobar2/deps/ex_dtls/c_src/ex_dtls/dyn_buff.c"
) && \
(/home/lawik/projects/nerves_systems/o/rpi4/host/bin/aarch64-nerves-linux-gnu-gcc --sysroot=/home/lawik/projects/nerves_systems/o/rpi4/staging -o "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/cnode/native" -Wl,--disable-new-dtags,--whole-archive "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/unifex/priv/bundlex/cnode/unifex.a" -Wl,--no-whole-archive "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/cnode/native_obj/native.c_E32A9D3FEA256B1A8DAED2737033FDB583FAE1B0.o" "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/cnode/native_obj/native.c_EAA168AA822A21524D976C585CEB985228B6BF0A.o" "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/cnode/native_obj/dtls.c_0C08BCA4DB9D85E7538ADA3E550A8E27DBE99D32.o" "/home/lawik/projects/foobar2/_build/rpi4_dev/lib/ex_dtls/priv/bundlex/cnode/native_obj/dyn_buff.c_92302C7051765367C3E581FDA43F463A75950D80.o" -L"/home/lawik/projects/nerves_systems/o/rpi4/host/lib/erlang/usr/lib" -lpthread -lpthread -lpthread -lei -lpthread -L/home/lawik/projects/nerves_systems/o/rpi4/staging/usr/lib -lssl -lcrypto
)

Looks like a problem with arch incompatibility. E.g. you have libei for 64 bit systems and you try to compile on 32

1 Like

Okay, that makes some sense. I’m compiling for ARM and that’s an x86 file. But it seems like a problem somewhere that it would try that. I suppose the library might be needed in the system after all then.

There doesn’t seem to be a libei available in buildroot so I guess I’m stuck removing the RTC parts for now.

Unfortunately, I have no experience in cross-compilation and Nerves so I may not be able to help without deeper dive into the problem :frowning: