set global gcc default search paths

前端 未结 2 1494
一个人的身影
一个人的身影 2021-02-02 00:37

when running

arm-none-linux-gnueabi-gcc -print-search-dirs | grep libraries | sed \'s/:/\\n/g\'

I get the following output:

li         


        
2条回答
  •  情书的邮戳
    2021-02-02 01:12

    Your cross-compiling glibc is configured in a wrong way.

    In -Wl,-verbose linker says:

    attempt to open /usr/arm-unknown-linux-gnueabi/usr/lib/libc.so succeeded
    opened script file /usr/arm-unknown-linux-gnueabi/usr/lib/libc.so
    

    So, it used your -L option and was able to open libc.so. But this is not a real .so dynamic library, it is a script (linker script).

    Telepathic mode on: Last line of this libc.so script is

     GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a  AS_NEEDED ( /lib/ld-linux.so.3 ) )
    

    Telepathic mode off

    This line contains absolute pathes hardcoded and redirects linker from arm-...abi to the system's libc ignoring most of search-dirs (may be there is some secret option of ld).

    Just edit this file (with doing a backup) with any text editor and replace all /lib with /usr/arm-unknown-linux-gnueabi/lib. (My good cross-compiler environment has all pathes in this script replaced with prefix.)

    The original script should be used on native compile, native run, but not on cross compiling.

    UPDATE: bytesex says http://linux.bytesex.org/cross-compiler.html that there is the same problem with /usr/lib/libpthread.so, do the replace in this file too.

    To check other libs, do file -skL *.so|grep text in the lib dir.

提交回复
热议问题