These are prerequisites to build NDN-RTC.
Required:
Optional (for ndnrtc-client app only)
NDN-RTC configure variables (expand for more info)
Paths to prerequisites sources and/or libraries can be set during configure phase. Use these variables for NDN-RTC configure script for providing custom paths:
- BOOSTDIR - Path to the directory which contains Boost library headers folder (default is /usr/local/include)
- NDNCPPDIR - Path to the directory which contains NDN-CPP library headers folder (default is /usr/local/include)
- NDNCPPLIB - Path to the directory which contains NDN-CPP library binaries (default is /usr/local/lib)
- OPENFECDIR - Path to the directory which contains OpenFEC library
- OPENFECSRC - Path to the directory which contains OpenFEC library header files (default is $OPENFECDIR/src)
- OPENFECLIB - Path to the directory which contains OpenFEC library binaries (default is $OPENFECDIR/bin/Release)
- WEBRTCDIR - Path to the directory which contains WebRTC trunk
- WEBRTCSRC - Path to the directory which contains WebRTC header files (default is $WEBRTCDIR/webrtc)
- WEBRTCLIB - Path to the directory which contains WebRTC libraries (default is $WEBRTCDIR/out/Release)
- LCONFIGDIR - (Optional) path to the directory which contains libconfig library headers (default is /usr/local/include)
- LCONFIGLIB - (Optional) path to the directory which contains libconfig library binaries (default is /usr/local/lib)
Before building NDN-RTC, we suggest to create a folder for NDN-RTC environment where all prerequisites source code and NDN-RTC source code will be stored and compiled.
#0 NDN-RTC environment (expand for more info)
Eventually, your
ndnrtc-env
should look like this:ndnrtc-env/
depot-tools/
libconfig/
ndn-cpp/
ndnrtc/
ndnrtc/
openfec_v1.4.2/
webrtc-checkout/
mkdir ndnrtc-env && cd ndnrtc-env
export NDNRTC_ENV=`pwd`
#0.5 Out-of-the box prerequisites
These are required prerequisites which can be installed using
homebrew
(macOS) orapt-get
(Ubuntu).
brew install boost cmake wget autoconf automake libtool openssl libconfig nanomsg rocksdb
-- or (for Ubuntu) --
sudo apt-get install libboost-all-dev cmake wget autoconf automake libtool git protobuf-compiler libconfig++-dev libconfig++9v5
Don't forget to complete Before you start step for installing WebRTC prerequisites. Last time checked,
depot-tools
needed to be installed first:cd $NDNRTC_ENV git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git export PATH=$PATH:`pwd`/depot_tools
#1 WebRTC (expand for more info)
Here are detailed and latest instructions on how to build WebRTC. Follow the instructions and build WebRTC branch-heads/59 (Release version).
cd $NDNRTC_ENV
mkdir webrtc-checkout && cd webrtc-checkout/
fetch --nohooks webrtc
cd src
git checkout -b branch-heads-59 refs/remotes/branch-heads/59
gclient sync
// additional step for Ubuntu (expand for more info)
As part of installing prerequisites for WebRTC:
./build/install-build-deps.sh
WebRTC (continuation)
Compilation may take some time
gn gen out/Default --args='is_debug=false'
ninja -C out/Default
// additional step for macOS (expand for more info)
Do this:
mkdir -p out/Default/allibs && for lib in `find out/Default -name "*.a"`; do cp $lib out/Default/allibs/; done;
#2 NDN-CPP (expand for more info)
NDN-RTC uses Boost shared pointers. As NDN-RTC highly relies on NDN-CPP, types of shared pointers used in NDN-CPP and NDN-RTC should be the same. In order to build NDN-CPP with boost shared pointers it's not enough to install them on the system, as NDN-CPP gives priority to
std::shared_ptr
by default.
cd $NDNRTC_ENV
git clone https://github.com/named-data/ndn-cpp
cd ndn-cpp && mkdir -p build/share
// additional step for macOS >= 10.11 (expand for more info)
Depending on your system configuration, you may need to add header and library search paths to your NDN-CPP configuration using
ADD_CFLAGS
,ADD_CXXFLAGS
andADD_LDFLAGS
(createconfig.site
for that). For macOS 10.11 (El Capitan),openssl
library is no longer a default, thus one needs to provide paths, such as:
echo ADD_CFLAGS="-I/usr/local/opt/openssl/include" > build/share/config.site
echo ADD_CXXFLAGS="-I/usr/local/opt/openssl/include" >> build/share/config.site
echo ADD_LDFLAGS="-L/usr/local/opt/openssl/lib" >> build/share/config.site
NDN-CPP (continuation)
Nothing's here 😁
./configure --with-std-shared-ptr=no --with-std-function=no --prefix=$(pwd)/build
make && make install
#3 OpenFEC (expand for more info)
To build OpenFEC, few edits need to be made for src/CMakeLists.txt file (applied as ndnrtc-openfec.patch in instructions below):
- Change line
add_library(openfec SHARED ${openfec_sources})
toadd_library(openfec STATIC ${openfec_sources})
- Change line
target_link_libraries(openfec pthread IL)
totarget_link_libraries(openfec pthread)
- Add line
set(CMAKE_C_FLAGS "-fPIC")
cd $NDNRTC_ENV
wget http://openfec.org/files/openfec_v1_4_2.tgz
tar -xvf openfec_v1_4_2.tgz && rm openfec_v1_4_2.tgz
mkdir -p openfec_v1.4.2/build && cd openfec_v1.4.2/
wget https://raw.githubusercontent.com/remap/ndnrtc/master/cpp/resources/ndnrtc-openfec.patch && patch src/CMakeLists.txt ndnrtc-openfec.patch
cd build/
cmake .. -DDEBUG:STRING=OFF
make
cd $NDNRTC_ENV
git clone --recursive https://github.com/remap/ndnrtc
cd ndnrtc/cpp && mkdir -p build/share
echo 'CPPFLAGS="-g -O2 -DWEBRTC_POSIX" CXXFLAGS="-g -O2 -DWEBRTC_POSIX"' > build/share/config.site
echo NDNCPPDIR=`pwd`/../../ndn-cpp/build/include >> build/share/config.site
echo NDNCPPLIB=`pwd`/../../ndn-cpp/build/lib >> build/share/config.site
echo OPENFECDIR=`pwd`/../../openfec_v1.4.2 >> build/share/config.site
echo WEBRTCDIR=`pwd`/../../webrtc-checkout/src >> build/share/config.site
./configure --prefix=$(pwd)/build
make && make install
Headless client (expand for more info)
If you want to build headless client application, make sure you have succesfully installed libconfig.
make ndnrtc-client