pothosware / SoapyUHD

Soapy SDR plugins for UHD supported SDR devices
https://github.com/pothosware/SoapyUHD/wiki
GNU General Public License v3.0
55 stars 29 forks source link

Conversion error when compiling #28

Closed pascal-gujer closed 4 years ago

pascal-gujer commented 4 years ago

Hey guys

when compiling the most recent SoapyUHD project, I get stuck on the following error:

`_git/SoapyUHD/UHDSoapyDevice.cpp: In member function ‘virtual bool UHDSoapyDevice::recv_async_msg(uhd::async_metadata_t&, double)’: _git/SoapyUHD/UHDSoapyDevice.cpp:866:58: error: conversion from ‘boost::shared_ptr’ to non-scalar type ‘uhd::tx_streamer::sptr {aka std::shared_ptr}’ requested uhd::tx_streamer::sptr stream = _tx_streamers[0].lock();


CMakeFiles/soapySupport.dir/build.make:62: recipe for target 'CMakeFiles/soapySupport.dir/UHDSoapyDevice.cpp.o' failed`

I am ready to pay a beer to the one solving me this issue! :)
btw: I am on a pretty fresh Ubuntu 18.04.

cheers and thanks in advance
guruofquality commented 4 years ago

I think some typedefs changed in newer UHD APIs. Does this patch help?

diff --git a/UHDSoapyDevice.cpp b/UHDSoapyDevice.cpp
index 74a4927..22f5b3c 100644
--- a/UHDSoapyDevice.cpp
+++ b/UHDSoapyDevice.cpp
@@ -863,7 +863,7 @@ uhd::tx_streamer::sptr UHDSoapyDevice::get_tx_stream(const uhd::stream_args_t &a

 bool UHDSoapyDevice::recv_async_msg(uhd::async_metadata_t &md, double timeout)
 {
-    uhd::tx_streamer::sptr stream = _tx_streamers[0].lock();
+    auto stream = _tx_streamers[0].lock();
     if (not stream) return false;
     return stream->recv_async_msg(md, timeout);
 }
ghostop14 commented 4 years ago

If I add the boost/foreach.hpp include, and the auto in a couple spots, I still get a few errors like this:

UHDSoapyDevice.cpp:859:71: error: no match for ‘operator=’ (operand types are ‘std::map<long unsigned int, boost::weak_ptr >::mapped_type {aka boost::weak_ptr}’ and ‘uhd::tx_streamer::sptr {aka std::shared_ptr}’) BOOST_FOREACH(const size_t ch, args.channels) _tx_streamers[ch] = stream;

If you can fire up an Ubuntu 18 VM you should see it pretty quick.