error in archlinux 64bit build
when trying to build the following compilation error is received
HackRF_Streaming.cpp :(. Text + 0x1c4b): undefined reference to 'pthread_cond_clockwait ' /usr/bin/ld: HackRF_Streaming.cpp :(. text + 0x1d25): undefined reference to 'pthread_cond_clockwait ' collect2: error: ld returned exit status 1 make [2]: *** [CMakeFiles/HackRFSupport.dir/build.make: 166: libHackRFSupport.so] Error 1 make [1]: *** [CMakeFiles/Makefile2: 96: CMakeFiles/HackRFSupport.dir/all] Error 2
I solved it by editing lines 41 and 43 of CMakeLists.txt adding -lpthread
but surely this is not the best way to do it.
Its the second time I have seen that error. Maybe a new compiler feature or pthread update. I think I might make SoapySDR itself add -lptread in general to the modules to prevent this going forward
For what it's worth, I'm using up to date Arch Linux on amd64 and building from source is working perfectly here, in addition to the "soapyhackrf" package and "soapyhackrf-git" PKGBUILD in AUR.
% mkdir build && cd build
% cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
-- The CXX compiler identification is GNU 10.1.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
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3")
-- Found LIBHACKRF: /lib/libhackrf.so
-- LIBHACKRF_INCLUDE_DIRS - /usr/include/libhackrf
-- LIBHACKRF_LIBRARIES - /lib/libhackrf.so
-- Checking for hackrf_device_list API...
-- Reading /usr/include/libhackrf/hackrf.h...
-- Performing Test HAS_STD_CXX11
-- Performing Test HAS_STD_CXX11 - Success
-- Found Git: /usr/bin/git (found version "2.27.0")
-- Module HackRFSupport configured with version: 0.3.3-3c514ce
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/SoapyHackRF/build
% make -j32
Scanning dependencies of target HackRFSupport
[ 16%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Streaming.cpp.o
[ 33%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Registration.cpp.o
[ 50%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Settings.cpp.o
[ 66%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Session.cpp.o
[ 83%] Building CXX object CMakeFiles/HackRFSupport.dir/Version.cpp.o
[100%] Linking CXX shared module libHackRFSupport.so
[100%] Built target HackRFSupport
and
% makepkg
==> Making package: soapyhackrf-git 2:r51.051ad65-1 (Fri 19 Jun 2020 04:25:33 PM MDT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Cloning soapyhackrf-git git repo...
Cloning into bare repository '/tmp/soapyhackrf-git/soapyhackrf-git'...
remote: Enumerating objects: 411, done.
remote: Total 411 (delta 0), reused 0 (delta 0), pack-reused 411
Receiving objects: 100% (411/411), 79.86 KiB | 59.00 KiB/s, done.
Resolving deltas: 100% (279/279), done.
==> Validating source files with sha256sums...
soapyhackrf-git ... Skipped
==> Extracting sources...
-> Creating working copy of soapyhackrf-git git repo...
Cloning into 'soapyhackrf-git'...
done.
==> Starting pkgver()...
==> Updated version: soapyhackrf-git 2:r100.3c514ce-1
==> Starting build()...
-- The CXX compiler identification is GNU 10.1.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
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3")
-- Found LIBHACKRF: /lib/libhackrf.so
-- LIBHACKRF_INCLUDE_DIRS - /usr/include/libhackrf
-- LIBHACKRF_LIBRARIES - /lib/libhackrf.so
-- Checking for hackrf_device_list API...
-- Reading /usr/include/libhackrf/hackrf.h...
-- Performing Test HAS_STD_CXX11
-- Performing Test HAS_STD_CXX11 - Success
-- Found Git: /usr/bin/git (found version "2.27.0")
-- Module HackRFSupport configured with version: 0.3.3-3c514ce
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/soapyhackrf-git/src/soapyhackrf-git/build
Scanning dependencies of target HackRFSupport
[ 16%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Registration.cpp.o
[ 33%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Session.cpp.o
[ 50%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Settings.cpp.o
[ 66%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Streaming.cpp.o
[ 83%] Building CXX object CMakeFiles/HackRFSupport.dir/Version.cpp.o
[100%] Linking CXX shared module libHackRFSupport.so
[100%] Built target HackRFSupport
==> Entering fakeroot environment...
==> Starting package()...
make: Entering directory '/tmp/soapyhackrf-git/src/soapyhackrf-git/build'
make[1]: Entering directory '/tmp/soapyhackrf-git/src/soapyhackrf-git/build'
make[2]: Entering directory '/tmp/soapyhackrf-git/src/soapyhackrf-git/build'
make[2]: Leaving directory '/tmp/soapyhackrf-git/src/soapyhackrf-git/build'
[100%] Built target HackRFSupport
make[1]: Leaving directory '/tmp/soapyhackrf-git/src/soapyhackrf-git/build'
Install the project...
-- Install configuration: "Release"
-- Installing: /tmp/soapyhackrf-git/pkg/soapyhackrf-git/usr/lib/SoapySDR/modules0.7/libHackRFSupport.so
make: Leaving directory '/tmp/soapyhackrf-git/src/soapyhackrf-git/build'
==> Tidying install...
-> Removing libtool files...
-> Purging unwanted files...
-> Removing static library files...
-> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "soapyhackrf-git"...
-> Generating .PKGINFO file...
-> Generating .BUILDINFO file...
-> Generating .MTREE file...
-> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: soapyhackrf-git 2:r100.3c514ce-1 (Fri 19 Jun 2020 04:25:39 PM MDT)
A few weeks ago it was built perfectly, but yesterday when I built it again it failed in AUR, so I decided to take a look. Searching I realized that it is a recent error and not very common so I decided to report it here.