jeudi 19 avril 2018

How to install libm.so.6 on a rootfs built for arm target with buildroot?

I have written a test c++ program for running an ARM target. I am using Linaro gcc-linaro-arm-linux-gnueabihf-4.8-2013.07-1 cross compiler on Windows in eclipse IDE to compile the hello world program. The below is the compile options used by eclipse:

14:28:26 **** Incremental Build of configuration Debug for project test ****
make all 
Building file: ../main.cpp
Invoking: Cross G++ Compiler
arm-linux-gnueabihf-g++ -O0 -g1 -Wall -c -fmessage-length=0 -std=c++11 -MMD -MP -MF"main.d" -MT"main.o" -o "main.o" "../main.cpp"
Finished building: ../main.cpp

Building target: test
Invoking: Cross G++ Linker
arm-linux-gnueabihf-g++  -o "test"  ./main.o   
Finished building target: test


14:28:27 Build Finished (took 848ms)

Now when I try to run the program in a arm target it just doesn't do anything, i.e. simply returns to the linux prompt without any output. I did a ldd on the binary it shows that there are dynamic libraries (libm.so.6 and libc.so.6) missing on the target linux machine. I double checked the buildroot directory it doesn't exists there. The below is the output from the ldd command:

# ldd test-prog
checking sub-depends for '/lib/libpthread.so.0'
        libc.so.0 => /lib//libc.so.0 (0x4000e000)
        ld-uClibc.so.0 => /lib//ld-uClibc.so.0 (0x40000000)
checking sub-depends for '/usr/lib/libstdc++.so.6'
checking sub-depends for 'not found'
checking sub-depends for '/lib/libgcc_s.so.1'
checking sub-depends for 'not found'
checking sub-depends for '/lib//libm.so.0'
        libc.so.0 => /lib//libc.so.0 (0x4000e000)
        ld-uClibc.so.0 => /lib//ld-uClibc.so.0 (0x40000000)
checking sub-depends for '/lib//libc.so.0'
        ld-uClibc.so.0 => /lib//ld-uClibc.so.0 (0x40000000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00000000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00000000)
        libm.so.6 => not found (0x00000000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00000000)
        libc.so.6 => not found (0x00000000)
        libm.so.0 => /lib//libm.so.0 (0x00000000)
        libc.so.0 => /lib//libc.so.0 (0x00000000)
        /lib//ld-uClibc.so.0 => /lib//ld-uClibc.so.0 (0x00000000)

If I use an older version of the g++ compiler (arm-linux-g++ -v => gcc version 4.3.5) the binary runs fine on the target. But I need the higher version of the compiler because 4.3.5 doesn't support c++11. Can you please suggest how to install the libm.so.6 and libc.so.6. The buildroot I am using is buildroot-2010.08. I don't think changing the buildroot would be an option as the customer would not agree with that. Need to fit the library in the buildroot-2010.08. Any idea please share.

Aucun commentaire:

Enregistrer un commentaire