在friendlyarm qtopia错误上编译

时间:2014-04-25 15:31:08

标签: c++ qt gcc makefile

尝试交叉编译程序一周后我放弃了,现在我试图直接在运行qtopia 2.2.0的friendlyarm上编译它,但是当我运行make时我得到了一些奇怪的错误。有人可以更多地发光并且可能指出我如何解决问题的正确方向?

make输出:

/sdcard/images/makef # make
make: Warning: File `Makefile' has modification time 2.2e+04 s in the future
gcc -c -o obj/main.o main.c -I./
gcc -c -o obj/serial.o serial.c -I./
gcc -c -o obj/fb.o fb.c -I./
gcc -c -o obj/menu_main.o menu_main.c -I./
gcc -c -o obj/timer.o timer.c -I./
gcc -c -o obj/cmdin.o cmdin.c -I./
cmdin.c: In function 'processcmd':
cmdin.c:64: warning: format '%f' expects type 'float *', but argument 4 has type 'int *'
gcc -c -o obj/buzzer.o buzzer.c -I./
gcc -c -o obj/statemachine.o statemachine.c -I./
gcc -c -o obj/inout.o inout.c -I./
gcc -c -o obj/network.o network.c -I./
gcc -c -o obj/text_file_input.o text_file_input.c -I./
gcc -c -o obj/text_file_input_oven.o text_file_input_oven.c -I./
gcc -o main obj/main.o obj/serial.o obj/fb.o obj/menu_main.o obj/timer.o obj/cmdin.o obj/buzzer.o obj/statemachine.o obj/inout.o obj/network.o obj/text_file_input.o obj/text_file_input_oven.o -I./ -lgd -lrt

/usr/bin/ld: skipping incompatible /usr/lib/gcc/arm-linux-gnueabi/4.4.1/librt.so when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib/gcc/arm-linux-gnueabi/4.4.1/librt.a when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib/gcc/arm-linux-gnueabi/4.4.1/librt.so when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib/gcc/arm-linux-gnueabi/4.4.1/librt.a when searching for -lrt
/usr/lib/gcc/arm-linux-gnueabi/4.4.1/../../../librt.a(timer_create.o): In function `timer_create':
timer_create.c:(.text+0xd4): undefined reference to `pthread_once'
/usr/lib/gcc/arm-linux-gnueabi/4.4.1/../../../librt.a(timer_routines.o): In function `timer_helper_thread':
timer_routines.c:(.text+0xfc): undefined reference to `pthread_create'
/usr/lib/gcc/arm-linux-gnueabi/4.4.1/../../../librt.a(timer_routines.o): In function `__start_helper_thread':
timer_routines.c:(.text+0x1a0): undefined reference to `pthread_attr_setstacksize'
timer_routines.c:(.text+0x1e4): undefined reference to `pthread_create'
timer_routines.c:(.text+0x228): undefined reference to `pthread_atfork'
collect2: ld returned 1 exit status
make: *** [main] Error 1
/sdcard/images/makef #  

如果这条消息我怎么能得到: make:警告:文件`Makefile'将来修改时间为2.2e + 04 s 我试过了

touch *.*

但这没有帮助

2 个答案:

答案 0 :(得分:1)

该消息通常表示您的某些文件的修改时间晚于当前系统时间。一种可能的解决方案是“触摸”源树中的每个文件以更新时间戳:转到子树的根,执行“find.-exec touch {} \;”

然后清理项目,删除所有构建文件并重试编译。

似乎你也忘了链接libpthread。你应该有posix库并将你的项目链接到libpthread。

答案 1 :(得分:1)

  

make:警告:文件`Makefile'修改时间为2.2e + 04 s   将来

您正在编译的系统上的时钟和生成文件的系统不同步。您应该解决这个问题(在另一个答案中提到了使用touch的解决方法,但如果"其他计算机运行错误的时间,这只是一个好主意 - 如果您正在编译的系统运行时间错误,那么你应该把时间安排在当前系统上 - 理想情况下使用ntp(网络时间协议)在启动时从网络源或类似设置两个系统上的时间 - 这样你就不会不得不担心它们会出现异相[PC系统时钟会在一个月内漂移1到30秒,具体取决于实际使用的硬件]。

  

/ usr / bin / ld:跳过不兼容   搜索-lrt时/usr/lib/gcc/arm-linux-gnueabi/4.4.1/librt.so

这些消息是无害的,只要系统能够找到一些与#34;兼容的librt,并且它似乎就是这样,因为我们得到了这个。

  

/usr/lib/gcc/arm-linux-gnueabi/4.4.1 /../../../ librt.a(timer_routines.o)

以下表示没有链接libpthread(在正确的位置)

  

timer_create.c :(。text + 0xd4):未定义引用`pthread_once'

您需要在-lpthread之后的链接器行上使用-lrt,因为librt正在使用pthread函数。请注意,库对顺序很敏感(有时你甚至需要给同一个库两次,因为存在循环依赖)