Skip to content

Instantly share code, notes, and snippets.

@timcardenuto
Last active July 14, 2020 11:26
Show Gist options
  • Save timcardenuto/776c107a0c1e26722c1bebcc93a31b4f to your computer and use it in GitHub Desktop.
Save timcardenuto/776c107a0c1e26722c1bebcc93a31b4f to your computer and use it in GitHub Desktop.
Redhawk on CentOS 8

Redhawk on CentOS 8

Setup / Dependencies

Enable PowerTools repo:

$ sudo sed -i "s/enabled=0/enabled=1/g" /etc/yum.repos.d/CentOS-PowerTools.repo

Enable EPEL repo:

$ sudo dnf -y update
$ sudo dnf -y install epel-release

Install some deps:

$ sudo dnf -y install bzip2 gcc-c++ make libtool expat-devel python2 python2-devel xsd apr-devel apr-util-devel sqlite-devel libuuid-devel boost-devel git
$ sudo ln -s python2 /usr/bin/python
$ pip2 --user install numpy lxml

Build/install omniORB

$ curl -L https://sourceforge.net/projects/omniorb/files/omniORB/omniORB-4.2.4/omniORB-4.2.4.tar.bz2/download --output omniORB-4.2.4.tar.bz2
$ tar -xjf omniORB-4.2.4.tar.bz2
$ cd omniORB-4.2.4
$ ./configure
$ make -j4
$ sudo make install
$ cd ../

Build/install omniEvents:

$ git clone https://github.com/RedhawkSDR/omniEvents.git
$ cd omniEvents
$ ./configure
$ make -j4
$ sudo make install
$ cd ../

Build/install omniORBpy

$ sudo curl -L https://sourceforge.net/projects/omniorb/files/omniORBpy/omniORBpy-4.2.4/omniORBpy-4.2.4.tar.bz2/download --output omniORBpy-4.2.4.tar.bz2
$ tar -xjf omniORBpy-4.2.4.tar.bz2
$ cd omniORBpy-4.2.4
$ ./configure
$ make -j4
$ sudo make install
$ cd ../

Build/install log4cxx:

$ sudo curl -L https://github.com/apache/logging-log4cxx/archive/master.zip --output logging-log4cxx-master.zip && \
unzip logging-log4cxx-master.zip
$ cd logging-log4cxx-master
$ ./autogen.sh
$ ./configure
$ make -j4
$ sudo make install
$ cd ../

Build/install cppunit:

$ sudo curl -L https://sourceforge.net/projects/cppunit/files/cppunit/1.12.1/cppunit-1.12.1.tar.gz/download --output cppunit-1.12.1.tar.gz
$ tar -zxf cppunit-1.12.1.tar.gz
$ cd cppunit-1.12.1
$ ./configure
$ make -j4
$ sudo make install
cd ../ 

Evironment variables:

$ export PATH=$PATH:/usr/local/redhawk/core/bin
$ export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/redhawk/core/lib
$ export PYTHONPATH=/usr/local/lib/python2.7/site-packages:/usr/local/lib64/python2.7/site-packages:/usr/local/redhawk/core/lib/python
$ export OSSIEHOME=/usr/local/redhawk/core
$ export SDRROOT=/var/redhawk/sdr
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ export JAVA_HOME=/usr/lib/jvm/java

Patches

Pull the source code for Redhawk 2.2.6 and fix some aclocale issues first so you can actually run make and see errors:

$ curl -L -O https://github.com/RedhawkSDR/redhawk/releases/download/2.2.6/redhawk-src-2.2.6.tar.gz && \
$ tar -zxf redhawk-src-2.2.6.tar.gz && \
$ cd redhawk-src-2.2.6/
$ grep -rl "aclocal -I" . | xargs sed -i 's/aclocal -I \${OSSIE_AC_INCLUDE}/aclocal -I \${OSSIE_AC_INCLUDE} -I \/usr\/local\/share\/aclocal/g'
$ grep -rl "aclocal -I" . | xargs sed -i 's/aclocal -I acinclude/aclocal -I acinclude -I \/usr\/local\/share\/aclocal/g'
$ grep -rl "ACLOCAL_AMFLAGS = " . | xargs sed -i 's/^ACLOCAL_AMFLAGS = -I m4 -I \${OSSIEHOME}\/share\/aclocal\/ossie/ACLOCAL_AMFLAGS = -I m4 -I \${OSSIEHOME}\/share\/aclocal\/ossie -I \/usr\/local\/share\/aclocal/g'
$ grep -rl "ACLOCAL_AMFLAGS = " . | xargs sed -i 's/^ACLOCAL_AMFLAGS = -I m4 -I\${OSSIEHOME}\/share\/aclocal\/ossie/ACLOCAL_AMFLAGS = -I m4 -I\${OSSIEHOME}\/share\/aclocal\/ossie -I \/usr\/local\/share\/aclocal/g'

I also disable java build since I'm really just trying to update C++ and build the core stuff (I never use Java anyway).

$ sed -i "s/configure/configure --disable-java/g" redhawk-install.sh

At this point you could just build the source using C++98 and everything should go fine:

$ CXXFLAGS="--std=gnu++98"
$ ./redhawk-install.sh

However we want to use C++14 instead, since it's the default for GCC 8.3 which is the version on CentOS 8. To build to this C++ version you need a few mods to get rid of errors and optionally warnings. A fork of Redhawk with these patches is here. A description of each issue is attempted here:

  1. Error in redhawk/src/control/framework/nodebooter.cpp logging message at line 144:
    LOG_ERROR(nodebooter, "Failed to parse PRF file " << prfStream<< ". " << parser_error_line << "The XML parser returned the following error: " << ex.what());
    Should be:
    LOG_ERROR(nodebooter, "Failed to parse PRF file " << prfFile << ". " << parser_error_line << "The XML parser returned the following error: " << ex.what());
  2. Error in GPP/cpp/GPP.cpp and redhawk/src/testing/sdr/dev/devices/GPP/cpp/GPP.cpp:
    errstr << "Unable to read "<<stat_filename<<". The process is no longer there";
    Changed to:
    errstr << "Unable to read "<<stat_filename.str()<<". The process is no longer there";
  3. There were 2 errors in redhawk/src/control/sdr/dommgr/ApplicationFactory_impl.cpp related to an error log message at line 1922 and 1990. I just commented them out, but should be fixed.
    RH_ERROR(_createHelperLog, message);

The following mods were needed to remove warnings and improve the code. Some of these end up being errors in C++17 or newer standards so they need to be fixed eventually anyway.

  1. Removed all throw from function definitions based on dynamic exception specifications warnings. Turning things like this:

    void FileManager_impl::mount (const char* mountPoint, CF::FileSystem_ptr fileSystem)
        throw (CORBA::SystemException, CF::InvalidFileName,
               CF::FileManager::InvalidFileSystem, CF::FileManager::MountPointAlreadyExists)
    {
    ...

    Into this:

    void FileManager_impl::mount (const char* mountPoint, CF::FileSystem_ptr fileSystem)
    {
    ...
  2. Fixed catch statements that throw catching polymorphic type warnings by replacing things like this:

    catch(boost::bad_lexical_cast){
    }

    With this:

    catch(const boost::bad_lexical_cast &){
    }
  3. Converted std::auto_ptr to std::unique_ptr. See here. You can do this with a basic find/replace accross all files:

    $ grep -rl "std::auto_ptr" . | xargs sed -i 's/std::auto_ptr/std::unique_ptr/g'

    Then wherever a copy of these pointer is made you'll need to use the std::move function. For example, converting this function within DomainManagerConfiguration.cpp:

    DomainManagerConfiguration& DomainManagerConfiguration::operator=(DomainManagerConfiguration other) {
        // Pass ownership
        this->_dmd = std::move(other._dmd);
        return *this;
    }

    Into this:

    DomainManagerConfiguration& DomainManagerConfiguration::operator=(DomainManagerConfiguration other) {
        // Pass ownership
        this->_dmd = std::move(other._dmd);
        return *this;
    }

    You'll also need to initialize unique_ptr objects with nullptr instead of 0 (i.e. NULL). Based on info here. From:

    optional_property() : _p(0) {
    }

    To:

    optional_property() : _p(nullptr) {
    }

    This has to be done in a number of places. The compiler errors make it pretty clear where these issues are. There are a few pointers that couldn't be converted because of the issue below related to boost.

  4. Convert use of boost::ptr_map to normal std::map. This should be possible once you've converted to using std::unique_ptr instead of std::auto_ptr. See more info here. It seems like the definitions are in redhawk/src/control/include/ossie/ossieparser.h. I left them alone b/c I didn't want to do all this work right now... Once this is fixed the last few std::auto_ptr can be replaced within the files spd-pimpl.cpp, prf-pimpl.cpp, sad-pimpl.cpp, scd-pimpl.cpp, dcd-pimpl.cpp and dmd-pimpl.cpp.

Install

With all the patches done you can just build/install like this:

$ ./redhawk-install.sh

You might have to run as root for the 'install' part to work unless you pre-create and change permissions for certain directories.

Test

Running the test_GPP.py test script on this build:

Ran 37 tests in 185.819s
FAILED (failures=2, skipped=7)

Running the runtests.py test script on this build:

Ran 1014 tests in 2363.660s
FAILED (failures=4, errors=11, skipped=88)

Assets

Building the Redhawk assets with C++14 also requires some mods.

dsp

Deps:

$ sudo dnf install fftw-devel

Patches:

  1. The following error:
    ./include/am_fm_pm_baseband_demod.h:38:23: error: ‘constexpr’ needed for in-class initialization of static data member ‘const Real AmFmPmBasebandDemod::oneOver2Pi’ of non-integral type [-fpermissive]
         static const Real oneOver2Pi=1.0/(2*M_PI);
    Fixed by following advice here, and replacing the line with:
     static constexpr Real oneOver2Pi=1.0/(2*M_PI);
  2. The following error:
    /usr/include/boost/bind/bind.hpp:309:42: error: no match for call to ‘(boost::_mfi::mf1<float, LanczosKernel<float, float>, float&>) (LanczosKernel<float, float>*&, float)’
    	 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
    Appears to come from src/resampler.cpp, the usage of boost::bind... Not really sure how to fix this.
    ArbitraryRateResamplerClass::ArbitraryRateResamplerClass(float inputRate,
    														 float outputRate,
    														 size_t a,
    														 size_t quantizationPts,
    														 std::vector<float>& real_out,
    														 std::vector<std::complex<float> >& complex_out,
    														 float* startTime,
    														 std::deque<float>* realHistory,
    												 std::deque<std::complex<float> >* cmplxHistory):
    	kernel(a),
    	cache(boost::bind(&LanczosKernel<float,float>::getValue,&kernel, _1), quantizationPts, -a, a),
    	inRate(inputRate),
    	outRate(outputRate),
    	rateFactor(inputRate/outputRate),
    	filterDelay(-float(a)/inputRate),
    	realOut(real_out),
    	cmplxOut(complex_out)
    {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment