rxseger / linuxproblems

Problems I encountered with Linux-based software
1 stars 0 forks source link

Raspbian: hackrf library outdated, 2014.08.1-1, incompatible with SoapyHackRF #5

Open rxseger opened 8 years ago

rxseger commented 8 years ago

Raspbian/Debian's repository has an outdated hackrf from 2014:

pi@raspberrypi:~/hackrf/host/build $ sudo apt search hackrf
Sorting... Done
Full Text Search... Done
gqrx-sdr/stable 2.3.1-2 armhf
  Software defined radio receiver

gr-osmosdr/stable 0.1.3-2 armhf
  Gnuradio blocks from the OsmoSDR project

hackrf/stable,now 2014.08.1-1 armhf [installed]
  Software defined radio peripheral

libhackrf-dev/stable 2014.08.1-1 armhf
  Software defined radio peripheral

libhackrf0/stable,now 2014.08.1-1 armhf [installed,automatic]
  Software defined radio peripheral

no newer version found when using 'sudo apt update' then apt list --upgradable.

wouldn't be a problem but https://github.com/pothosware/SoapyHackRF requires a newer version:

pi@raspberrypi:~/SoapyHackRF $ make
Scanning dependencies of target HackRFSupport
[ 25%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Registation.cpp.o
In file included from /home/pi/SoapyHackRF/HackRF_Registation.cpp:22:0:
/home/pi/SoapyHackRF/SoapyHackRF.hpp:356:2: error: ‘hackrf_device_list_t’ does not name a type
  hackrf_device_list_t * _list;
  ^
/home/pi/SoapyHackRF/SoapyHackRF.hpp:371:2: error: ‘transceiver_mode_t’ does not name a type
  transceiver_mode_t _current_mode;
  ^
/home/pi/SoapyHackRF/HackRF_Registation.cpp: In function ‘std::vector<std::map<std::basic_string<char>, std::basic_string<char> > > find_HackRF(const Kwargs&)’:
/home/pi/SoapyHackRF/HackRF_Registation.cpp:33:2: error: ‘hackrf_device_list_t’ was not declared in this scope
  hackrf_device_list_t *list;
  ^
/home/pi/SoapyHackRF/HackRF_Registation.cpp:33:24: error: ‘list’ was not declared in this scope
  hackrf_device_list_t *list;
                        ^
/home/pi/SoapyHackRF/HackRF_Registation.cpp:35:27: error: ‘hackrf_device_list’ was not declared in this scope
  list =hackrf_device_list();
                           ^
/home/pi/SoapyHackRF/HackRF_Registation.cpp:45:44: error: ‘hackrf_device_list_open’ was not declared in this scope
    hackrf_device_list_open(list, i, &device);
                                            ^
/home/pi/SoapyHackRF/HackRF_Registation.cpp:84:30: error: ‘hackrf_device_list_free’ was not declared in this scope
  hackrf_device_list_free(list);
                              ^
CMakeFiles/HackRFSupport.dir/build.make:54: recipe for target 'CMakeFiles/HackRFSupport.dir/HackRF_Registation.cpp.o' failed
make[2]: *** [CMakeFiles/HackRFSupport.dir/HackRF_Registation.cpp.o] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/HackRFSupport.dir/all' failed
make[1]: *** [CMakeFiles/HackRFSupport.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2
rxseger commented 8 years ago

To remove:

sudo apt remove libhackrf-dev sudo apt remove libhackrf0 sudo apt remove hackrf

then follow instructions at https://github.com/mossmann/hackrf/tree/master/host to install

builds and installs successfully:

pi@raspberrypi:~/hackrf/host/build $ sudo make install
[ 11%] Built target hackrf
[ 22%] Built target hackrf-static
[ 33%] Built target hackrf_cpldjtag
[ 44%] Built target hackrf_info
[ 55%] Built target hackrf_max2837
[ 66%] Built target hackrf_rffc5071
[ 77%] Built target hackrf_si5351c
[ 88%] Built target hackrf_spiflash
[100%] Built target hackrf_transfer
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/pkgconfig/libhackrf.pc
-- Installing: /etc/udev/rules.d/53-hackrf.rules
-- Installing: /usr/local/lib/libhackrf.so.0.4.0
-- Installing: /usr/local/lib/libhackrf.so.0
-- Installing: /usr/local/lib/libhackrf.so
-- Installing: /usr/local/lib/libhackrf.a
-- Installing: /usr/local/include/libhackrf/hackrf.h
-- Installing: /usr/local/bin/hackrf_max2837
-- Removed runtime path from "/usr/local/bin/hackrf_max2837"
-- Installing: /usr/local/bin/hackrf_si5351c
-- Removed runtime path from "/usr/local/bin/hackrf_si5351c"
-- Installing: /usr/local/bin/hackrf_transfer
-- Removed runtime path from "/usr/local/bin/hackrf_transfer"
-- Installing: /usr/local/bin/hackrf_rffc5071
-- Removed runtime path from "/usr/local/bin/hackrf_rffc5071"
-- Installing: /usr/local/bin/hackrf_spiflash
-- Removed runtime path from "/usr/local/bin/hackrf_spiflash"
-- Installing: /usr/local/bin/hackrf_cpldjtag
-- Removed runtime path from "/usr/local/bin/hackrf_cpldjtag"
-- Installing: /usr/local/bin/hackrf_info
-- Removed runtime path from "/usr/local/bin/hackrf_info"

but cmake can't find it, something about "safe runtime search paths":

pi@raspberrypi:~/SoapyHackRF $ cmake .
-- Build type not specified: defaulting to release.
-- LIBHACKRF_INCLUDE_DIR - /usr/include/libhackrf
-- LIBHACKRF_LIBRARIES - /usr/lib/arm-linux-gnueabihf/libhackrf.so
-- Configuring done
CMake Warning at /usr/local/share/cmake/SoapySDR/SoapySDRUtil.cmake:36 (add_library):
  Cannot generate a safe runtime search path for target HackRFSupport because
  files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libhackrf.so] in /usr/lib/arm-linux-gnueabihf may be hidden by files in:
      /usr/local/lib

  Some of these libraries may not be found correctly.
Call Stack (most recent call first):
  CMakeLists.txt:47 (SOAPY_SDR_MODULE_UTIL)

-- Generating done
-- Build files have been written to: /home/pi/SoapyHackRF

I want it to find the files in /usr/local/lib where I installed the latest libhackrf, not /usr/lib/arm-linux-gnueabihf. Indeed, /usr/lib/arm-linux-gnueabihf/libhackrf.so doesn't exist anymore:

pi@raspberrypi:~/SoapyHackRF $ ls /usr/lib/arm-linux-gnueabihf/libhackrf.so ls: cannot access /usr/lib/arm-linux-gnueabihf/libhackrf.so: No such file or directory

rxseger commented 8 years ago

Leftover from old cache (so that's why cmake recommends 'mkdir build; cmake ..'), removing the cache can rebuild ok:

pi@raspberrypi:~/SoapyHackRF $ cmake .
-- The CXX compiler identification is GNU 4.9.2
-- 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
-- Build type not specified: defaulting to release.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- Found LIBHACKRF: /usr/local/lib/libhackrf.so  
-- LIBHACKRF_INCLUDE_DIR - /usr/local/include/libhackrf
-- LIBHACKRF_LIBRARIES - /usr/local/lib/libhackrf.so
-- Performing Test HAS_STD_CXX11
-- Performing Test HAS_STD_CXX11 - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/SoapyHackRF
pi@raspberrypi:~/SoapyHackRF $ make
Scanning dependencies of target HackRFSupport
[ 25%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Registation.cpp.o
[ 50%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Settings.cpp.o
/home/pi/SoapyHackRF/HackRF_Settings.cpp: In member function ‘virtual double SoapyHackRF::getSampleRate(int, size_t) const’:
/home/pi/SoapyHackRF/HackRF_Settings.cpp:658:13: warning: ‘samp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return(samp);
             ^
/home/pi/SoapyHackRF/HackRF_Settings.cpp: In member function ‘virtual double SoapyHackRF::getBandwidth(int, size_t) const’:
/home/pi/SoapyHackRF/HackRF_Settings.cpp:718:12: warning: ‘bw’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return (bw);
            ^
/home/pi/SoapyHackRF/HackRF_Settings.cpp: In member function ‘virtual void SoapyHackRF::setGain(int, size_t, double)’:
/home/pi/SoapyHackRF/HackRF_Settings.cpp:415:110: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   SoapySDR::logf( SOAPY_SDR_ERROR, "setGain(%f) returned %s", value, hackrf_error_name( (hackrf_error) ret ) );
                                                                                                              ^
/home/pi/SoapyHackRF/HackRF_Settings.cpp: In member function ‘virtual double SoapyHackRF::getFrequency(int, size_t, const string&) const’:
/home/pi/SoapyHackRF/HackRF_Settings.cpp:561:9: warning: ‘freq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  double freq;
         ^
[ 75%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Streaming.cpp.o
/home/pi/SoapyHackRF/HackRF_Streaming.cpp: In member function ‘virtual void SoapyHackRF::releaseReadBuffer(SoapySDR::Stream*, size_t)’:
/home/pi/SoapyHackRF/HackRF_Streaming.cpp:733:22: warning: unused variable ‘data’ [-Wunused-variable]
  SoapyHackRFStream * data = (SoapyHackRFStream*)stream;
                      ^
/home/pi/SoapyHackRF/HackRF_Streaming.cpp: In member function ‘virtual void SoapyHackRF::releaseWriteBuffer(SoapySDR::Stream*, size_t, size_t, int&, long long int)’:
/home/pi/SoapyHackRF/HackRF_Streaming.cpp:792:22: warning: unused variable ‘data’ [-Wunused-variable]
  SoapyHackRFStream * data = (SoapyHackRFStream*)stream;
                      ^
/home/pi/SoapyHackRF/HackRF_Streaming.cpp: In member function ‘virtual size_t SoapyHackRF::getStreamMTU(SoapySDR::Stream*) const’:
/home/pi/SoapyHackRF/HackRF_Streaming.cpp:266:9: warning: ‘mtu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return mtu;
         ^
/home/pi/SoapyHackRF/HackRF_Streaming.cpp: In member function ‘virtual int SoapyHackRF::readStream(SoapySDR::Stream*, void* const*, size_t, int&, long long int&, long int)’:
/home/pi/SoapyHackRF/HackRF_Streaming.cpp:257:9: warning: ‘mtu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  size_t mtu;
         ^
/home/pi/SoapyHackRF/HackRF_Streaming.cpp: In member function ‘virtual int SoapyHackRF::writeStream(SoapySDR::Stream*, const void* const*, size_t, int&, long long int, long int)’:
/home/pi/SoapyHackRF/HackRF_Streaming.cpp:257:9: warning: ‘mtu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
/home/pi/SoapyHackRF/HackRF_Streaming.cpp: In member function ‘virtual size_t SoapyHackRF::getNumDirectAccessBuffers(SoapySDR::Stream*)’:
/home/pi/SoapyHackRF/HackRF_Streaming.cpp:814:9: warning: ‘buffers’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return buffers;
         ^
/home/pi/SoapyHackRF/HackRF_Streaming.cpp: In member function ‘virtual int SoapyHackRF::acquireReadBuffer(SoapySDR::Stream*, size_t&, const void**, int&, long long int&, long int)’:
/home/pi/SoapyHackRF/HackRF_Streaming.cpp:726:34: warning: ‘mtu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return this->getStreamMTU(stream);
                                  ^
/home/pi/SoapyHackRF/HackRF_Streaming.cpp: In member function ‘virtual int SoapyHackRF::acquireWriteBuffer(SoapySDR::Stream*, size_t&, void**, long int)’:
/home/pi/SoapyHackRF/HackRF_Streaming.cpp:781:34: warning: ‘mtu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return this->getStreamMTU(stream);
                                  ^
/home/pi/SoapyHackRF/HackRF_Streaming.cpp:777:49: warning: ‘mtu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    memset(buffs[0],0,this->getStreamMTU(stream));
                                                 ^
/home/pi/SoapyHackRF/HackRF_Streaming.cpp:776:31: warning: ‘mtu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if((_tx_stream->burst_samps - int32_t(this->getStreamMTU(stream))) < 0){
                               ^
[100%] Building CXX object CMakeFiles/HackRFSupport.dir/HackRF_Session.cpp.o
Linking CXX shared module libHackRFSupport.so
[100%] Built target HackRFSupport
pi@raspberrypi:~/SoapyHackRF $ make install
[100%] Built target HackRFSupport
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/SoapySDR/modules0.5-2/libHackRFSupport.so
CMake Error at cmake_install.cmake:42 (file):
  file INSTALL cannot copy file "/home/pi/SoapyHackRF/libHackRFSupport.so" to
  "/usr/local/lib/SoapySDR/modules0.5-2/libHackRFSupport.so".

Makefile:66: recipe for target 'install' failed
make: *** [install] Error 1
pi@raspberrypi:~/SoapyHackRF $ sudo make install
[100%] Built target HackRFSupport
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/SoapySDR/modules0.5-2/libHackRFSupport.so
-- Removed runtime path from "/usr/local/lib/SoapySDR/modules0.5-2/libHackRFSupport.so"

and hackrf_info then SoapySDRUtil --probe finds the device