【问题标题】:error during compilation gr-gsm for GNU Radio 3.8为 GNU Radio 3.8 编译 gr-gsm 时出错
【发布时间】:2020-01-18 09:41:21
【问题描述】:

我正在尝试编译 gr-gsm (https://github.com/ptrkrysik/gr-gsm) 项目。运行 cmake 时出现以下错误:

.
.
.
Building C object CMakeFiles/cmTC_5223d.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_5223d.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_5223d
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5223d.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_5223d.dir   /CheckFunctionExists.c.o  -o cmTC_5223d  -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_5223d.dir/build.make:87: cmTC_5223d] Błąd 1
make[1]: Opuszczenie katalogu '/home/notroot/Pobrane/gr-gsm/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_5223d/fast] Błąd 2

在运行 /usr/bin/cc -lpthreads 命令后,我也出现了这个错误:

/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status

但不是在运行产生此输出的 /usr/bin/cc -lpthread 命令之后:

/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status

我设法将所有 -lpthreads 替换为 -lpthread 标志和 grep -irl "lpthreads" ./* | xargs sed -i 's/lpthreads/lpthread/g' 命令。运行后我看到以下错误:

Building C object CMakeFiles/cmTC_5223d.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_5223d.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_5223d
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5223d.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_5223d.dir/CheckFunctionExists.c.o  -o cmTC_5223d  -lpthread 
/usr/bin/ld: cannot find -lpthread
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_5223d.dir/build.make:87: cmTC_5223d] Błąd 1
make[1]: Opuszczenie katalogu '/home/notroot/Pobrane/gr-gsm/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_5223d/fast] Błąd 2

但是在没有 cmake ld 的情况下运行时会找到 lpthread!

【问题讨论】:

  • “运行 cmake 时出现以下错误” - 不是错误,它会阻止构建项目。您的系统具有pthreads 库只是对CMake 的检查。然后它也会检查pthread 库。经过所有检查后,CMake 决定哪个库可用于 POSIX 线程功能。如果您在构建项目时遇到真正的错误,请显示cmake 调用的输出 的相应部分。你显示的是CMakeErrorLog.txt 文件,如果没有cmake 的主要输出,查看这个文件是没有意义的。
  • 这是 CMakeError.log 的最后部分
  • 完整日志 - pastebin.com/QNFvpE7p
  • 运行cmake 时,您会收到-- Configuring incomplete, errors occurred! See also «/home/noroot/xcicoin/Pobrane/gr-gsm/build/CMakeFiles/CMakeOutput.log» 之类的消息,对吗?如果你想处理这个问题,那么首先你需要找到 actual error message,它位于 above -- Configure incomplete 行。在不知道此错误消息的情况下,没有理由查看 CMakeOutput.logCMakeError.log 文件。请显示来自cmake 输出实际错误消息。请注意,没有文件包含此消息。
  • 不,不要查看文件,查看cmake 输出。为什么您认为构建gr-gsm 失败了?你为什么要查看文件?你在哪里找到他们的名字?

标签: linux build cmake ld


【解决方案1】:

我找到了解决方案: https://github.com/ptrkrysik/gr-gsm/issues/487

此代码不适用于 GNU radio 3.8。仅适用于 GNU radio 3.7。

【讨论】:

    猜你喜欢
    • 2016-05-17
    • 2012-07-24
    • 2020-11-14
    • 1970-01-01
    • 1970-01-01
    • 2021-07-29
    • 2016-07-19
    • 2020-08-09
    • 1970-01-01
    相关资源
    最近更新 更多