From argilo at gmail.com Sat Feb 8 14:48:21 2020 From: argilo at gmail.com (argilo at gmail.com) Date: Sat, 8 Feb 2020 09:48:21 -0500 Subject: [PATCH] build: Allow building with GNU Radio master Message-ID: <20200208144821.12428-1-argilo@gmail.com> From: Clayton Smith Currently gr-osmosdr does not build with GNU Radio's master branch, which declares itself to be version 3.9. This change allows both 3.8 and 3.9. --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56c1a6b185..f3186dee0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,13 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) # Find GNURadio (pmt and runtime are core, always included) -find_package(Gnuradio "3.8" REQUIRED COMPONENTS blocks fft filter) +find_package(Gnuradio "3.8" COMPONENTS blocks fft filter) +if(NOT Gnuradio_FOUND) + find_package(Gnuradio "3.9" COMPONENTS blocks fft filter) + if(NOT Gnuradio_FOUND) + message(FATAL_ERROR "Unable to find GNURadio") + ENDIF(NOT Gnuradio_FOUND) +ENDIF(NOT Gnuradio_FOUND) # Set the version information here set(VERSION_MAJOR 0) -- 2.17.1 From argilo at gmail.com Sat Feb 8 14:48:40 2020 From: argilo at gmail.com (argilo at gmail.com) Date: Sat, 8 Feb 2020 09:48:40 -0500 Subject: [PATCH] build: Allow building with GNU Radio master Message-ID: <20200208144840.12476-1-argilo@gmail.com> From: Clayton Smith Currently gr-iqbal does not build with GNU Radio's master branch, which declares itself to be version 3.9. This change allows both 3.8 and 3.9. --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e8c0a5754..bc8a1aef0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,13 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) # Find GNURadio -find_package(Gnuradio "3.8" REQUIRED) +find_package(Gnuradio "3.8") +if(NOT Gnuradio_FOUND) + find_package(Gnuradio "3.9") + if(NOT Gnuradio_FOUND) + message(FATAL_ERROR "Unable to find GNURadio") + ENDIF(NOT Gnuradio_FOUND) +ENDIF(NOT Gnuradio_FOUND) # Set the version information here set(VERSION_MAJOR 3) -- 2.17.1 From tnt at 246tnt.com Sat Feb 8 14:55:25 2020 From: tnt at 246tnt.com (Sylvain Munaut) Date: Sat, 8 Feb 2020 15:55:25 +0100 Subject: [PATCH] build: Allow building with GNU Radio master In-Reply-To: <20200208144821.12428-1-argilo@gmail.com> References: <20200208144821.12428-1-argilo@gmail.com> Message-ID: Nope sorry, not merging those. I don't want at any point in the code something that says I am "3.9 compatible" when the actual 3.9 API spec isn't fixed / definitive ... Because that could yield in the future (says when 3.9 is released and contains incompatible changes) that you have a git version that pretends to be 3.9 compatible ... but doesn't actually build against 3.9 ... IMHO the change should be in the gnuradio tree itself where the GnuraidoConfig cmake version check should be ignored (or accept 3.8) for git dev versions. That's something that was discussed / brought up at the hackfest last week. Cheers, Sylvain On Sat, Feb 8, 2020 at 3:48 PM wrote: > > From: Clayton Smith > > Currently gr-osmosdr does not build with GNU Radio's master branch, > which declares itself to be version 3.9. This change allows both 3.8 > and 3.9. > --- > CMakeLists.txt | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/CMakeLists.txt b/CMakeLists.txt > index 56c1a6b185..f3186dee0c 100644 > --- a/CMakeLists.txt > +++ b/CMakeLists.txt > @@ -42,7 +42,13 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") > list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) > > # Find GNURadio (pmt and runtime are core, always included) > -find_package(Gnuradio "3.8" REQUIRED COMPONENTS blocks fft filter) > +find_package(Gnuradio "3.8" COMPONENTS blocks fft filter) > +if(NOT Gnuradio_FOUND) > + find_package(Gnuradio "3.9" COMPONENTS blocks fft filter) > + if(NOT Gnuradio_FOUND) > + message(FATAL_ERROR "Unable to find GNURadio") > + ENDIF(NOT Gnuradio_FOUND) > +ENDIF(NOT Gnuradio_FOUND) > > # Set the version information here > set(VERSION_MAJOR 0) > -- > 2.17.1 > From argilo at gmail.com Sat Feb 8 15:11:59 2020 From: argilo at gmail.com (Clayton Smith) Date: Sat, 8 Feb 2020 10:11:59 -0500 Subject: [PATCH] build: Allow building with GNU Radio master In-Reply-To: References: <20200208144821.12428-1-argilo@gmail.com> Message-ID: My motivation was to make PyBOMBS installs work, but I agree that this would be better addressed in GNU Radio itself. I'll just patch these locally until that happens. - Clayton On Sat, Feb 8, 2020 at 9:54 AM Sylvain Munaut wrote: > Nope sorry, not merging those. > > I don't want at any point in the code something that says I am "3.9 > compatible" when the actual 3.9 API spec isn't fixed / definitive ... > Because that could yield in the future (says when 3.9 is released and > contains incompatible changes) that you have a git version that > pretends to be 3.9 compatible ... but doesn't actually build against > 3.9 ... > > IMHO the change should be in the gnuradio tree itself where the > GnuraidoConfig cmake version check should be ignored (or accept 3.8) > for git dev versions. > That's something that was discussed / brought up at the hackfest last week. > > Cheers, > > Sylvain > > > > > On Sat, Feb 8, 2020 at 3:48 PM wrote: > > > > From: Clayton Smith > > > > Currently gr-osmosdr does not build with GNU Radio's master branch, > > which declares itself to be version 3.9. This change allows both 3.8 > > and 3.9. > > --- > > CMakeLists.txt | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/CMakeLists.txt b/CMakeLists.txt > > index 56c1a6b185..f3186dee0c 100644 > > --- a/CMakeLists.txt > > +++ b/CMakeLists.txt > > @@ -42,7 +42,13 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING > "") > > list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) > > > > # Find GNURadio (pmt and runtime are core, always included) > > -find_package(Gnuradio "3.8" REQUIRED COMPONENTS blocks fft filter) > > +find_package(Gnuradio "3.8" COMPONENTS blocks fft filter) > > +if(NOT Gnuradio_FOUND) > > + find_package(Gnuradio "3.9" COMPONENTS blocks fft filter) > > + if(NOT Gnuradio_FOUND) > > + message(FATAL_ERROR "Unable to find GNURadio") > > + ENDIF(NOT Gnuradio_FOUND) > > +ENDIF(NOT Gnuradio_FOUND) > > > > # Set the version information here > > set(VERSION_MAJOR 0) > > -- > > 2.17.1 > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From argilo at gmail.com Sun Feb 9 03:10:20 2020 From: argilo at gmail.com (argilo at gmail.com) Date: Sat, 8 Feb 2020 22:10:20 -0500 Subject: [PATCH] rtl_tcp: Throw an exception if TCP connection fails Message-ID: <20200209031020.13235-1-argilo@gmail.com> From: Clayton Smith Currently, rtl_tcp_source_c repeatedly calls ::connect until it succeeds. This can result in 100% CPU utilization and/or a lot of network traffic. In addition, GUI applications like Gqrx freeze up. To solve these problems, I've changed the code to report an error if ::connect fails. Also, I removed rtl_tcp_source_f since it is no longer used, and corrected a few error messages in rtl_tcp_source_c so they print the correct class name. --- lib/rtl_tcp/rtl_tcp_source_c.cc | 10 +- lib/rtl_tcp/rtl_tcp_source_f.cc | 327 -------------------------------- lib/rtl_tcp/rtl_tcp_source_f.h | 125 ------------ 3 files changed, 5 insertions(+), 457 deletions(-) delete mode 100644 lib/rtl_tcp/rtl_tcp_source_f.cc delete mode 100644 lib/rtl_tcp/rtl_tcp_source_f.h diff --git a/lib/rtl_tcp/rtl_tcp_source_c.cc b/lib/rtl_tcp/rtl_tcp_source_c.cc index ecdeee0216..af8e30006b 100644 --- a/lib/rtl_tcp/rtl_tcp_source_c.cc +++ b/lib/rtl_tcp/rtl_tcp_source_c.cc @@ -98,7 +98,7 @@ static int is_error( int perr ) case WSAENOPROTOOPT: return( perr == ENOPROTOOPT ); default: - fprintf(stderr,"rtl_tcp_source_f: unknown error %d WS err %d \n", perr, werr ); + fprintf(stderr,"rtl_tcp_source_c: unknown error %d WS err %d \n", perr, werr ); throw std::runtime_error("internal error"); } return 0; @@ -200,7 +200,7 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) : WSADATA wsaData; int iResult = WSAStartup( MAKEWORD(2,2), &wsaData ); if( iResult != NO_ERROR ) { - report_error( "rtl_tcp_source_f WSAStartup", "can't open socket" ); + report_error( "rtl_tcp_source_c WSAStartup", "can't open socket" ); } #endif @@ -219,7 +219,7 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) : // FIXME leaks if report_error throws below int ret = getaddrinfo(host.c_str(), port_str, &hints, &ip_src); if (ret != 0) - report_error("rtl_tcp_source_f/getaddrinfo", + report_error("rtl_tcp_source_c/getaddrinfo", "can't initialize source socket" ); d_temp_buff = new unsigned char[payload_size]; // allow it to hold up to payload_size bytes @@ -261,8 +261,8 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) : report_error("SO_RCVTIMEO","can't set socket option SO_RCVTIMEO"); #endif // USE_RCV_TIMEO - while (::connect(d_socket, ip_src->ai_addr, ip_src->ai_addrlen) != 0) - ; // FIXME handle errors? + if (::connect(d_socket, ip_src->ai_addr, ip_src->ai_addrlen) != 0) + report_error("rtl_tcp_source_c/connect","can't open TCP connection"); freeaddrinfo(ip_src); int flag = 1; diff --git a/lib/rtl_tcp/rtl_tcp_source_f.cc b/lib/rtl_tcp/rtl_tcp_source_f.cc deleted file mode 100644 index a17594c916..0000000000 --- a/lib/rtl_tcp/rtl_tcp_source_f.cc +++ /dev/null @@ -1,327 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Hoernchen - * Copyright 2012 Dimitri Stolnikov - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -//#define HAVE_WINDOWS_H - - -#include -#include -#include -#include -#include -#include - -#ifndef _WIN32 -#include -#else -#include -#endif - -/* copied from rtl sdr code */ -typedef struct { /* structure size must be multiple of 2 bytes */ - char magic[4]; - uint32_t tuner_type; - uint32_t tuner_gain_count; -} dongle_info_t; - -#define USE_SELECT 1 // non-blocking receive on all platforms -#define USE_RCV_TIMEO 0 // non-blocking receive on all but Cygwin -#define SRC_VERBOSE 0 -#define SNK_VERBOSE 0 - -static int is_error( int perr ) -{ - // Compare error to posix error code; return nonzero if match. -#if defined(USING_WINSOCK) -#define ENOPROTOOPT 109 - // All codes to be checked for must be defined below - int werr = WSAGetLastError(); - switch( werr ) { - case WSAETIMEDOUT: - return( perr == EAGAIN ); - case WSAENOPROTOOPT: - return( perr == ENOPROTOOPT ); - default: - fprintf(stderr,"rtl_tcp_source_f: unknown error %d WS err %d \n", perr, werr ); - throw std::runtime_error("internal error"); - } - return 0; -#else - return( perr == errno ); -#endif -} - -static void report_error( const char *msg1, const char *msg2 ) -{ - // Deal with errors, both posix and winsock -#if defined(USING_WINSOCK) - int werr = WSAGetLastError(); - fprintf(stderr, "%s: winsock error %d\n", msg1, werr ); -#else - perror(msg1); -#endif - if( msg2 != NULL ) - throw std::runtime_error(msg2); - return; -} - -rtl_tcp_source_f::rtl_tcp_source_f(size_t itemsize, - const char *host, - unsigned short port, - int payload_size, - bool eof, - bool wait) - : gr::sync_block ("rtl_tcp_source_f", - gr::io_signature::make(0, 0, 0), - gr::io_signature::make(1, 1, sizeof(float))), - d_itemsize(itemsize), - d_payload_size(payload_size), - d_eof(eof), - d_wait(wait), - d_socket(-1), - d_temp_offset(0) -{ - int ret = 0; -#if defined(USING_WINSOCK) // for Windows (with MinGW) - // initialize winsock DLL - WSADATA wsaData; - int iResult = WSAStartup( MAKEWORD(2,2), &wsaData ); - if( iResult != NO_ERROR ) { - report_error( "rtl_tcp_source_f WSAStartup", "can't open socket" ); - } -#endif - - // Set up the address stucture for the source address and port numbers - // Get the source IP address from the host name - struct addrinfo *ip_src; // store the source IP address to use - struct addrinfo hints; - memset( (void*)&hints, 0, sizeof(hints) ); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - hints.ai_flags = AI_PASSIVE; - char port_str[12]; - sprintf( port_str, "%d", port ); - - // FIXME leaks if report_error throws below - ret = getaddrinfo( host, port_str, &hints, &ip_src ); - if( ret != 0 ) - report_error("rtl_tcp_source_f/getaddrinfo", - "can't initialize source socket" ); - - // FIXME leaks if report_error throws below - d_temp_buff = new unsigned char[d_payload_size]; // allow it to hold up to payload_size bytes - d_LUT= new float[0xff+1]; - for(int i=0; i <=(0xff);++i){ - d_LUT[i] = (((float)(i&0xff))-127.4f)*(1.0f/128.0f); - } - // create socket - d_socket = socket(ip_src->ai_family, ip_src->ai_socktype, - ip_src->ai_protocol); - if(d_socket == -1) { - report_error("socket open","can't open socket"); - } - - // Turn on reuse address - int opt_val = 1; - if(setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, (optval_t)&opt_val, sizeof(int)) == -1) { - report_error("SO_REUSEADDR","can't set socket option SO_REUSEADDR"); - } - - // Don't wait when shutting down - linger lngr; - lngr.l_onoff = 1; - lngr.l_linger = 0; - if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (optval_t)&lngr, sizeof(linger)) == -1) { - if( !is_error(ENOPROTOOPT) ) { // no SO_LINGER for SOCK_DGRAM on Windows - report_error("SO_LINGER","can't set socket option SO_LINGER"); - } - } - -#if USE_RCV_TIMEO - // Set a timeout on the receive function to not block indefinitely - // This value can (and probably should) be changed - // Ignored on Cygwin -#if defined(USING_WINSOCK) - DWORD timeout = 1000; // milliseconds -#else - timeval timeout; - timeout.tv_sec = 1; - timeout.tv_usec = 0; -#endif - if(setsockopt(d_socket, SOL_SOCKET, SO_RCVTIMEO, (optval_t)&timeout, sizeof(timeout)) == -1) { - report_error("SO_RCVTIMEO","can't set socket option SO_RCVTIMEO"); - } -#endif // USE_RCV_TIMEO - - while(connect(d_socket, ip_src->ai_addr, ip_src->ai_addrlen) != 0); - freeaddrinfo(ip_src); - - int flag = 1; - setsockopt(d_socket, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,sizeof(flag)); - - dongle_info_t dongle_info; - ret = recv(d_socket, (char*)&dongle_info, sizeof(dongle_info), 0); - if (sizeof(dongle_info) != ret) - fprintf(stderr,"failed to read dongle info\n"); - - d_tuner_type = RTLSDR_TUNER_UNKNOWN; - d_tuner_gain_count = 0; - d_tuner_if_gain_count = 0; - - if (memcmp(dongle_info.magic, "RTL0", 4) == 0) - { - d_tuner_type = ntohl(dongle_info.tuner_type); - d_tuner_gain_count = ntohl(dongle_info.tuner_gain_count); - if ( RTLSDR_TUNER_E4000 == d_tuner_type ) - d_tuner_if_gain_count = 53; - } -} - -rtl_tcp_source_f_sptr make_rtl_tcp_source_f (size_t itemsize, - const char *ipaddr, - unsigned short port, - int payload_size, - bool eof, - bool wait) -{ - return gnuradio::get_initial_sptr(new rtl_tcp_source_f ( - itemsize, - ipaddr, - port, - payload_size, - eof, - wait)); -} - -rtl_tcp_source_f::~rtl_tcp_source_f () -{ - delete [] d_temp_buff; - - if (d_socket != -1){ - shutdown(d_socket, SHUT_RDWR); -#if defined(USING_WINSOCK) - closesocket(d_socket); -#else - ::close(d_socket); -#endif - d_socket = -1; - } - -#if defined(USING_WINSOCK) // for Windows (with MinGW) - // free winsock resources - WSACleanup(); -#endif -} - -int rtl_tcp_source_f::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *out = (float *) output_items[0]; - ssize_t r = 0; - - int bytesleft = noutput_items; - int index = 0; - int receivedbytes = 0; - while(bytesleft > 0) { - receivedbytes = recv(d_socket, (char*)&d_temp_buff[index], bytesleft, 0); - - if(receivedbytes == -1 && !is_error(EAGAIN)){ - fprintf(stderr, "socket error\n"); - return -1; - } - bytesleft -= receivedbytes; - index += receivedbytes; - } - r = noutput_items; - - for(int i=0; i - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef RTL_TCP_SOURCE_F_H -#define RTL_TCP_SOURCE_F_H - -#include -#include - -#if defined(_WIN32) -// if not posix, assume winsock -#pragma comment(lib, "ws2_32.lib") -#define USING_WINSOCK -#include -#include -#define SHUT_RDWR 2 -typedef char* optval_t; -#else -#include -#include -#include -#include -#include -#include -typedef void* optval_t; -#endif - -#ifdef _MSC_VER -#include -typedef ptrdiff_t ssize_t; -#endif //_MSC_VER - -/* copied from rtl sdr */ -enum rtlsdr_tuner { - RTLSDR_TUNER_UNKNOWN = 0, - RTLSDR_TUNER_E4000, - RTLSDR_TUNER_FC0012, - RTLSDR_TUNER_FC0013, - RTLSDR_TUNER_FC2580, - RTLSDR_TUNER_R820T, - RTLSDR_TUNER_R828D -}; - -class rtl_tcp_source_f; -typedef boost::shared_ptr rtl_tcp_source_f_sptr; - -rtl_tcp_source_f_sptr make_rtl_tcp_source_f ( - size_t itemsize, - const char *host, - unsigned short port, - int payload_size, - bool eof = false, - bool wait = false); - -class rtl_tcp_source_f : public gr::sync_block -{ -private: - size_t d_itemsize; - int d_payload_size; // maximum transmission unit (packet length) - bool d_eof; // zero-length packet is EOF - bool d_wait; // wait if data if not immediately available - int d_socket; // handle to socket - unsigned char *d_temp_buff; // hold buffer between calls - size_t d_temp_offset; // point to temp buffer location offset - float *d_LUT; - - unsigned int d_tuner_type; - unsigned int d_tuner_gain_count; - unsigned int d_tuner_if_gain_count; - -private: - rtl_tcp_source_f(size_t itemsize, const char *host, - unsigned short port, int payload_size, bool eof, bool wait); - - // The friend declaration allows make_source_c to - // access the private constructor. - friend rtl_tcp_source_f_sptr make_rtl_tcp_source_f ( - size_t itemsize, - const char *host, - unsigned short port, - int payload_size, - bool eof, - bool wait); - -public: - ~rtl_tcp_source_f(); - - enum rtlsdr_tuner get_tuner_type() { return (enum rtlsdr_tuner) d_tuner_type; } - unsigned int get_tuner_gain_count() { return d_tuner_gain_count; } - unsigned int get_tuner_if_gain_count() { return d_tuner_if_gain_count; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_freq(int freq); - void set_sample_rate(int sample_rate); - void set_gain_mode(int manual); - void set_gain(int gain); - void set_freq_corr(int ppm); - void set_if_gain(int stage, int gain); - void set_agc_mode(int on); - void set_direct_sampling(int on); - void set_offset_tuning(int on); -}; - - -#endif /* RTL_TCP_SOURCE_F_H */ -- 2.17.1 From argilo at gmail.com Sun Feb 9 05:09:34 2020 From: argilo at gmail.com (Clayton Smith) Date: Sun, 9 Feb 2020 00:09:34 -0500 Subject: [PATCH] build: Allow building with GNU Radio master In-Reply-To: References: <20200208144821.12428-1-argilo@gmail.com> Message-ID: I've opened a pull request with a proposal to fix this in GNU Radio: https://github.com/gnuradio/gnuradio/pull/3187 On Sat, Feb 8, 2020 at 10:11 AM Clayton Smith wrote: > My motivation was to make PyBOMBS installs work, but I agree that this > would be better addressed in GNU Radio itself. I'll just patch these > locally until that happens. > > - Clayton > > On Sat, Feb 8, 2020 at 9:54 AM Sylvain Munaut wrote: > >> Nope sorry, not merging those. >> >> I don't want at any point in the code something that says I am "3.9 >> compatible" when the actual 3.9 API spec isn't fixed / definitive ... >> Because that could yield in the future (says when 3.9 is released and >> contains incompatible changes) that you have a git version that >> pretends to be 3.9 compatible ... but doesn't actually build against >> 3.9 ... >> >> IMHO the change should be in the gnuradio tree itself where the >> GnuraidoConfig cmake version check should be ignored (or accept 3.8) >> for git dev versions. >> That's something that was discussed / brought up at the hackfest last >> week. >> >> Cheers, >> >> Sylvain >> >> >> >> >> On Sat, Feb 8, 2020 at 3:48 PM wrote: >> > >> > From: Clayton Smith >> > >> > Currently gr-osmosdr does not build with GNU Radio's master branch, >> > which declares itself to be version 3.9. This change allows both 3.8 >> > and 3.9. >> > --- >> > CMakeLists.txt | 8 +++++++- >> > 1 file changed, 7 insertions(+), 1 deletion(-) >> > >> > diff --git a/CMakeLists.txt b/CMakeLists.txt >> > index 56c1a6b185..f3186dee0c 100644 >> > --- a/CMakeLists.txt >> > +++ b/CMakeLists.txt >> > @@ -42,7 +42,13 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE >> STRING "") >> > list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) >> > >> > # Find GNURadio (pmt and runtime are core, always included) >> > -find_package(Gnuradio "3.8" REQUIRED COMPONENTS blocks fft filter) >> > +find_package(Gnuradio "3.8" COMPONENTS blocks fft filter) >> > +if(NOT Gnuradio_FOUND) >> > + find_package(Gnuradio "3.9" COMPONENTS blocks fft filter) >> > + if(NOT Gnuradio_FOUND) >> > + message(FATAL_ERROR "Unable to find GNURadio") >> > + ENDIF(NOT Gnuradio_FOUND) >> > +ENDIF(NOT Gnuradio_FOUND) >> > >> > # Set the version information here >> > set(VERSION_MAJOR 0) >> > -- >> > 2.17.1 >> > >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mueller at kit.edu Sun Feb 9 10:00:49 2020 From: mueller at kit.edu (=?utf-8?B?TcO8bGxlciwgTWFyY3VzIChDRUwp?=) Date: Sun, 9 Feb 2020 10:00:49 +0000 Subject: [PATCH] build: Allow building with GNU Radio master In-Reply-To: References: <20200208144821.12428-1-argilo@gmail.com> Message-ID: <398987ac538bad0e6ff4d7c23ee3d8e7d597063f.camel@kit.edu> Hi! I understand the issue, but as GR maintainer: I'm sorry Dave, I'm afraid I can't do that. Two reasons: 1. master hasn't been 3.8 compat in a long time now. The removal of all the Py2 would be one indication, but we've also messed around with enough C++ symbols to break our compatibility contract even if you're already using Py3. 2. How should GR know when changes *don't* break submodules? So, however, Sylvain is right, we need to change GR a bit. One way forward is to change our ...Version.cmake to * set PACKAGE_VERSION_COMPATIBLE on REQUESTED MAJOR==GR MAJOR && GR VERSION >= REQUESTED VERSION * set PACKAGE_VERSION_EXACT on GR VERSION == REQUESTED VERSION (all digits specified, not just the first three) Since this is a very upstream discussion to have, let's move it to GNU Radio's sphere: https://github.com/gnuradio/gnuradio/issues/3188 Best regards, Marcus On Sat, 2020-02-08 at 15:55 +0100, Sylvain Munaut wrote: > > IMHO the change should be in the gnuradio tree itself where the > GnuraidoConfig cmake version check should be ignored (or accept 3.8) > for git dev versions. > That's something that was discussed / brought up at the hackfest last > week. > > Cheers, > > Sylvain > > > > > On Sat, Feb 8, 2020 at 3:48 PM wrote: > > From: Clayton Smith > > > > Currently gr-osmosdr does not build with GNU Radio's master branch, > > which declares itself to be version 3.9. This change allows both > > 3.8 > > and 3.9. > > --- > > CMakeLists.txt | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/CMakeLists.txt b/CMakeLists.txt > > index 56c1a6b185..f3186dee0c 100644 > > --- a/CMakeLists.txt > > +++ b/CMakeLists.txt > > @@ -42,7 +42,13 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE > > STRING "") > > list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) > > > > # Find GNURadio (pmt and runtime are core, always included) > > -find_package(Gnuradio "3.8" REQUIRED COMPONENTS blocks fft filter) > > +find_package(Gnuradio "3.8" COMPONENTS blocks fft filter) > > +if(NOT Gnuradio_FOUND) > > + find_package(Gnuradio "3.9" COMPONENTS blocks fft filter) > > + if(NOT Gnuradio_FOUND) > > + message(FATAL_ERROR "Unable to find GNURadio") > > + ENDIF(NOT Gnuradio_FOUND) > > +ENDIF(NOT Gnuradio_FOUND) > > > > # Set the version information here > > set(VERSION_MAJOR 0) > > -- > > 2.17.1 > > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 6582 bytes Desc: not available URL: From ptrkrysik at gmail.com Mon Feb 17 08:11:25 2020 From: ptrkrysik at gmail.com (Piotr Krysik) Date: Mon, 17 Feb 2020 09:11:25 +0100 Subject: [PATCH] cmake: Go back CMake min ver. 3.8 by removing need for CMP0079 Message-ID: <1581927085-14269-1-git-send-email-ptrkrysik@gmail.com> CMake 3.13 is not present in older (~2 years old) Linux distributions and GNU Radio requires min CMake version 3.8. All that is needed in order to avoid bumping CMake version is to not use 'target_link_libraries' in subdirectories. Here this is done by creating a list of needed libraries and adding them for linking at the end (like it was done in gr-osmosdr before porting to GNU Radio 3.8). One thing that is lost here is 'PRIVATE' statement in case of FCD libraries linking. --- CMakeLists.txt | 3 +-- lib/CMakeLists.txt | 7 ++++--- lib/airspy/CMakeLists.txt | 2 +- lib/airspyhf/CMakeLists.txt | 2 +- lib/bladerf/CMakeLists.txt | 2 +- lib/fcd/CMakeLists.txt | 5 +++-- lib/file/CMakeLists.txt | 2 +- lib/freesrp/CMakeLists.txt | 2 +- lib/hackrf/CMakeLists.txt | 2 +- lib/miri/CMakeLists.txt | 2 +- lib/osmosdr/CMakeLists.txt | 2 +- lib/redpitaya/CMakeLists.txt | 2 +- lib/rtl/CMakeLists.txt | 2 +- lib/rtl_tcp/CMakeLists.txt | 2 +- lib/sdrplay/CMakeLists.txt | 2 +- lib/soapy/CMakeLists.txt | 2 +- lib/uhd/CMakeLists.txt | 2 +- 17 files changed, 22 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a2cf9d..cf24991 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,14 +20,13 @@ ######################################################################## # Project setup ######################################################################## -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.8) include(GNUInstallDirs) project(gr-osmosdr CXX C) enable_testing() #policy setup cmake_policy(SET CMP0011 NEW) -cmake_policy(SET CMP0079 NEW) #select the release build type by default to get optimization flags if(NOT CMAKE_BUILD_TYPE) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index d04cb1d..f8c9db7 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -41,7 +41,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) endif() add_library(gnuradio-osmosdr SHARED) -target_link_libraries(gnuradio-osmosdr ${Boost_LIBRARIES} gnuradio::gnuradio-runtime) +list(APPEND gr_osmosdr_libs ${Boost_LIBRARIES} gnuradio::gnuradio-runtime) target_include_directories(gnuradio-osmosdr PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${Boost_INCLUDE_DIRS} @@ -100,7 +100,7 @@ CHECK_CXX_SOURCE_COMPILES(" if(HAVE_CLOCK_GETTIME) message(STATUS " High resolution timing supported through clock_gettime.") set(TIME_SPEC_DEFS HAVE_CLOCK_GETTIME) - target_link_libraries(gnuradio-osmosdr "-lrt") + list(APPEND gr_osmosdr_libs "-lrt") elseif(HAVE_MACH_ABSOLUTE_TIME) message(STATUS " High resolution timing supported through mach_absolute_time.") set(TIME_SPEC_DEFS HAVE_MACH_ABSOLUTE_TIME) @@ -124,7 +124,7 @@ GR_REGISTER_COMPONENT("Osmocom IQ Imbalance Correction" ENABLE_IQBALANCE gnuradi if(ENABLE_IQBALANCE) add_definitions(-DHAVE_IQBALANCE=1) target_include_directories(gnuradio-osmosdr PRIVATE ${gnuradio-iqbalance_INCLUDE_DIRS}) - target_link_libraries(gnuradio-osmosdr gnuradio::gnuradio-iqbalance) + list(APPEND gr_osmosdr_libs gnuradio::gnuradio-iqbalance) endif(ENABLE_IQBALANCE) ######################################################################## @@ -263,6 +263,7 @@ configure_file( # Finalize target ######################################################################## set_target_properties(gnuradio-osmosdr PROPERTIES SOURCES "${gr_osmosdr_srcs}") +target_link_libraries(gnuradio-osmosdr ${gr_osmosdr_libs}) ######################################################################## # Install built library files diff --git a/lib/airspy/CMakeLists.txt b/lib/airspy/CMakeLists.txt index 4a60138..848a91a 100644 --- a/lib/airspy/CMakeLists.txt +++ b/lib/airspy/CMakeLists.txt @@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${LIBAIRSPY_INCLUDE_DIRS} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs gnuradio::gnuradio-filter ${Gnuradio-blocks_LIBRARIES} ${LIBAIRSPY_LIBRARIES} diff --git a/lib/airspyhf/CMakeLists.txt b/lib/airspyhf/CMakeLists.txt index 122a67c..e2c63d7 100644 --- a/lib/airspyhf/CMakeLists.txt +++ b/lib/airspyhf/CMakeLists.txt @@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${LIBAIRSPYHF_INCLUDE_DIRS} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs ${Gnuradio-blocks_LIBRARIES} ${LIBAIRSPYHF_LIBRARIES} ) diff --git a/lib/bladerf/CMakeLists.txt b/lib/bladerf/CMakeLists.txt index e09a4d7..6cf2f7d 100644 --- a/lib/bladerf/CMakeLists.txt +++ b/lib/bladerf/CMakeLists.txt @@ -27,7 +27,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${Volk_INCLUDE_DIRS} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs ${LIBBLADERF_LIBRARIES} ${Volk_LIBRARIES} ) diff --git a/lib/fcd/CMakeLists.txt b/lib/fcd/CMakeLists.txt index 146191f..80f88d3 100644 --- a/lib/fcd/CMakeLists.txt +++ b/lib/fcd/CMakeLists.txt @@ -29,7 +29,8 @@ if(ENABLE_FCD) target_include_directories(gnuradio-osmosdr PRIVATE ${Gnuradio-fcd_INCLUDE_DIRS} ) - target_link_libraries(gnuradio-osmosdr PRIVATE + + list(APPEND gr_osmosdr_libs ${Gnuradio-fcd_LIBRARIES} ) endif(ENABLE_FCD) @@ -38,7 +39,7 @@ if(ENABLE_FCDPP) target_include_directories(gnuradio-osmosdr PRIVATE ${Gnuradio-fcdpp_INCLUDE_DIRS} ) - target_link_libraries(gnuradio-osmosdr PRIVATE + list(APPEND gr_osmosdr_libs ${Gnuradio-fcdpp_LIBRARIES} ) endif(ENABLE_FCDPP) diff --git a/lib/file/CMakeLists.txt b/lib/file/CMakeLists.txt index 2897589..98e60f7 100644 --- a/lib/file/CMakeLists.txt +++ b/lib/file/CMakeLists.txt @@ -25,7 +25,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs gnuradio::gnuradio-blocks ) message(STATUS ${gnuradio-blocks_LIBRARIES}) diff --git a/lib/freesrp/CMakeLists.txt b/lib/freesrp/CMakeLists.txt index 85eb64d..ec1ed85 100644 --- a/lib/freesrp/CMakeLists.txt +++ b/lib/freesrp/CMakeLists.txt @@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${LIBFREESRP_INCLUDE_DIRS} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs ${LIBFREESRP_LIBRARIES} ) diff --git a/lib/hackrf/CMakeLists.txt b/lib/hackrf/CMakeLists.txt index d099b41..32dd0ea 100644 --- a/lib/hackrf/CMakeLists.txt +++ b/lib/hackrf/CMakeLists.txt @@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${LIBHACKRF_INCLUDE_DIRS} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs ${LIBHACKRF_LIBRARIES} ) diff --git a/lib/miri/CMakeLists.txt b/lib/miri/CMakeLists.txt index 5415a9d..e999927 100644 --- a/lib/miri/CMakeLists.txt +++ b/lib/miri/CMakeLists.txt @@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${LIBMIRISDR_INCLUDE_DIRS} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs ${LIBMIRISDR_LIBRARIES} ) diff --git a/lib/osmosdr/CMakeLists.txt b/lib/osmosdr/CMakeLists.txt index 83d6dbc..c9dabdd 100644 --- a/lib/osmosdr/CMakeLists.txt +++ b/lib/osmosdr/CMakeLists.txt @@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${LIBOSMOSDR_INCLUDE_DIRS} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs ${LIBOSMOSDR_LIBRARIES} ) diff --git a/lib/redpitaya/CMakeLists.txt b/lib/redpitaya/CMakeLists.txt index 0d13c48..695ef5b 100644 --- a/lib/redpitaya/CMakeLists.txt +++ b/lib/redpitaya/CMakeLists.txt @@ -25,7 +25,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs ${Gnuradio-blocks_LIBRARIES} ) diff --git a/lib/rtl/CMakeLists.txt b/lib/rtl/CMakeLists.txt index ad3a7dc..d70338e 100644 --- a/lib/rtl/CMakeLists.txt +++ b/lib/rtl/CMakeLists.txt @@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${LIBRTLSDR_INCLUDE_DIRS} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs ${LIBRTLSDR_LIBRARIES} ) diff --git a/lib/rtl_tcp/CMakeLists.txt b/lib/rtl_tcp/CMakeLists.txt index 7acb614..f723668 100644 --- a/lib/rtl_tcp/CMakeLists.txt +++ b/lib/rtl_tcp/CMakeLists.txt @@ -25,7 +25,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs ${Gnuradio-blocks_LIBRARIES} ) diff --git a/lib/sdrplay/CMakeLists.txt b/lib/sdrplay/CMakeLists.txt index c310f5d..6b73cbf 100644 --- a/lib/sdrplay/CMakeLists.txt +++ b/lib/sdrplay/CMakeLists.txt @@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${LIBSDRPLAY_INCLUDE_DIRS} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs ${LIBSDRPLAY_LIBRARIES} ) diff --git a/lib/soapy/CMakeLists.txt b/lib/soapy/CMakeLists.txt index d2a725b..5277483 100644 --- a/lib/soapy/CMakeLists.txt +++ b/lib/soapy/CMakeLists.txt @@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${SoapySDR_INCLUDE_DIRS} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs ${SoapySDR_LIBRARIES} ) diff --git a/lib/uhd/CMakeLists.txt b/lib/uhd/CMakeLists.txt index f9fb196..db089f5 100644 --- a/lib/uhd/CMakeLists.txt +++ b/lib/uhd/CMakeLists.txt @@ -27,7 +27,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${UHD_INCLUDE_DIRS} ) -target_link_libraries(gnuradio-osmosdr +list(APPEND gr_osmosdr_libs gnuradio::gnuradio-uhd ${UHD_LIBRARIES} ) -- 2.7.4 From cebner at gmx.at Thu Feb 20 22:12:52 2020 From: cebner at gmx.at (Christian Ebner) Date: Thu, 20 Feb 2020 23:12:52 +0100 Subject: Fix 64 bit casts in librtlsdr Message-ID: An HTML attachment was scrubbed... URL: From mueller at kit.edu Fri Feb 21 08:51:14 2020 From: mueller at kit.edu (=?utf-8?B?TcO8bGxlciwgTWFyY3VzIChDRUwp?=) Date: Fri, 21 Feb 2020 08:51:14 +0000 Subject: Fix 64 bit casts in librtlsdr In-Reply-To: References: Message-ID: Hi Christian, this sounds like you meant to attach a patch or diff -u file? Best regards, Marcus On Thu, 2020-02-20 at 23:12 +0100, Christian Ebner wrote: > add compile switch > -Werror=pointer-to-int-cast > -Werror=int-to-pointer-cast > -Werror=shorten-64-to-32 > and compile to see results > > Christian -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 6582 bytes Desc: not available URL: