pa3gsb / Radioberry-2.x

Ham Radio hat for Raspberry PI
450 stars 88 forks source link

SoapyRadioberrySDR fails to compile on Debian Bullseye #21

Closed jketterl closed 2 years ago

jketterl commented 2 years ago

This initially occurred while building new Raspberry Pi images for OpenWebRX, but I have been able to reproduce the same problem in a Debian Bullseye docker container with only necessary packages installed.

The recent changes seem to cause problems with the C++ compiler on Debian, in particular std::make_unique() seems to be unavailable (error: 'make_unique' is not a member of 'std'; full verbose log below). Seeing that this is only available in C++ 14, I tried modifying the cmake files to enforce C++ 14, but could not resolve it with set(CMAKE_CXX_STANDARD 14) (same errror), and it seems like cmake still stubbornly passes -std=gnu++11 to the compiler.

Other similar issues suggest using the target_compile_features() directive, but since the actual targets are handled by SoapySDR macros, I don't see how to add this.

$ VERBOSE=1 make
/usr/bin/cmake -S/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR -B/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build/CMakeFiles /root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build//CMakeFiles/progress.marks
make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build'
make  -f CMakeFiles/SoapyRadioberrySDR.dir/build.make CMakeFiles/SoapyRadioberrySDR.dir/depend
make[2]: Entering directory '/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build'
cd /root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR /root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR /root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build /root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build /root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build/CMakeFiles/SoapyRadioberrySDR.dir/DependInfo.cmake --color=
Dependee "/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp" is newer than depends file "/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build/CMakeFiles/SoapyRadioberrySDR.dir/depend.internal".
Clearing dependencies in "/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build/CMakeFiles/SoapyRadioberrySDR.dir/depend.make".
Scanning dependencies of target SoapyRadioberrySDR
make[2]: Leaving directory '/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build'
make  -f CMakeFiles/SoapyRadioberrySDR.dir/build.make CMakeFiles/SoapyRadioberrySDR.dir/build
make[2]: Entering directory '/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build'
[ 20%] Building CXX object CMakeFiles/SoapyRadioberrySDR.dir/SoapyRadioberry.cpp.o
/usr/bin/c++ -DSoapyRadioberrySDR_EXPORTS  -O3 -DNDEBUG -fPIC -Wall -Wextra -std=gnu++11 -o CMakeFiles/SoapyRadioberrySDR.dir/SoapyRadioberry.cpp.o -c /root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberry.cpp
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberry.cpp: In function 'SoapySDR::KwargsList findMyRadioberry(const Kwargs&)':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberry.cpp:11:63: warning: unused parameter 'args' [-Wunused-parameter]
   11 | SoapySDR::KwargsList findMyRadioberry(const SoapySDR::Kwargs &args)
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
[ 40%] Building CXX object CMakeFiles/SoapyRadioberrySDR.dir/SoapyRadioberrySettings.cpp.o
/usr/bin/c++ -DSoapyRadioberrySDR_EXPORTS  -O3 -DNDEBUG -fPIC -Wall -Wextra -std=gnu++11 -o CMakeFiles/SoapyRadioberrySDR.dir/SoapyRadioberrySettings.cpp.o -c /root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In constructor 'SoapyRadioberry::SoapyRadioberry(const Kwargs&)':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:17:18: error: 'make_unique' is not a member of 'std'
   17 |   i2c_ptr = std::make_unique<rpihw::driver::i2c> (rpihw::driver::i2c("/dev/i2c-1"));
      |                  ^~~~~~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:17:18: note: 'std::make_unique' is only available from C++14 onwards
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:17:48: error: expected primary-expression before '>' token
   17 |   i2c_ptr = std::make_unique<rpihw::driver::i2c> (rpihw::driver::i2c("/dev/i2c-1"));
      |                                                ^
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:9:59: warning: unused parameter 'args' [-Wunused-parameter]
    9 | SoapyRadioberry::SoapyRadioberry( const SoapySDR::Kwargs &args ){
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In member function 'virtual size_t SoapyRadioberry::getNumChannels(int) const':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:103:51: warning: unused parameter 'direction' [-Wunused-parameter]
  103 | size_t SoapyRadioberry::getNumChannels( const int direction ) const
      |                                         ~~~~~~~~~~^~~~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In member function 'virtual bool SoapyRadioberry::getFullDuplex(int, size_t) const':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:112:48: warning: unused parameter 'direction' [-Wunused-parameter]
  112 | bool SoapyRadioberry::getFullDuplex( const int direction, const size_t channel ) const
      |                                      ~~~~~~~~~~^~~~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:112:72: warning: unused parameter 'channel' [-Wunused-parameter]
  112 | bool SoapyRadioberry::getFullDuplex( const int direction, const size_t channel ) const
      |                                                           ~~~~~~~~~~~~~^~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In member function 'virtual std::vector<double> SoapyRadioberry::listBandwidths(int, size_t) const':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:119:88: warning: unused parameter 'channel' [-Wunused-parameter]
  119 | std::vector<double> SoapyRadioberry::listBandwidths( const int direction, const size_t channel ) const
      |                                                                           ~~~~~~~~~~~~~^~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In member function 'virtual std::vector<double> SoapyRadioberry::listSampleRates(int, size_t) const':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:139:89: warning: unused parameter 'channel' [-Wunused-parameter]
  139 | std::vector<double> SoapyRadioberry::listSampleRates( const int direction, const size_t channel ) const
      |                                                                            ~~~~~~~~~~~~~^~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In member function 'virtual double SoapyRadioberry::getBandwidth(int, size_t) const':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:159:73: warning: unused parameter 'channel' [-Wunused-parameter]
  159 | double SoapyRadioberry::getBandwidth( const int direction, const size_t channel ) const
      |                                                            ~~~~~~~~~~~~~^~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In member function 'virtual SoapySDR::RangeList SoapyRadioberry::getFrequencyRange(int, size_t) const':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:179:67: warning: unused parameter 'direction' [-Wunused-parameter]
  179 | SoapySDR::RangeList SoapyRadioberry::getFrequencyRange( const int direction, const size_t channel)  const
      |                                                         ~~~~~~~~~~^~~~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:179:91: warning: unused parameter 'channel' [-Wunused-parameter]
  179 | SoapySDR::RangeList SoapyRadioberry::getFrequencyRange( const int direction, const size_t channel)  const
      |                                                                              ~~~~~~~~~~~~~^~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In member function 'virtual std::vector<std::__cxx11::basic_string<char> > SoapyRadioberry::listAntennas(int, size_t) const':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:190:91: warning: unused parameter 'channel' [-Wunused-parameter]
  190 | std::vector<std::string> SoapyRadioberry::listAntennas( const int direction, const size_t channel ) const
      |                                                                              ~~~~~~~~~~~~~^~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In member function 'virtual std::vector<std::__cxx11::basic_string<char> > SoapyRadioberry::listGains(int, size_t) const':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:206:64: warning: unused parameter 'direction' [-Wunused-parameter]
  206 | std::vector<std::string> SoapyRadioberry::listGains( const int direction, const size_t channel ) const
      |                                                      ~~~~~~~~~~^~~~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:206:88: warning: unused parameter 'channel' [-Wunused-parameter]
  206 | std::vector<std::string> SoapyRadioberry::listGains( const int direction, const size_t channel ) const
      |                                                                           ~~~~~~~~~~~~~^~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In member function 'virtual SoapySDR::Range SoapyRadioberry::getGainRange(int, size_t) const':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:215:82: warning: unused parameter 'channel' [-Wunused-parameter]
  215 | SoapySDR::Range SoapyRadioberry::getGainRange( const int direction, const size_t channel) const
      |                                                                     ~~~~~~~~~~~~~^~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In member function 'virtual void SoapyRadioberry::setGain(int, size_t, double)':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:224:66: warning: unused parameter 'channel' [-Wunused-parameter]
  224 | void SoapyRadioberry::setGain( const int direction, const size_t channel, const double value ) {
      |                                                     ~~~~~~~~~~~~~^~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp: In member function 'virtual void SoapyRadioberry::setFrequency(int, size_t, double, const Kwargs&)':
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:252:71: warning: unused parameter 'channel' [-Wunused-parameter]
  252 | void SoapyRadioberry::setFrequency( const int direction, const size_t channel,  const double frequency, const SoapySDR::Kwargs &args ) {
      |                                                          ~~~~~~~~~~~~~^~~~~~~
/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/SoapyRadioberrySettings.cpp:252:129: warning: unused parameter 'args' [-Wunused-parameter]
  252 | void SoapyRadioberry::setFrequency( const int direction, const size_t channel,  const double frequency, const SoapySDR::Kwargs &args ) {
      |                                                                                                         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
make[2]: *** [CMakeFiles/SoapyRadioberrySDR.dir/build.make:95: CMakeFiles/SoapyRadioberrySDR.dir/SoapyRadioberrySettings.cpp.o] Error 1
make[2]: Leaving directory '/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build'
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/SoapyRadioberrySDR.dir/all] Error 2
make[1]: Leaving directory '/root/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build'
make: *** [Makefile:160: all] Error 2
paulh002 commented 2 years ago

I cloned the repository and compiled it on Bullseye (32 bit), but I don't see any error. It compiles ok. But I compiled it directly. The steps I executed: 1) cd SoapyRadioBerrySDR 2) mkdir build 3) cd build 4) cmake .. 5) make 6) sudo make install

Please, add the exact steps used to compile SoapyRadioberrySDR

jketterl commented 2 years ago

The steps are:

git clone https://github.com/pa3gsb/Radioberry-2.x.git
cd Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/
mkdir build
cd build
cmake ..
make

The error occurs during the last step.

This happens inside a Debian Bullseye container on my 64bit x86 host. I also downloaded a fresh Rasperry Pi OS Bullseye (2022-01-28 32bit) image and tried it on a Pi 3B+ with the same result.

While building the RPi images, the build runs in an arm32 environment emulated by qemu, but I don't think the emulation is responsible for this kind of error.

paulh002 commented 2 years ago

Hi,

I have created a new image for a pi3 using Raspberry imager v1.7.1 the steps I have followed:

sudo apt update sudo apt upgrade sudo apt install build-essential git cmake swig -y sudo apt-get -y install git git clone https://github.com/pothosware/SoapySDR.git cd SoapySDR mkdir build cd build cmake .. make -j4 sudo make install sudo ldconfig cd ~ git clone https://github.com/pa3gsb/Radioberry-2.x.git cd Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/ mkdir build cd build cmake .. make pi.txt

All compiled well without errors

jketterl commented 2 years ago

Indeed, that works. But for the sake of being able to update the system without too much of a hassle, I'm using the package manager to deliver software over compiling from source whenever possible. I am therefor relying on the SoapySDR version that's available in the Debian repositories. So please try repeating with libsoapysdr-dev and without compiling SoapySDR from source.

paulh002 commented 2 years ago

I have updated CMakeList.txt to set the compiler to C14. The Debian repository of bullseye contains an older SoapySDR version which uses C11. You can test it by cloning my fork of Radioberry. If all is ok I will ask Johan with a pull request to update it. The fork is located at https://github.com/paulh002/Radioberry-2.x

jketterl commented 2 years ago

Interestingly, that works. To my surprise, it seems like the only change is basically the same that I had already tried initially: setting the CMAKE_CXX_STANDARD to 14. Wouldn't be surprised if it actually needs to be in the correct order... I have already learned that SoapySDR modifies cmake settings pretty generously without paying a lot of respect to what other developers have in mind...

paulh002 commented 2 years ago

Good, please check if SoapyRadioberry works good for openwebrx. I could not test it with other software. But I tried to align it as much as possible with other SoapySDR implementations like plutosdr and sdrplay. This version also support transmitting. I am now also trying to support multi rx. 73 Paul

pa3gsb commented 2 years ago

solved.