RTLSDR + MatLab 2014b

Horribly geeky post, more for my own information than anything. Might help others.

After installing MatLab 2014b on OSX, I thought it might be fun to see if it’ll work with an RTLSDR dongle – if you’ve a license you can download a driver package for the MatLab communication toolbox from Mathworks (No, I’ll not give you or help you get a pirate copy.)

The RTL support package installs ok, but it wouldn’t work with the existing librtlsdr.0.dylib library on my system. It seems the library had been installed with a Compatibility Version number of 0.0.0

matlab-rtl-error

Recompiling the library from scratch, or installing it from homebrew didn’t fix the error. A nose around in the  build folder for librtlsdr showed that no compatibility version number was being set when the library was being linked (final step in the compile process.)

The solution was to edit the link.txt file in /build/src/CMakeFiles/rtlsdr_shared.dir
There’s only one long line in the file, I changed it to read:

/usr/bin/cc  -O3 -DNDEBUG -dynamiclib -compatibility_version 1.0 -Wl,-headerpad_max_install_names -current_version 0.5.3 -o librtlsdr.0.5.3.dylib -install_name /Users/dm/scratch/rtlsdr/librtlsdr-0.5.3/build/src/librtlsdr.0.dylib CMakeFiles/rtlsdr_shared.dir/librtlsdr.c.o CMakeFiles/rtlsdr_shared.dir/tuner_e4k.c.o CMakeFiles/rtlsdr_shared.dir/tuner_fc0012.c.o CMakeFiles/rtlsdr_shared.dir/tuner_fc0013.c.o CMakeFiles/rtlsdr_shared.dir/tuner_fc2580.c.o CMakeFiles/rtlsdr_shared.dir/tuner_r82xx.c.o /usr/local/lib/libusb-1.0.dylib 

[all the above should be on one line]

Then the library was rebuilt (issue the make command in build.)

matlab-rtlsd-rworking