|
编译linux下hello world应用程序通不过,怎么搞?
发表于 2015-3-11 19:35:25
浏览:13941
|
回复:6
打印
只看该作者
[复制链接]
楼主
编译环境已经打好了,内核kernel和initrd都能编译出来。
后来想试试写个hello world编译下,放到板子上跑,却发现居然编译都有问题了。
我是用的cmake,生成的makefile,反复查过,是没有问题的。
下面这个是用的4.7的,说找不到cdefs.h,我find了也确实是没有的。
lr@ubuntu:~/RK3288/codes/hello/build$ make
Scanning dependencies of target hello_exe
[100%] Building C object CMakeFiles/hello_exe.dir/hello.c.o
In file included from /home/lr/RK3288/codes/hello/hello.c:3:0:
/home/lr/RK3288/SDK/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/../lib/gcc/arm-eabi/4.7/include-fixed/stdio.h:50:23: fatal error: sys/cdefs.h: No such file or directory
compilation terminated.
CMakeFiles/hello_exe.dir/build.make:54: recipe for target 'CMakeFiles/hello_exe.dir/hello.c.o' failed
make[2]: *** [CMakeFiles/hello_exe.dir/hello.c.o] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/hello_exe.dir/all' failed
make[1]: *** [CMakeFiles/hello_exe.dir/all] Error 2
Makefile:72: recipe for target 'all' failed
make: *** [all] Error 2
下面是4.6的,说找不到stdio.h
lr@ubuntu:~/RK3288/codes/hello/build$ make
Scanning dependencies of target hello_exe
[100%] Building C object CMakeFiles/hello_exe.dir/hello.c.o
/home/lr/RK3288/codes/hello/hello.c:3:19: fatal error: stdio.h: No such file or directory
compilation terminated.
CMakeFiles/hello_exe.dir/build.make:54: recipe for target 'CMakeFiles/hello_exe.dir/hello.c.o' failed
make[2]: *** [CMakeFiles/hello_exe.dir/hello.c.o] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/hello_exe.dir/all' failed
make[1]: *** [CMakeFiles/hello_exe.dir/all] Error 2
Makefile:72: recipe for target 'all' failed
make: *** [all] Error 2
内核那些代码可以编译通过,那说明编译环境是没问题的,不知道为什么这么简单的hello world编译通不过。
|
|