GRAndBuild

From GNU Radio
Revision as of 07:40, 20 March 2017 by Devnulling (talk | contribs) (Update formatting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Building GNU Radio for Android and GRAnd

Make sure you've looked at the Setup and Building the Dependencies page first.

It's important that you have created the Android stand-alone toolchain and have the environmental variable ANDROID_STANDALONE_TOOLCHAIN set to point here. The AndroidToolchain.cmake file uses this in all of the following projects.

Dependencies Build Script

Remember, you can use the Build Script to automatically build all of these dependencies. See the information on the Setup and Building the Dependencies page for more details on this script.

VOLK

We'll first build VOLK separately instead of as a GNU Radio submodule. This will just provide us greater control over the configuration and make any problems easier to address.

git clone https://github.com/trondeau/volk.git
cd volk
git checkout android
mkdir build; cd build
cmake -DCMAKE_INSTALL_PREFIX=$PREFIX \
  -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/AndroidToolchain.cmake \
  -DPYTHON_EXECUTABLE=/usr/bin/python \
  -DENABLE_STATIC_LIBS=True \
  ../
make
make install

GNU Radio

Check out the android branch of GNU Radio and build it.

If you are interested in UHD support, see GRAndRFE#UHD and change the -DENABLE_GR_UHD to True in the cmake command below. If Cmake has trouble finding a properly built and installed UHD, first try removing CMakeCache.txt from the build directory and rerunning. If things still don't work, add the argument -DUHD_DIR=$PREFIX/lib/cmake/uhd to try and help Cmake find the library built for Android.

git clone --recursive git://git.gnuradio.org/gnuradio.git
cd gnuradio
git checkout android
mkdir build
cd build
cmake \
    -Wno-dev \
    -DCMAKE_INSTALL_PREFIX=$PREFIX \
    -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchains/AndroidToolchain.cmake \
    -DENABLE_INTERNAL_VOLK=Off \
    -DBOOST_ROOT=$PREFIX \
    -DFFTW3F_INCLUDE_DIRS=$PREFIX/include \
    -DFFTW3F_LIBRARIES=$PREFIX/lib/libfftw3f.a \
    -DFFTW3F_THREADS_LIBRARIES=$PREFIX/lib/libfftw3f_threads.a \
    -DENABLE_DEFAULT=False \
    -DENABLE_GR_LOG=False \
    -DENABLE_VOLK=True \
    -DENABLE_GNURADIO_RUNTIME=True \
    -DENABLE_GR_BLOCKS=True \
    -DENABLE_GR_FFT=True \
    -DENABLE_GR_FILTER=True \
    -DENABLE_GR_ANALOG=True \
    -DENABLE_GR_DIGITAL=True \
    -DENABLE_GR_CHANNELS=True \
    -DENABLE_GR_ZEROMQ=True \
    -DENABLE_GR_UHD=True \
    -DENABLE_STATIC_LIBS=True \
    -DENABLE_GR_CTRLPORT=True \
    ../
make
make install

Build GRAnd - The GNU Radio for Android Project

I create a env variable TOOLCHAIN to point to the toolchain file from GNU Radio:

export TOOLCHAIN=/cmake/Toolchains/AndroidToolchain.cmake
git clone git://github.com/trondeau/gr-grand.git
cd gr-grand
mkdir build
cd build
cmake \
 -DCMAKE_INSTALL_PREFIX=$PREFIX \
 -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN \
 -DPYTHON_EXECUTABLE=/usr/bin/python \
 ../
make
make install

GR-OSMOSDR

Again, we'll use trondeau's fork of gr-omsosdr that includes a set of patches to work with our edited libusb and rtl-sdr library for the USB permissions. This branch also cleans up a few other features necessary to build a static library out of the project.

git clone https://github.com/trondeau/gr-osmosdr.git
cd gr-osmosdr
git checkout android5
mkdir build; cd build
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
cmake -DCMAKE_INSTALL_PREFIX=$PREFIX \
  -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN \
  -DENABLE_UHD=True -DENABLE_FCD=False -DENABLE_RFSPACE=False \
  -DENABLE_BLADERF=False -DENABLE_HACKRF=False -DENABLE_OSMOSDR=False \
  -DENABLE_RTL_TCP=False -DENABLE_IQBALANCE=False \
  -DBOOST_ROOT=$PREFIX \
  ../
make
make install