为 GNU Radio 3.8 编译 gr-gsm 时出错
error during compilation gr-gsm for GNU Radio 3.8
我正在尝试编译 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
我设法用 -lpthread 标志替换了所有 -lpthreads 和 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!
我找到了解决办法:
https://github.com/ptrkrysik/gr-gsm/issues/487
此代码不适用于 GNU radio 3.8。仅适用于 GNU radio 3.7。
我正在尝试编译 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
我设法用 -lpthread 标志替换了所有 -lpthreads 和 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!
我找到了解决办法: https://github.com/ptrkrysik/gr-gsm/issues/487
此代码不适用于 GNU radio 3.8。仅适用于 GNU radio 3.7。