交叉编译过程出现的问题

编译:
mipsel-openwrt-linux-gcc serw.c uart.c -o serw

报错:
likex@ubuntu:~/shuichan$ ./build.sh
mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
In file included from /usr/include/x86_64-linux-gnu/sys/select.h:30:0,
                 from /usr/include/x86_64-linux-gnu/sys/types.h:219,
                 from /home/likex/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include/stdlib.h:209,
                 from uart.c:30:
uart.c: In function 'UART_Recv':
uart.c:200:5: error: inconsistent operand constraints in an 'asm'
     FD_ZERO(&fs_read);
     ^

这里,In file included from /usr/include/x86_64-linux-gnu/sys/select.h:30:0, select.h引用的是系统本身的?
 
修改为
mipsel-openwrt-linux-gcc serw.c uart.c  -o serw -I~/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include/
报错信息和上面的一样
 
网上搜索一番,使用命令如下查看内定头文件搜索路径:
echo 'main(){}'|mipsel-openwrt-linux-gcc -E -v -

摘取如下:
#include "..." search starts here:
#include <...> search starts here:
[b]/usr/include/x86_64-linux-gnu
[/b] /home/likex/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/include
/home/likex/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/include-fixed
/home/likex/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/sys-include
/home/likex/OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/include
/usr/include
End of search list.

注意加粗部分 /usr/include/x86_64-linux-gnu ,如何去除它?
请问,现在我该如何修改交叉编译时的头文件搜索路径,使编译顺利通过,谢谢
已邀请:

xzmu - 10w

赞同来自: 大茶园丁

STAGING_DIR 这个目录指定一下,在openwrt的sdk的staging_dir目录,还有注意你的环境变量

要回复问题请先登录注册