1

I am interested in using a newer compiler than gcc 4.4.7 that comes with CentOS 6. I need to use C++11 features and so need a gcc 4.8+ version. I find that there are rpm's that can load devtoolset-2 that contains gcc4.8.2 and related required libraries, etc. And I can switch the compiler to use using scl enable, thus not burning my bridges. I loaded this and tried it with RedHawk 2.0 and it appear much works but that there are problems with the header files for the boost libraries. RedHawk install appears to use libboost with a mix of 1.48 and 1.41 from 2011 and 2009. The current boost is 1.60.

I have also built and installed RedHawk on Ubuntu when has gcc 4.8.4 and libboost1.54. So RedHawk apparently can work with the newer gcc and boost, but I am concerned that the RedHawk binaries on CentOS 6 are dependent on the boost library version. And I do not see a way to install a newer boost that allows me to switch back and forth as the devtoolset allows.

Am I likely to have to rebuild RedHawk 2.0 from sources rather than using the rpms if I switch to a newer boost?

Terry L Anderson
  • 263
  • 1
  • 11

1 Answers1

1

I believe you will need to build REDHAWK from source if you intend to use a different version of boost then what is installed by default on the system. There may be other ways to get it working but building from source would be the cleanest, most straightforward approach.

One of the reasons why this is necessary is that the component you build is compiling and linking against the core framework. The rpm installed version of the core framework is linked against the system installed version of boost so your component is also linked against the system install of boost and while you may be able to compile and link against a 2nd version of boost this can cause runtime issues that are difficult to debug. You can confirm what a binary is linked to using "ldd". For example the most basic component, HardLimit, is linked against boost threading, regex, system, filesystem, and serialization.

To confirm it was possible, I built and installed the latest boost (1.60.0) from source and then was able to build the 2.0.0 framework against that. I installed the boost 1.60 libraries into the default location of /usr/local so when I configured my source build of REDHAWK I provided:

./configure --with-boost=/usr/local --with-boost-libdir=/usr/local/lib

Note that if you have xsd 4.0 installed, the framework will claim it requires 3.3. xsd 4.0 was released after the 2.0 release and xsd3.3 was removed from epel. To get around this, you can simply edit the configure.ac file to not check for a specific version of xsd and rerun the reconf script. The version of xsd in epel is backwards compatible and will work with 2.0.

I built the framework with the system installed version of gcc/g++. If you are building the framework with your scl version of g++ you'll need to see this ticket

I then built bulkio, again using the same configure line as stated above and again with the system installed version of gcc / g++.

Finally you can install your scl versions of g++, enable them, and configure and build a component with c++11 support with the following:

./configure --with-boost=/usr/local --with-boost-libdir=/usr/local/lib CXXFLAGS='-g -O2 -std=c++11'

I choose to build SigGen, and ran the unit test to confirm operation. Just make sure that your boost library installation is on the LD_LIBRARY_PATH (in my case that is /usr/local/lib) prior to running.

Youssef Bagoulla
  • 1,229
  • 1
  • 7
  • 16