cross-compiling linker error: libarmnn.so: unexpected reloc type 0x03
Hi, I am cross-compiling armnn for the beaglebone black (ARM Cortex-A8) using the arm-linux-gnueabihf-g++ packages from Debian. I managed to get the compile working without errors on the host machine, but when I attempt to run the UnitTests on the target as below, I get the following error:
debian@beaglebone ~/armnn % LD_LIBRARY_PATH=. ./UnitTests
./UnitTests: error while loading shared libraries: ./libarmnn.so: unexpected reloc type 0x03
I am generated the makefiles for armnn using the following:
~/Downloads/compiled_protobuf/lib % cmake -DARMCOMPUTE_ROOT=/home/curt/ComputeLibrary -DARMCOMPUTE_BUILD_DIR=/home/curt/ComputeLibrary/build -DBOOST_ROOT=/home/curt/Downloads/compiled_boost -DTF_GENERATED_SOURCES=/home/curt/Downloads/tensorflow/ -DBUILD_TF_PARSER=1 -DARMCOMPUTENEON=1 -DPROTOBUF_ROOT=/home/curt/Downloads/compiled_protobuf ..
Then I ran make as usual. I've looked for a while and it looks like the relocation being complained about is static relocation error R_ARM_REL32, but I can't figure out where something was linked statically but something else was dynamically linked.
The tests for the ARM Compute Library compile and run successfully on the target, if that helps narrow it down. Is there anything else I could try adding to the GlobalConfig.cmake file to help? Thanks!
Hi @curtywang,
Make sure you compile armnn with -fPIC. You should have CXXFLAGS="-fPIE -fPIC" in your cmake command line:
CXX_FLAGS="-fPIE -fPIC" \
cmake .. \
-DARMCOMPUTE_ROOT=<your path to the Compute Library> \
etc.
Hi @curtywang,
I hope you've managed to resolve your problem. Please open a new one if you are still having problems.
Thanks, Surabhi
Hi @curtywang,
Make sure you compile armnn with -fPIC. You should have CXXFLAGS="-fPIE -fPIC" in your cmake command line:
CXX_FLAGS="-fPIE -fPIC" \ cmake .. \ -DARMCOMPUTE_ROOT=<your path to the Compute Library> \ etc.
I tried to replicate this on my ARM Cortex A9 with the same compiler mentioned by @curtywang and debian 9. It does not work and gives the same error.