交叉工具鏈在編譯應用程序時,如何查找默認的頭文件路徑
默認的搜索路徑是通過在ubuntu-12.04的shell窗口輸入如下命令顯示:
echo ‘main(){}‘|arm-linux-gcc -E -v -
- 1
比如說我的路徑顯示則如下:
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/julian/lite-respin/linux/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion=‘Sourcery G++ Lite 2008q3-72‘ --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72)
COLLECT_GCC_OPTIONS=‘-march=armv4t‘ ‘-E‘ ‘-v‘
/usr/local/arm-4.3.2/4.3.2/bin/../libexec/gcc/arm-none-linux-gnueabi/4.3.2/cc1 -E -quiet -v -imultilib armv4t -iprefix /usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/ -isysroot /usr/local/arm-4.3.2/4.3.2/bin/../arm-none-linux-gnueabi/libc - -march=armv4t
ignoring nonexistent directory "/usr/local/arm-4.3.2/4.3.2/bin/../arm-none-linux-gnueabi/libc/usr/local/include"
ignoring duplicate directory "/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/../../lib/gcc/arm-none-linux-gnueabi/4.3.2/include"
ignoring duplicate directory "/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/../../lib/gcc/arm-none-linux-gnueabi/4.3.2/include-fixed"
ignoring duplicate directory "/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/../../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/include
/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/include-fixed
/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/include
/usr/local/arm-4.3.2/4.3.2/bin/../arm-none-linux-gnueabi/libc/usr/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
main(){}
COMPILER_PATH=/usr/local/arm-4.3.2/4.3.2/bin/../libexec/gcc/arm-none-linux-gnueabi/4.3.2/:/usr/local/arm-4.3.2/4.3.2/bin/../libexec/gcc/:/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/
LIBRARY_PATH=/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/armv4t/:/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/lib/armv4t/:/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/:/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/:/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/lib/:/usr/local/arm-4.3.2/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/:/usr/local/arm-4.3.2/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/usr/lib/
COLLECT_GCC_OPTIONS=‘-march=armv4t‘ ‘-E‘ ‘-v‘
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
其中的下面這一段就代表著arm-linux-gcc在編譯文件時所搜索的頭文件路徑:
#include "..." search starts here:
#include <...> search starts here:
/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/include
/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/include-fixed
/usr/local/arm-4.3.2/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/include
/usr/local/arm-4.3.2/4.3.2/bin/../arm-none-linux-gnueabi/libc/usr/include
庫文件搜索路徑:
LIBRARY_PATH=/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/armv4t/:/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/lib/armv4t/:/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/:/usr/local/arm/4.3.2/bin/../lib/gcc/:/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/lib/:/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/lib/:/usr/local/arm/4.3.2/bin/../arm-none-linux-gnueabi/libc/armv4t/usr/lib/
海思平臺的交叉工具鏈的搜索路徑
#include <...> search starts here:
/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../lib/gcc/arm-hisiv100-linux-uclibcgnueabi/4.4.1/include
/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../lib/gcc/arm-hisiv100-linux-uclibcgnueabi/4.4.1/include-fixed
/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../lib/gcc/arm-hisiv100-linux-uclibcgnueabi/4.4.1/../../../../arm-hisiv100-linux-uclibcgnueabi/include
/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../target/usr/include
庫文件搜索路徑
COMPILER_PATH=/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../libexec/gcc/arm-hisiv100-linux-uclibcgnueabi/4.4.1/:/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../libexec/gcc/:/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../lib/gcc/arm-hisiv100-linux-uclibcgnueabi/4.4.1/../../../../arm-hisiv100-linux-uclibcgnueabi/bin/
LIBRARY_PATH=/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../lib/gcc/arm-hisiv100-linux-uclibcgnueabi/4.4.1/:/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../lib/gcc/:/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../lib/gcc/arm-hisiv100-linux-uclibcgnueabi/4.4.1/../../../../arm-hisiv100-linux-uclibcgnueabi/lib/:/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../target/lib/:/opt/hisi-linux-nptl/arm-hisiv100-linux/bin/../target/usr/lib/
交叉工具鏈在編譯應用程序時,如何查找默認的頭文件路徑