Hi,
I am trying to get my out of tree module to build and work on ubuntu
20.04 with the default gnuradio package gnuradio 3.8.1.0-rc1-2build2
When I use gr_modtool to create an out of tree module with an empty
source block then cmake gives an error.
CMake Error at lib/CMakeLists.txt:85:
Parse error. Expected a command name, got unquoted argument with text
"${CMAKE_CURRENT_SOURCE_DIR}/qa_testsource.cc".
Does anybody have gr_modtool working on ubuntu 20.04 with the
distributions gnuradio package.
See below for details of what I did.
install gnuradio and dependencies
apt-get install gnuradio
apt-get install gnuradio-dev
apt-get install build-dep gnuradio
Use gr-modtool to try to create new module with name testmod with a
source block named testsource
gr_modtool newmod testmod
gr_modtool add -t source --add-python-qa --add-cpp-qdistributionsa -l cpp
GNU Radio module name identified: testmod
Language: C++
Enter name of block/code (without module name prefix): testsource
Block/code identifier: testsource
Please specify the copyright holder: Martin Dudok van Heel
Enter valid argument list, including default arguments:
Adding file 'lib/testsource_impl.h'...
Adding file 'lib/testsource_impl.cc'...
Adding file 'include/testmod/testsource.h'...
Adding file 'lib/qa_testsource.cc'...
Adding file 'lib/qa_testsource.h'...
Can't add C++ QA files.
Editing swig/testmod_swig.i...
Adding file 'python/qa_testsource.py'...
Editing python/CMakeLists.txt...
Adding file 'grc/testmod_testsource.block.yml'...
Editing grc/CMakeLists.txt...
mkdir build2
cd build2
cmake ..
- The CXX compiler identification is GNU 9.3.0
-- The C compiler identification is GNU 9.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Build type not specified: defaulting to release.
-- Found LOG4CPP: /usr/lib/x86_64-linux-gnu/liblog4cpp.so
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'gmp'
-- Found gmp, version 6.2.0
-- Found GMP: /usr/lib/x86_64-linux-gnu/libgmpxx.so
-- Checking for module 'mpir >= 3.0'
-- No package 'mpir' found
-- Could NOT find MPIR (missing: MPIRXX_LIBRARY MPIR_LIBRARY
MPIR_INCLUDE_DIR)
-- Found MPLIB: /usr/lib/x86_64-linux-gnu/libgmpxx.so
-- Found Boost:
/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found
suitable version "1.71.0", minimum required is "1.71.0") found
components: date_time program_options filesystem system regex thread
unit_test_framework
-- Found VOLK: Volk::volk
-- User set python executable /usr/bin/python3
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.2")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so (found
suitable exact version "3.8.2")
-- Found Git: /usr/bin/git
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.17") found
components: doxygen dot
CMake Error at lib/CMakeLists.txt:85:
Parse error. Expected a command name, got unquoted argument with text
"${CMAKE_CURRENT_SOURCE_DIR}/qa_testsource.cc".
-- Configuring incomplete, errors occurred!
See also "build2/CMakeFiles/CMakeOutput.log".
See also "build2/CMakeFiles/CMakeError.log".
cat CMakeFiles/CMakeError.log
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the
following output:
Change Dir: gr-testmod/build2/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_60538/fast && /usr/bin/make -f
CMakeFiles/cmTC_60538.dir/build.make CMakeFiles/cmTC_60538.dir/build
make[1]: Entering directory 'gr-testmod/build2/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_60538.dir/src.c.o
/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -std=gnu11 -o
CMakeFiles/cmTC_60538.dir/src.c.o -c
gr-testmod/build2/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_60538
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_60538.dir/link.txt
--verbose=1
/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD
CMakeFiles/cmTC_60538.dir/src.c.o -o cmTC_60538
/usr/bin/ld: CMakeFiles/cmTC_60538.dir/src.c.o: in function `main':
src.c:(.text+0x46): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x63): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_60538.dir/build.make:87: cmTC_60538] Error 1
make[1]: Leaving directory 'gr-testmod/build2/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_60538/fast] Error 2
Source file was:
#include <pthread.h>
void* test_func(void* data)
{
return data;
}
int main(void)
{
pthread_t thread;wich is version
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);
return 0;
}
Determining if the function pthread_create exists in the pthreads failed
with the following output:
Change Dir: gr-testmod/build2/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_37036/fast && /usr/bin/make -f
CMakeFiles/cmTC_37036.dir/build.make CMakeFiles/cmTC_37036.dir/build
make[1]: Entering directory 'gr-testmod/build2/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_37036.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -std=gnu11 -o
CMakeFiles/cmTC_37036.dir/CheckFunctionExists.c.o -c
/usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_37036
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_37036.dir/link.txt
--verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create
CMakeFiles/cmTC_37036.dir/CheckFunctionExists.c.o -o cmTC_37036
-lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_37036.dir/build.make:87: cmTC_37036] Error 1
make[1]: Leaving directory 'gr-testmod/build2/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_37036/fast] Error 2
ls -liah /lib/x86_64-linux-gnu/libpthread*
28613 -rwxr-xr-x 1 root root 154K apr 14 21:26
/lib/x86_64-linux-gnu/libpthread-2.31.so
330186 -rw-r--r-- 1 root root 6,3M apr 14 21:26
/lib/x86_64-linux-gnu/libpthread.a
330209 lrwxrwxrwx 1 root root 37 apr 14 21:26
/lib/x86_64-linux-gnu/libpthread.so -> /lib/x86_64-linux-gnu/libpthread.so.0
28614 lrwxrwxrwx 1 root root 18 jun 23 14:54
/lib/x86_64-linux-gnu/libpthread.so.0 -> libpthread-2.31.so
nm /lib/x86_64-linux-gnu/libpthread-2.31.so | grep pthread_create
00000000000098d0 t __pthread_create_2_1
0000000000007af7 t __pthread_create_2_1.cold
00000000000098d0 T pthread_create@@GLIBC_2.2.5
Thanks in advance,
Martin Dudok van Heel