问题描述
案例 1arm-linux-gcc -v hello.c ==> WORKS
CASE 1arm-linux-gcc -v hello.c ==> WORKS
案例 2
arm-linux-gcc -v -L/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/staging/usr/lib hello.c ==> 不起作用错误:ld.bfd:找不到/usr/lib/libc_nonshared.a错误:ld.bfd:找不到/lib/ld-linux.so.3
CASE 2
arm-linux-gcc -v -L/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/staging/usr/lib hello.c ==> DOESN'T WORKERROR:ld.bfd: cannot find /usr/lib/libc_nonshared.aERROR:ld.bfd: cannot find /lib/ld-linux.so.3
案例 3arm-linux-gcc -v --sysroot=/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/hello.c ==>WORKS但说它忽略了 sysroot,因为它找不到/usr/include 所以就像 case#1 请注意,buildroot-staging 符号链接到 buildroot-sysroot
CASE 3arm-linux-gcc -v --sysroot=/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/ hello.c ==>WORKS but says it is ignoring sysroot because it cannot find /usr/include so is like case#1 Note that buildroot-staging symlinks to buildroot-sysroot
相应的 libc 库位于:
/usr/local/xtools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot/usr/lib/:/usr/local/xtools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot/lib/
The respective libc libraries are in:
/usr/local/xtools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot/usr/lib/:/usr/local/xtools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot/lib/
/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/usr/lib:/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/lib/
/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/usr/lib:/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/lib/
/arm-linux 和 Buildroot 库看起来相同.交叉工具用于构建 Buildroot.
/arm-linux and Buildroot libraries seem identical. The cross-tool was used to build Buildroot.
问题是:当我链接到 Buildroot 暂存库时,为什么 arm-linux-gcc 会失败.出现这个问题是因为 auto-tools ./configure 失败并带有 -L 到 Buildroot.但是我需要 -L 来访问 Buildroot 中的 libSDL2、libfreetype 等,以便交叉编译 SDL2_ttf.
The question is: why does arm-linux-gcc fail when I link to Buildroot staging libaries. This question arose because auto-tools ./configure fails with a -L to Buildroot. But I need the -L to access libSDL2, libfreetype etc in Buildroot in order to cross-compile SDL2_ttf.
注意:我使用的是 (crosstool-NG 1.21.0) 5.1.0.
Note: I am using (crosstool-NG 1.21.0) 5.1.0.
推荐答案
不要做任何你正在做的事情.Buildroot 交叉编译器配置为自动搜索 $(STAGING_DIR)/usr/lib 中的库和 $(STAGING_DIR)/usr/include 中的头文件.您所描述的任何技巧都不是必需的.
Just don't do any of the things you are doing. The Buildroot cross-compiler is configured to automatically search for libraries in $(STAGING_DIR)/usr/lib and headers in $(STAGING_DIR)/usr/include. None of the hacks you are describing are needed.
这篇关于交叉编译时无法通过 ./configure 访问 Buildroot 临时库.它在测试编译时失败.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!