当前位置: 技术问答>linux和unix
100分请教高手一个make -I的小问题
来源: 互联网 发布时间:2016-08-06
本文导语: 在用make -I命令如下: root@eclair:~/software/busybox-1.16.0# make -I /usr/local/arm/4.3.1-eabi-armv6/usr/include/ CC applets/applets.o In file included from include/libbb.h:13, from include/busybox.h:10, ...
在用make -I命令如下:
root@eclair:~/software/busybox-1.16.0# make -I /usr/local/arm/4.3.1-eabi-armv6/usr/include/
CC applets/applets.o
In file included from include/libbb.h:13,
from include/busybox.h:10,
from applets/applets.c:11:
include/platform.h:157: fatal error: byteswap.h: No such file or directory
compilation terminated.
make[1]: *** [applets/applets.o] 错误 1
make: *** [applets_dir] 错误 2
提示出错,但文件是存在的,如下:
root@eclair:~/software/busybox-1.16.0# ls /usr/local/arm/4.3.1-eabi-armv6/usr/include/byteswap.h -l
-rw-r--r-- 1 500 500 1489 2008-07-07 15:53 /usr/local/arm/4.3.1-eabi-armv6/usr/include/byteswap.h
root@eclair:~/software/busybox-1.16.0#
请高手指点
root@eclair:~/software/busybox-1.16.0# make -I /usr/local/arm/4.3.1-eabi-armv6/usr/include/
CC applets/applets.o
In file included from include/libbb.h:13,
from include/busybox.h:10,
from applets/applets.c:11:
include/platform.h:157: fatal error: byteswap.h: No such file or directory
compilation terminated.
make[1]: *** [applets/applets.o] 错误 1
make: *** [applets_dir] 错误 2
提示出错,但文件是存在的,如下:
root@eclair:~/software/busybox-1.16.0# ls /usr/local/arm/4.3.1-eabi-armv6/usr/include/byteswap.h -l
-rw-r--r-- 1 500 500 1489 2008-07-07 15:53 /usr/local/arm/4.3.1-eabi-armv6/usr/include/byteswap.h
root@eclair:~/software/busybox-1.16.0#
请高手指点
|
两个-I意思不一样吧,gcc的-I是用来搜索头文件的。make的-I是用来搜索Makefile文件的。
Specifies a directory dir to search for included makefiles. If several -I options are used to specify several directories, the
directories are searched in the order specified. Unlike the arguments to other flags of make, directories given with -I flags
may come directly after the flag: -Idir is allowed, as well as -I dir. This syntax is allowed for compatibility with the C pre-
processor’s -I flag.
Specifies a directory dir to search for included makefiles. If several -I options are used to specify several directories, the
directories are searched in the order specified. Unlike the arguments to other flags of make, directories given with -I flags
may come directly after the flag: -Idir is allowed, as well as -I dir. This syntax is allowed for compatibility with the C pre-
processor’s -I flag.
|
很明显-I /usr/local/arm/4.3.1-eabi-armv6/usr/include/ 这句应该写到makefile文件中
CFLAGS += -I /usr/local/arm/4.3.1-eabi-armv6/usr/include/
gcc $(CFLAGS) ........
CFLAGS += -I /usr/local/arm/4.3.1-eabi-armv6/usr/include/
gcc $(CFLAGS) ........
|
-I那个目录,还是找不到。。
你是不是root?
|
没怎么用过-I选项,但从解释上看应该只是增加了一个搜索路径,可能你编译时在其他的路径有同样的platform.h,所以那个文件已经被引用了。
最好还是看看busybox里面关于kernel src的路径描述,比如TOPDIR之类的,直接修改makefile指向你的内核srctree比较好。
最好还是看看busybox里面关于kernel src的路径描述,比如TOPDIR之类的,直接修改makefile指向你的内核srctree比较好。