I'm on OSX 10.9.4 and recently picked up an RTL2832u dongle. After trying to get GNURadio to build on Homebrew, I gave up and installed MacPorts (via Homebrew using Cask). Since MacPorts and Homebrew don't always play nicely, I silo'd my MacPorts PATH settings using this technique. With this method, you prefix any commands that you want to run in a MacPorts-friendly environment with a script that sets up your PATH. This keeps MacPorts from intruding when I don't want to use the things installed by MacPorts (which is most of the time). That script is also included in this Gist.
Not sure if it's unique to installs that use both MacPorts and Homebrew, but I ran into several issues:
- PMT would raise linker errors that looked like this
Undefined symbols for architecture x86_64: pmt::dict_has_key(
. I fixed this by modernizing the project I was working on (gr-ais) by replacing all theCMakeLists.txt
files with ones from a modern GNURadio module and re-adding the project-specific file lists. This was likely due to something crufty ingr-ais
, but including here just in case. - **CMake would detect the OSX
libpython2.7.dylib
(for CMake dependency PythonLibs) instead of the MacPorts libpython2.7.dylib.** To fix this I set the evironment variable
CMAKE_PREFIX_PATH="/opt/local"(in my case I added
export CMAKE_PREFIX_PATH="$MACPORTS_PREFIX"to my
use_macports.sh` script) - CMake would detect the OSX Python interpreter (for CMake dependency PythonInterp) instead of the MacPorts Python interpreter. To fix this I symlinked
/opt/local/bin/Python2.7
to/opt/local/bin/python
(usingsudo ln -s /opt/local/bin/Python2.7 /opt/local/bin/python
). This helped CMake choose the right one. Note that/opt/local/bin/Python2.7
is itself a symlink. - The module would try to install to
/usr/local
instead of/opt/local
. This I fixed by setting-DCMAKE_INSTALL_PREFIX=/opt/local
when running CMake. For examplemkdir build; cd build; use_macports.sh cmake -DCMAKE_INSTALL_PREFIX=/opt/local ../
- Python modules would get installed to
/opt/local/lib/python2.7/site-packages
, while the correct MacPorts place to install modules is/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
. I fixed this by symlinking the former location to the latter (ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /opt/local/lib/python2.7
) (See the (MacPorts wiki)[https://trac.macports.org/wiki/Python] for best practices on locations for Python files) - The module's Python app couldn't load the modules Python package. Not sure why this is, but even though the app (
ais_rx
, in my case) was using/opt/local/bin/Python2.7
(which is symlinked to/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python
),/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
wasn't insys.path
. I fixed this by adding that directory to thePYTHONPATH
. (in my case I addedexport PYTHONPATH="$MACPORTS_PREFIX/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages:$PYTHONPATH"
to my use_macports.sh script)
Now I can build and install GNURadio modules from source by running:
mkdir build && cd build && use_macports cmake -DCMAKE_INSTALL_PREFIX=/opt/local ../ && make && sudo make install
Hopefully this helps someone. If anyone can enlighten me on better ways to do the same thing, I'd love to learn.
Oh, I see you addressed this in one of the bullet points.