使用大型嵌入式Linux代码库/ SDK" 未在此发明" - 由Elbonian Code Slaves在海外发明的各种东西。
部分代码库是Live555 WIS-Streamer。为了(尝试)修复与时间戳有关的问题,我已经插入了几个对clock_gettime(CLOCK_MONOTONIC, &ts);
的调用,然后导致编译失败并出现几个undefined reference to 'clock_gettime'
错误。
之前我已经有了这个,并且通过将-lrt
添加到编译器选项以包含librealtime
来解决它,但是这一次它只是没有帮助。我已经完成了大量的谷歌搜索和阅读,但我无法看到任何明确的答案,项目的makefile比网络上的例子要复杂得多。
我需要一些帮助,或者指出我在makefile中做出的明显错误,或者通过链条追溯编译器的期望,看看我需要做出哪些改变
这个项目是使用给定硬件的一组库进行交叉编译的,因此仍然需要-lrt
(我在以后的gcc库中看不到它),我们可以' t很容易更新或改变这些东西。
这是一个失败的编译器输出片段,冗长很多。我缩短了路径名,只是为了保持低于帖子大小限制。
make[10]: Entering directory `/ipnc_rdk/ipnc_app/network/live/testProgs'
/ipnc_rdk/../dvsdk_ipnctools/linux-devkit//bin/arm-arago-linux-gnueabi-g++ -c -I../UsageEnvironment/include -I../groupsock/include -I../liveMedia/include -I../BasicUsageEnvironment/include -I. -O3 -v -DSOCKLEN_T=socklen_t -DNO_STRSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wl,--verbose -lrt -Wall -DBSD=1 testMP3Streamer.cpp
Using built-in specs.
Target: arm-arago-linux-gnueabi
Thread model: posix
gcc version 4.3.3 (GCC)
COLLECT_GCC_OPTIONS='-c' '-I../UsageEnvironment/include' '-I../groupsock/include' '-I../liveMedia/include' '-I../BasicUsageEnvironment/include' '-I.' '-O3' '-v' '-DSOCKLEN_T=socklen_t' '-DNO_STRSTREAM=1' '-D_LARGEFILE_SOURCE=1' '-D_FILE_OFFSET_BITS=64' '-Wall' '-DBSD=1' '-shared-libgcc' '-mfloat-abi=soft'
../libexec/gcc/arm-arago-linux-gnueabi/4.3.3/cc1plus -quiet -v -I../UsageEnvironment/include -I../groupsock/include -I../liveMedia/include -I../BasicUsageEnvironment/include -I. -iprefix ../lib/gcc/arm-arago-linux-gnueabi/4.3.3/ -isysroot ../arm-arago-linux-gnueabi -D_GNU_SOURCE -DSOCKLEN_T=socklen_t -DNO_STRSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DBSD=1 testMP3Streamer.cpp -quiet -dumpbase testMP3Streamer.cpp -mfloat-abi=soft -auxbase testMP3Streamer -O3 -Wall -version -o /tmp/cckqq421.s
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3"
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3/arm-arago-linux-gnueabi"
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3/backward"
ignoring nonexistent directory "../arm-arago-linux-gnueabi/usr/local/include"
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/include"
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/include-fixed"
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include"
#include "..." search starts here:
#include <...> search starts here:
../UsageEnvironment/include
../groupsock/include
../liveMedia/include
../BasicUsageEnvironment/include
.
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3/arm-arago-linux-gnueabi
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3/backward
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/include
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/include-fixed
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include
../arm-arago-linux-gnueabi/usr/include
End of search list.
GNU C++ (GCC) version 4.3.3 (arm-arago-linux-gnueabi)
compiled by GNU C version 4.4.3, GMP version 4.2.4, MPFR version 3.0.0-p7.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 05177eff49440274f3899a250a52b5a7
COLLECT_GCC_OPTIONS='-c' '-I../UsageEnvironment/include' '-I../groupsock/include' '-I../liveMedia/include' '-I../BasicUsageEnvironment/include' '-I.' '-O3' '-v' '-DSOCKLEN_T=socklen_t' '-DNO_STRSTREAM=1' '-D_LARGEFILE_SOURCE=1' '-D_FILE_OFFSET_BITS=64' '-Wall' '-DBSD=1' '-shared-libgcc' '-mfloat-abi=soft'
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/bin/as -mfloat-abi=soft -meabi=4 -o testMP3Streamer.o /tmp/cckqq421.s
COMPILER_PATH=../libexec/gcc/arm-arago-linux-gnueabi/4.3.3/:../libexec/gcc/:../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/bin/
LIBRARY_PATH=../lib/gcc/arm-arago-linux-gnueabi/4.3.3/:../lib/gcc/:../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/lib/:../arm-arago-linux-gnueabi/lib/:../arm-arago-linux-gnueabi/usr/lib/
COLLECT_GCC_OPTIONS='-c' '-I../UsageEnvironment/include' '-I../groupsock/include' '-I../liveMedia/include' '-I../BasicUsageEnvironment/include' '-I.' '-O3' '-v' '-DSOCKLEN_T=socklen_t' '-DNO_STRSTREAM=1' '-D_LARGEFILE_SOURCE=1' '-D_FILE_OFFSET_BITS=64' '-Wall' '-DBSD=1' '-shared-libgcc' '-mfloat-abi=soft'
/ipnc_rdk/../dvsdk_ipnctools/linux-devkit//bin/arm-arago-linux-gnueabi-g++ -otestMP3Streamer -L. testMP3Streamer.o ../liveMedia/libliveMedia.a ../groupsock/libgroupsock.a ../BasicUsageEnvironment/libBasicUsageEnvironment.a ../UsageEnvironment/libUsageEnvironment.a
../liveMedia/libliveMedia.a: In function `RTPSink::presetNextTimestamp()':
Locale.cpp:(.text+0x3232c): undefined reference to `clock_gettime'
../liveMedia/libliveMedia.a: In function `RTCPInstance::addSR()':
Locale.cpp:(.text+0x36dd8): undefined reference to `clock_gettime'
../BasicUsageEnvironment/libBasicUsageEnvironment.a: In function `TimeNow()':
BasicHashTable.cpp:(.text+0x1edc): undefined reference to `clock_gettime'
../BasicUsageEnvironment/libBasicUsageEnvironment.a: In function `DelayQueue::DelayQueue()':
BasicHashTable.cpp:(.text+0x2378): undefined reference to `clock_gettime'
../BasicUsageEnvironment/libBasicUsageEnvironment.a: In function `DelayQueue::DelayQueue()':
BasicHashTable.cpp:(.text+0x2414): undefined reference to `clock_gettime'
../BasicUsageEnvironment/libBasicUsageEnvironment.a:BasicHashTable.cpp:(.text+0x246c): more undefined references to `clock_gettime' follow
collect2: ld returned 1 exit status
make[10]: *** [testMP3Streamer] Error 1
不幸的是,我无法附加makefile的完整输出或内容,因为我似乎达到了帖子长度限制!这里是其中一个makefile,我放了{ {1}}我已经删除了许多类似的条目,你可以猜到发生了什么:
...snip...
答案 0 :(得分:1)
您已将-lrt
- 显然也是-Wl,--verbose
添加到了。{
COMPILE_OPTS
的定义。这不起作用,因为$(COMPILE_OPTS)
只传递给编译器的调用,-lrt
是一个链接器
选项,您必须传递给链接器的调用,它具有任何选项
效果。
从-lrt
的定义中删除COMPILE_OPTS
并将其添加到。{1}}
LIBRARY_LINK_OPTS
的定义。
(同样适用于-Wl,--verbose
,尽管你可能只有
介绍它进行调试。您清楚地知道-Wl,
选项表示
将选项传递给链接器。但是这条指令是针对的
gcc / g ++工具驱动程序在调用链接器时是有效的,
不是在调用编译器时。因此你有详细的编译器输出,
由于-v`选项,但没有详细的链接器输出。)