Search code examples
linuxbuildcmakeld

error during compilation gr-gsm for GNU Radio 3.8


I'm trying to compile gr-gsm ( https://github.com/ptrkrysik/gr-gsm ) project. While running cmake I'm occuring following error:

.
.
.
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

and after running /usr/bin/cc -lpthreads command I also occur this error:

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

but not after running /usr/bin/cc -lpthread command that produces this output:

/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

I managed to replace all -lpthreads with -lpthread flag with grep -irl "lpthreads" ./* | xargs sed -i 's/lpthreads/lpthread/g' command. After running it I see following error:

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

but while running without cmake ld an find lpthread!


Solution

  • I found a solution: https://github.com/ptrkrysik/gr-gsm/issues/487

    This code did not worked with GNU radio 3.8. Only worked with GNU radio 3.7.