1
votes

i'm working on a cross compile for armhf,compile process just goes well,but the GLIBC version is old ,./libc.so.6 shows it was compiled by gcc 4.6.3,unfortunately i can't find this old version on apt-get.so i 've tried to relocate the lib path by using follow LDFLAG option.

-Wl,-rpath,/boxer/lib -Wl,--dynamic-linker,/boxer/lib/ld-linux-armhf.so.3

and deployed the corresponding library to /boxer/lib,but the problem not solve,and ./ld-linux-armhf.so.3 --list shows that the ld was linked to correct place,but,as u can see below, the rest not.

root@cubieboard2:/lib/arm-linux-gnueabihf# ./ld-linux-armhf.so.3 --list /boxer/frida-server
/boxer/frida-server: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.17' not found (required by /boxer/frida-server)
        libresolv.so.2 => /lib/arm-linux-gnueabihf/libresolv.so.2 (0xb6f7a000)
        libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6f6e000)
        libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6f53000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6e6f000)
        /boxer/lib/ld-linux-armhf.so.3 => ./ld-linux-armhf.so.3 (0xb6f9e000)

any suggestion?thanks.

Update:

Here is the LD_TRACE_LOADED_OBJECTS=1 option result,seem like the same as above

root@cubieboard2:/boxer# LD_TRACE_LOADED_OBJECTS=1 /boxer/frida-server
/boxer/frida-server: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.17' not found (required by /boxer/frida-server)
        libresolv.so.2 => /lib/arm-linux-gnueabihf/libresolv.so.2 (0xb6f10000)
        libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6f05000)
        libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6eea000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6e06000)
        /boxer/lib/ld-linux-armhf.so.3 (0xb6f28000)
root@cubieboard2:/boxer#

the ld-linux has the right place to go,but the others still on the old way...

Here is another program that i compiled earlier using QT,with the rpath LDFLAG:

QMAKE_LFLAGS +=-Wl,-rpath,/boxer/lib -Wl,--dynamic-linker,/boxer/lib/ld-linux.so.3

yes i was follow your answer and it works fine(Thanks,big help :-) ),LD_TRACE_LOADED_OBJECTS=1 result:

# LD_TRACE_LOADED_OBJECTS=1 /boxer/Boxer
        libdl.so.2 => /boxer/lib/libdl.so.2 (0xb6efb000)
        libQt5Widgets.so.5 => /boxer/lib/libQt5Widgets.so.5 (0xb69b9000)
        libQt5Gui.so.5 => /boxer/lib/libQt5Gui.so.5 (0xb655f000)
        libQt5Network.so.5 => /boxer/lib/libQt5Network.so.5 (0xb646f000)
        libQt5Core.so.5 => /boxer/lib/libQt5Core.so.5 (0xb5f50000)
        libpthread.so.0 => /boxer/lib/libpthread.so.0 (0xb5f27000)
        libstdc++.so.6 => /boxer/lib/libstdc++.so.6 (0xb5ddc000)
        libm.so.6 => /boxer/lib/libm.so.6 (0xb5d2a000)
        libgcc_s.so.1 => /boxer/lib/libgcc_s.so.1 (0xb5cfa000)
        libc.so.6 => /boxer/lib/libc.so.6 (0xb5bb5000)
        /boxer/lib/ld-linux.so.3 (0xb6f0e000)
        librt.so.1 => /boxer/lib/librt.so.1 (0xb5b9e000)

we can see everything goes well include the libc,what's the different?

1

1 Answers

0
votes

GLIBC version is old ,./libc.so.6 shows it was compiled by gcc 4.6.3, unfortunately i can't find this old version on apt-get.

Note that the version of GLIBC has very little to do with the version of GCC it was compiled with. Newer versions of GLIBC do require newer version of GCC to build them, but the relationship is far from one-to-one.

deployed the corresponding library to /boxer/lib,but the problem not solve,and ./ld-linux-armhf.so.3 --list shows that the ld was linked to correct place,but,as u can see below, the rest not.

You'll need to build GLIBC with --prefix=/boxer for ld-linux to look in alternate location. See also this answer.

Update:

I misinterpreted your question. This command:

./ld-linux-armhf.so.3 --list /boxer/frida-server

does not tell you what you want to know (which libraries would be loaded at runtime), because it doesn't pay attention to the RPATH compiled into the application (it only uses paths compiled into ld-linux itself).

Instead, you want:

LD_TRACE_LOADED_OBJECTS=1 /boxer/frida-server

which shows what libraries would actually be loaded.