我正在尝试交叉预链接一个简单的 hello world 程序。我使用交叉编译工具链arm-2012.03-57-arm-none-linux-gnueabi-i686-pc-linux-gnu,我不确定我是否使用了 prelink-cross 选项正确。如果有人能指出我正确的方向,我会很高兴。有关github上的源代码的更多详细信息。谢谢你。
项目目录树
|-arm-2012.03/
|...
|-src/
|-main.cpp
|-bin/
|-hello
|-prelink_arm.conf
主文件
#include <stdio.h>
int main (int argc, char *argv[])
{
fprintf(stdout, "hello world\n");
return 0;
}
prelink_arm.conf
-l arm-2012.03/arm-none-linux-gnueabi/libc/lib
-h arm-2012.03/arm-none-linux-gnueabi/libc/lib
-l arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib
-h arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib
编译
arm-2012.03/bin/arm-none-linux-gnueabi-gcc -Wall -o bin_arm/hello src/main.cpp
预链接
PATH=/usr/local/sbin prelink --verbose --cache-file=cache/prelink_arm.cache --config-file=prelink_arm.conf --ld-library-path="arm-2012.03/arm-none-linux-gnueabi/libc/lib;arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib;" -h bin_arm/hello
错误信息
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/getent: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/POSIX_V6_ILP32_OFFBIG: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/iconv: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/sprof: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/iconvconfig: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/POSIX_V7_ILP32_OFF32: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/zdump: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/pcprofiledump: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/gencat: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/gdbserver: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/pldd: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/locale: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/localedef: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/XBS5_ILP32_OFFBIG: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/zic: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/POSIX_V7_ILP32_OFFBIG: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/rpcgen: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/makedb: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/getconf: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/XBS5_ILP32_OFF32: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib/bin/POSIX_V6_ILP32_OFF32: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
prelink: bin_arm/hello: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'
如果我将可执行文件所依赖的所有库提取到一个单独的文件夹中并相应地设置链接,那么我仍然会收到以下错误:
prelink: bin_arm/hello: Could not parse `/usr/local/sbin//prelink-rtld: error while loading shared libraries: ld-linux.so.3'