0

I cross-compiled ARMNN for my ARM Cortex-A9 (Debian 9) device on my host system which is x86_64 (Ubuntu 18.04).

I have successfully built ARMNN and all it's dependencies without any errors, but when I try to run the sample mnist on Cortex-A9, it gives the following error:

duu@34d456-45433g:~/ML-examples/armnn-mnist$ make test
arm-linux-gnueabihf-g++ -O3 -std=c++14 -I/home/duu/armnn/armnn/include mnist_caffe.cpp -o mnist_caffe -L/home/duu/build -larmnn -larmnnCaffeParser
/home/admin/build/libarmnn.so: undefined reference to `exp2f@GLIBC_2.27'
/home/admin/build/libarmnn.so: undefined reference to `logf@GLIBC_2.27'
/home/admin/build/libarmnn.so: undefined reference to `log2f@GLIBC_2.27'
/home/admin/build/libarmnn.so: undefined reference to `powf@GLIBC_2.27'
/home/admin/build/libarmnn.so: undefined reference to `expf@GLIBC_2.27'
collect2: error: ld returned 1 exit status
Makefile:12: recipe for target 'mnist_caffe' failed
make: *** [mnist_caffe] Error 1

I figured later that the device should have the same compiler and same GLIBC package, both with same versions as the host on which the library was compiled.

I compiled ARMNN using gcc-6.4.0 and glibc-2.27 on the host and I have gcc-6.3.0 and glibc-2.24 on Cortex-A9 device.

I managed to match the GCC versions and solve the compiler error but I am not able to find matching versions of GLIBC on Ubuntu 18.04 and debian 9.

Is there any way to install a GLIBC version on either of the systems which is common for both of them?

P.S. : Any other method to solve this issue is highly appreciated.

Nukul Khadse
  • 108
  • 7

1 Answers1

0

Here is a list of the possible options I can think of right now:

  1. run your application while having LD_LIBRARY_PATH pointing to a directory containing the arm glibc dynamic libraries(v2.27) copied from your x86_64 system - see this post.
  2. Re-compile your application on your target system, if possible, if your target system can use NFS for example,
  3. cross-compile a static version of your library/application, linking it using -static -static-libgcc -static-libstdc++ - see this post.
  4. use arm-linux-musleabihf-cross or one of his friends for cross-compiling a static version of your library/application if this did not work with gcc/g++ and glibc.
  5. run your application in a chrooted environment containing the arm dynamic libraries you linked your application with on the x86_64 system - see this post for more details,
  6. install docker on your Cortex-A9 system, and build a minimal debian/ubuntu docker image that contain a version of debian/ubuntu using glibc 2.27, along with your library and application, and execute the application in a container.
Frant
  • 5,382
  • 1
  • 16
  • 22
  • The final option worked for me. But I hoped for any other solution to work as it's not an optmized solution. I am already working on a resource constrained embedded device and using a docker container on top of it adds overhead to it. Nevertheless, thank you very much for your help. – Nukul Khadse Mar 11 '20 at 13:22
  • In the case your application is not using NAT, it seems its performances while running in a container will be more or less the same - see [here](https://stackoverflow.com/questions/21889053/what-is-the-runtime-performance-cost-of-a-docker-container). Did you try any other of the solutions above? thanks. – Frant Mar 11 '20 at 14:48
  • There is an update. I am able to run my application on my target device. I copied the glibc-2.24 from my target to host along with some of it's other dependencies and compiled the framework. It works. – Nukul Khadse Mar 13 '20 at 12:18