Building from source: finding gnuradio-osmosdr

305 views
Skip to first unread message

Petter Gustad

unread,
Aug 27, 2017, 2:37:41 PM8/27/17
to Gqrx SDR
What's the flag to pass to cmake to make sure that gqrx will find osmosdr?

Petter Gustad

unread,
Aug 28, 2017, 4:05:31 PM8/28/17
to Gqrx SDR
There seem to be two options

GNURADIO_OSMOSDR_INCLUDE_DIRS
GNURADIO_OSMOSDR_LIBRARIES

Should they point to the osmosdr source or the installed directory? I can't get either to work. Does anybody have any experience with these and how to point to an out of tree built osmosdr?


Alexandru Csete

unread,
Aug 28, 2017, 4:25:27 PM8/28/17
to gq...@googlegroups.com
On Mon, Aug 28, 2017 at 10:05 PM, Petter Gustad <petter...@gmail.com> wrote:
> There seem to be two options
>
> GNURADIO_OSMOSDR_INCLUDE_DIRS
> GNURADIO_OSMOSDR_LIBRARIES

It's one option, you probably want to use both using
-DGNURADIO_OSMOSDR_INCLUDE_DIRS=/path/to/headers and
-DGNURADIO_OSMOSDR_LIBRARIES=/path/to/libs

> Should they point to the osmosdr source or the installed directory?

Installation directory. However, if cmake does not find it by itself,
the installation is probably broken. Or, it could also be that the
gqrx script is broken.

Alex

Petter Gustad

unread,
Aug 29, 2017, 3:20:12 PM8/29/17
to Gqrx SDR
Thank you for your reply Alex.

The osmosdr installation seem to work. At least it's working in gnuradio, even though I have to set the GRC_BLOCKS_PATH environment variable to point to it since it's built out of tree.

It seems like it's the include file which is my problem. I get the error:

gqrx.git/src/applications/gqrx/receiver.h:34:28: fatal error: osmosdr/source.h: No such file or directory

even if I let GNURADIO_OSMOSDR_INCLUDE_DIRS point to the osmosdr include dir or its parent.

Alexandru Csete

unread,
Aug 29, 2017, 3:38:21 PM8/29/17
to gq...@googlegroups.com
you can try to build using make VERBOSE=1 to see the complete command
lines cmake is using to compile. There you can see whether you have a
-I/some/path where osmosdr/source.h is supposed to be

Alex
> --
> You received this message because you are subscribed to the Google Groups
> "Gqrx SDR" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to gqrx+uns...@googlegroups.com.
> To post to this group, send email to gq...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gqrx/ccc6212d-f3a4-4070-b325-7770f1e7d9f4%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Petter Gustad

unread,
Aug 30, 2017, 4:05:30 PM8/30/17
to Gqrx SDR
Seems like no -I propagate into the generated Makefile.

[  9%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/filter/fir_decim.cpp.o
cd /home/petter/projects/sdr/gqrx.git/petter-build/src && /usr/bin/c++   -DCUSTOM_AIRSPY_KERNELS -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_NO_DEBUG_OUTPUT -DQT_SVG_LIB -DQT_WIDGETS_LIB -DRELEASE -DVERSION=\"\" -DVERSION=\"v2.7-4-gee5f76d-dirty\" -I/home/petter/projects/sdr/gqrx.git/petter-build/src -I/home/petter/projects/sdr/gqrx.git/src -I/home/petter/projects/sdr/gqrx.git/include -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtSvg  -O3 -DNDEBUG   -Wall -Wextra -Wno-unused-parameter -Wsign-compare -fPIC -std=gnu++11 -o CMakeFiles/gqrx.dir/dsp/filter/fir_decim.cpp.o -c /home/petter/projects/sdr/gqrx.git/src/dsp/filter/fir_decim.cpp
<command-line>:0:0: warning: "VERSION" redefined
<command-line>:0:0: note: this is the location of the previous definition
/home/petter/projects/sdr/gqrx.git/src/applications/gqrx/receiver.cpp:34:28: fatal error: osmosdr/source.h: No such file or directory

So the problem appears to be that the cmake FIND_FILE check fails.

Could it be a problem that the .cmake checks for source.h whereas the include is osmosdr/source.h? If the .cmake check finds the path to the file, the -I option should point to the parent.

Alexandru Csete

unread,
Aug 30, 2017, 5:20:51 PM8/30/17
to gq...@googlegroups.com
There should be an -I/path/to/wherever/you/have/stuff/installed which
leads me back to my original assessment: Your installation is broken!

Assuming you installed gr-osmosdr into a custom directory (btw. it's
not called out of tree build), I am guessing you didn't set up the
proper exports.

Alex
> --
> You received this message because you are subscribed to the Google Groups
> "Gqrx SDR" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to gqrx+uns...@googlegroups.com.
> To post to this group, send email to gq...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gqrx/134d17de-fa21-4f70-a6a9-b922621ed986%40googlegroups.com.

Petter Gustad

unread,
Aug 31, 2017, 5:41:57 PM8/31/17
to Gqrx SDR
It's called an out-of-tree module when a module (like osmosdr) is built and installed outside of the rest of gnuradio. Here's a description:


Again, my osmosdr installation works in gnuradio as I mentioned earlier.

The problem appears to be that the included file uses the directory prefix, whereas the FIND_PATH in FindGnuradio-osmosdr.cmake does not. Further, when it's actually located the result is not included in the include directory list. When applying the changes found in my patch below gqrx builds on my system when I set the GNURADIO_OSMOSDR_DIR environment variable to point to my local installation.

Remove "fixme" from the e-mail address if you should apply it.
---- cut here ----
From ef05f8861d3528c79cfe3331c18de00bd010c212 Mon Sep 17 00:00:00 2001
From: Petter Gustad <pet...@gustadfixme.com>
Date: Fri, 1 Sep 2017 01:05:05 +0200
Subject: [PATCH] FindGnuradio-osmosdr.cmake to find include

The search is performed on the same path which is included in the
source. Also the GNURADIO_OSMOSDR_INCLUDE_DIRS is added to the include
directories list.
---
 CMakeLists.txt                           | 1 +
 cmake/Modules/FindGnuradio-osmosdr.cmake | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0a5095a..5e4c017 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,6 +163,7 @@ include_directories(
     ${CMAKE_SOURCE_DIR}/include
     ${Boost_INCLUDE_DIRS}
     ${GNURADIO_RUNTIME_INCLUDE_DIRS}
+    ${GNURADIO_OSMOSDR_INCLUDE_DIRS}
 )
 
 link_directories(
diff --git a/cmake/Modules/FindGnuradio-osmosdr.cmake b/cmake/Modules/FindGnuradio-osmosdr.cmake
index b0f4c43..11bc0c6 100644
--- a/cmake/Modules/FindGnuradio-osmosdr.cmake
+++ b/cmake/Modules/FindGnuradio-osmosdr.cmake
@@ -3,8 +3,8 @@ PKG_CHECK_MODULES(PC_GNURADIO_OSMOSDR gnuradio-osmosdr)
 
 FIND_PATH(
     GNURADIO_OSMOSDR_INCLUDE_DIRS
-    NAMES source.h
-    HINTS $ENV{GNURADIO_OSMOSDR_DIR}/include/osmosdr
+    NAMES osmosdr/source.h
+    HINTS $ENV{GNURADIO_OSMOSDR_DIR}/include
         ${PC_GNURADIO_OSMOSDR_INCLUDEDIR}
         ${CMAKE_INSTALL_PREFIX}/include/osmosdr
     PATHS /usr/local/include/osmosdr
-- 
2.13.5

---- cut here ----

Alexandru Csete

unread,
Aug 31, 2017, 6:02:12 PM8/31/17
to gq...@googlegroups.com
Okay, I think there is some confusion about terminology. An out-of
tree module is a gnuradio module that is not part of gnuradio itself,
but it doesn't say anything about where it is installed. It doesn't
matter, but it has been a bit confusing.

I have several versions of gnuradio & co installed at any given time.
As long as I have the exports properly set (PATH, LD_LIBRARY_PATH,
PKG_CONFIG_PATH, CMAKE_MODULE_PATH and PYTHONPATH) gqrx builds fine.
That not to say your patch doesn't improve it, but you should send it
to the gr-osmosdr project (I don't have write access to their
repository)

Alex
> --
> You received this message because you are subscribed to the Google Groups
> "Gqrx SDR" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to gqrx+uns...@googlegroups.com.
> To post to this group, send email to gq...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gqrx/4009b999-4761-49a9-b0ce-360128b165ee%40googlegroups.com.

Petter Gustad

unread,
Aug 31, 2017, 6:26:51 PM8/31/17
to Gqrx SDR
The above patch is for the gqrx repository, not for gr-osmosdr.

It's so that cmake will honor the GNURADIO_OSMOSDR_DIR environment variable when locating the osmosdr include file.

Alexandru Csete

unread,
Aug 31, 2017, 6:41:24 PM8/31/17
to gq...@googlegroups.com
Heh, ok, I didn't even remember that we had this. I wonder where it
comes from... I guess someone put it together because gr-osmosdr does
not come with one. I will apply it.

Alex
> --
> You received this message because you are subscribed to the Google Groups
> "Gqrx SDR" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to gqrx+uns...@googlegroups.com.
> To post to this group, send email to gq...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gqrx/16f2bea6-7a16-4af8-bf0c-04289acc4c87%40googlegroups.com.

Alexandru Csete

unread,
Aug 31, 2017, 6:59:38 PM8/31/17
to gq...@googlegroups.com
It's now merged, thanks.

Alex
Reply all
Reply to author
Forward
0 new messages