Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
313 views
in Technique[技术] by (71.8m points)

linux - Can't access Buildroot staging libraries via ./configure when cross compiling. It fails on test compile.

CASE 1 arm-linux-gcc -v hello.c ==> WORKS

CASE 2
arm-linux-gcc -v -L/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/staging/usr/lib hello.c ==> DOESN'T WORK ERROR:ld.bfd: cannot find /usr/lib/libc_nonshared.a ERROR:ld.bfd: cannot find /lib/ld-linux.so.3

CASE 3 arm-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

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/

/arm-linux and Buildroot libraries seem identical. The cross-tool was used to build Buildroot.

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.

Note: I am using (crosstool-NG 1.21.0) 5.1.0.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...