First thing we need to do is install the build tools, if they are not installed.
tinkernow@beaglebone:~$ sudo apt-get install cmake
tinkernow@beaglebone:~$ sudo apt-get install libusb-1.0-0-dev
from the home folder, we are going to create a directory to download the rtl-sdr code. We will call this directory “src”, and once created, will move into that directory with the cd command.
tinkernow@beaglebone:~$ cd src
Now we need to download the code from the rtl-sdr repository. Use the git clone command below:
Once the code has been downloaded, we need to create a directory to build the project and create the make files. We will first move into the “rtl-sdr” directory, and then create a new directory using “mkdir”, and call this new directory “build”. Next, we will cd into the newly created build directory. After we are in the “build” directory, we will run the command “cmake ../”, which starts the compilation of the program.
tinkernow@beaglebone:~$ mkdir build
tinkernow@beaglebone:~$ cd build
tinkernow@beaglebone:~$ cmake ../
This is the output you should see from running cmake ../:
— Check for working C compiler: /usr/bin/cc
— Check for working C compiler: /usr/bin/cc — works
— Detecting C compiler ABI info
— Detecting C compiler ABI info – done
— Build type not specified: defaulting to release.
— Extracting version information from git describe…
— Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
— Looking for libusb_handle_events_timeout_completed
— Looking for libusb_handle_events_timeout_completed – found
— Looking for libusb_error_name
— Looking for libusb_error_name – found
— Found libusb-1.0: /usr/include/libusb-1.0, /usr/lib/arm-linux-gnueabihf/libusb-1.0.so
— Looking for include file pthread.h
— Looking for include file pthread.h – found
— Looking for pthread_create in pthreads
— Looking for pthread_create in pthreads – not found
— Looking for pthread_create in pthread
— Looking for pthread_create in pthread – found
— Found Threads: TRUE
— Udev rules not being installed, install them with -DINSTALL_UDEV_RULES=ON
— Building with kernel driver detaching disabled, use -DDETACH_KERNEL_DRIVER=ON to enable
— Building for version: v0.5.3-5-g6ee5 / 0.5git
— Using install prefix: /usr/local
— Configuring done
— Generating done
— Build files have been written to: /home/ubuntu/src/rtl-sdr/build
Now we can move on to building the project. Run the make command from that same location as you ran “cmake”.
The output of the make command should be similar to the status information below:
[ 80%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_e4k.c.o
[ 85%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_fc0012.c.o
[ 90%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_fc0013.c.o
[ 95%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_fc2580.c.o
[100%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_r82xx.c.o
Linking C static library librtlsdr.a
[100%] Built target rtlsdr_static
If you set “[100%] Built target rtlsdr_static” such as the end of the output above, then you are ready to move on to the next step; installing it.
After you finish running the install command, you need to setup the lib path. To do this, you need to create a file in the /etc/ld.so.conf.d/ folder. We will use the vi command for this task. We are going to call this file “usr_local_lib.conf”.
In the file, we only need to add one line. this line is: /usr/local/lib
To exit the vi editor, we are going to hit the [Esc] key, followed by shift+:, wq, [Enter].
Once the file has been created, the last step you need to run is the following command. This adds the new lib path to your computer.