ADS-B on Mac 10.9 - possible linking error

Hi

I am trying to build and use gr_air_modes built from
GitHub - bistromath/gr-air-modes: Gnuradio Mode-S/ADS-B radio. But the command

sudo ldconfig

is not available on Mac 10.9.5. When I execute the modes_rx command I
get the following:

sudo /usr/local/bin/modes_gui
Traceback (most recent call last):
File “/usr/local/bin/modes_gui”, line 30, in
import air_modes
ImportError: No module named air_modes

Any help greatly appreciated.

[I have reloaded / built all the dependencies from macports yesterday.]

Alan

Hi Alan,

On 23 Sep 2014, at 13:19, Alan W. [email protected]
wrote:

File “/usr/local/bin/modes_gui”, line 30, in
import air_modes
ImportError: No module named air_modes

Python cannot find find the module, so you might have to adapt you
PYTHONPATH to include the folder where air_modes is installed (something
like /usr/local/lib/python2.7/site-packages). Then you will most likely
run into problems with shared libraries that can be fixed like this

If you run it and it segfaults assert (with cmake) that you use the
python libraries from port which are typically installed under
/opt/local. By default it selects the libs from OS X.

Best,
Bastian

A few points regarding gr-air-modes on OSX:

  1. “ldconfig” does not exist on OSX. Apple’s DYLD manager “does the
    right thing” most of the time without having to be told that new
    libraries are available. One can tweak the DYLD manager behavior during
    runtime via various DYLD_* variables <
    https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dyld.1.html

… I encourage folks to set these variables just for a specific
execution, e.g,:
{{{
DYLD_PRINT_LIBRARIES=1 /opt/local/bin/python2.7
}}}
and so forth. Setting (e.g.) DYLD_LIBRARY_PATH to always include
/opt/local/lib is dangerous since generally a library knows which other
libraries it is linked to and it is those libraries that should be used,
not some identically named on that might not be ABI compatible.

  1. I just added gr-air-modes to MacPorts <
    Changeset 125643 – MacPorts >, with a few patches to get
    things going. I’ll send a pull request to bistromath with the changes.
    This port should be live by around 11 AM US/Eastern this morning. You’ll
    want to “sudo port sync” at a minimum; “sudo port selfupdate” is almost
    always better.

  2. Because GNU Radio now links on OSX with some @rpath libraries, it’s
    wise to set the RPATH too, not just the INSTALL_NAME.

[“rpath” == “runtime path”; instead of specifying the exact library
location, e.g. /opt/local/lib/libfoo.dylib, one uses the runtime path
instead, e.g., @rpath/libfoo.dylib . This, in theory, allows the
libraries using @rpath to be embedded within an application by setting
the @rpath to be the absolute path to where those libraries are actually
located.]

The addition is:
{{{
if(APPLE)
if(NOT CMAKE_INSTALL_NAME_DIR)
set(CMAKE_INSTALL_NAME_DIR
${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
PATH “Library Install Name Destination Directory” FORCE)
endif(NOT CMAKE_INSTALL_NAME_DIR)
if(NOT CMAKE_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
PATH “Library Install RPath” FORCE)
endif(NOT CMAKE_INSTALL_RPATH)
if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE
BOOL “Do Build Using Library Install RPath” FORCE)
endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
endif(APPLE)
}}}

Hope this helps! - MLD

Awesome, thanks for the report Alan, and thanks Michael for the package.
Happy to incorporate any required changes.

–n
On Sep 23, 2014 3:21 PM, “Alan W.” [email protected]

Michael, Bastian

Many thanks for your help, the macports method has worked perfectly and
I now have a working gr-air-modes with the rtl-sdr dongle.

Alan

That’s great, Alan. Thanks for the feedback & have fun with your GNU
Radio / RTL dongle setup. - MLD