c++ - 在 friendlyarm qtopia 错误上编译

标签 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 #  

此外,如果出现此消息,我该如何获取: ma​​ke: Warning: 文件 `Makefile' 的修改时间为 2.2e+04 s 在未来 我试过了

touch *.*

但这并没有帮助

最佳答案

make: Warning: File `Makefile' has modification time 2.2e+04 s in the future

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

/usr/bin/ld: skipping incompatible /usr/lib/gcc/arm-linux-gnueabi/4.4.1/librt.so when searching for -lrt

只要系统能够找到一些“兼容”的 librt,这些消息就是无害的,而且看起来确实如此,因为我们得到了这个。

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

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

timer_create.c:(.text+0xd4): undefined reference to `pthread_once'

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

关于c++ - 在 friendlyarm qtopia 错误上编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23297283/

相关文章:

c++ - 类和结构的内部存储

c++ - 如何获得两个数字字符串的总和 - C++

c++ - 单击按钮显示另一个 ui 文件

c++ - 使用 QFile().setPermissions() 设置读写权限

c - 编译时出错 - 初始化程序中指定的未知字段

c++ - 当函数需要对父指针的引用时,不能将子类指针传递给函数,为什么?

python - 如何使用 SWIG 让 python 切片与我的 c++ 数组类一起工作

c++ - 将动态数组分配作为函数尝试时出现运行时错误

c++ - 最佳虚拟机/字节码解释器循环

c++ - 如何在 Windows 上从命令行使用 MinGW 编译器?