Damaris Compilation

This quick document, help Damaris developers to compile Damaris on their machine. Before compiling, make sure that all of the needed libraries are installed on your machine. If you have not installed them yet, refer to this document to prepare your environment. If you are going to build Damaris using an IDE, here are the instructions for CLion IDE.

1. Preparation

Before compiling damaris, you should update your PATH and LD_LIBRARY_PATH environment variables to include the bin and lib folders of your installed libraries. A typical update can be like this:

$ export PATH=$PATH:$install_path/bin
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$install_path/lib

2. Compilation

When these configurations are done, make sure your current directory is Damaris’ root source directory and type the following commands. These commands first create a new directory for building Damaris and then run cmake on the source. In the following command, it is assumed that all of the needed libraries are installed in $install_path directory. If that is not the case, just mention the installation path of each library separately.

Note: by setting BUILD_SHARED_LIBS option to ON, Damaris is build inside a shared library (i.e. an .so file).

$ mkdir damaris-build
$ cd damaris-build
$ cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$install_path \
	-DBOOST_ROOT=$install_path \
	-DXSD_ROOT=$install_path \
	-DXERCESC_ROOT=$install_path \
	-DCppUnit_ROOT=$install_path \
	-DHDF5_ROOT=$install_path \
        -DVisIt_ROOT=$install_path \

This will generate the Makefile to compile Damaris with all the dependencies (VisIt, ParaView, HDF5) enabled. Go on with running the following commands:

$ make
$ make install

You’re done! Check your $HOME/local, you should see Damaris.h in the include directory, as well as a damaris directory, and libdamaris.a in the lib directory. If Damaris has been compiled with Fortran support, a damaris.mod file is also present in the target install directory.

3. Common Build Issues

During the compilation process, you may face several issues. In this section, all the issues that has been faced so far will be briefed and the solution will be explained.

Issue 1 – cannot open shared library

Sometimes you may face some issues regarding not finding proper libraries such as libxerces-c-3.1.so. The main problem with these libraries is that your /lib folder in your installation directory is not added to your LD_LIBRARY_PATH variable. One error message could be like this:

Scanning dependencies of target XSDModel
[ 2%] Generating C++/XML mapping
/home/hadi/local/bin/xsd: error while loading shared libraries: libxerces-c-3.1.so: cannot open shared
object file: No such file or directory
make[2]: *** [src/model/Model.cpp] Error 127
lib/CMakeFiles/XSDModel.dir/build.make:51: recipe for target 'src/model/Model.cpp' failed
make[1]: *** [lib/CMakeFiles/XSDModel.dir/all] Error 2
make: *** [all] Error 2
CMakeFiles/Makefile2:76: recipe for target 'lib/CMakeFiles/XSDModel.dir/all' failed
Makefile:127: recipe for target 'all' failed

This error could be easily fixed by running:

$ export LD_LIBRARY_PATH=/damaris/installation/path/lib:$LD_LIBRARY_PATH
Issue 2 – undefined reference to some boost functions

If you faced some issues at link time with such kind of messages:

In function `code_convert<wchar_t, char, std::char_traits<char>, std::allocator<char> >':
/home/user/local/include/boost/log/detail/code_conversion.hpp:133: undefined reference to
`boost::log::v2s_mt_posix::aux::code_convert_impl(wchar_t const*, unsigned long, std::string&, unsigned long, std::locale const&)'

There may be two main problems:

  • You probably have two versions of boost installed on your machine (usually on CentOS) and the boost header files are included from one version and the libraries from the other version. So, the resolution is to either remove the old version or fix your binary and include paths.
  • If you are linking statically to boost, remove all boost.so files from your lib folder. This may fix the issue sometimes.
Issue 3 – loading the transcoders

Sometimes, when compiling Damaris, you may encounter this problem:

Scanning dependencies of target XSDModel
[2%] Generating C++/XML mapping
Could not load a transcoding service
lib/CMakeFiles/XSDModel.dir/build.make:51: recipe for target 'src/model/Model.cpp' failed
make[2]: *** [src/model/Model.cpp] Error 255
CMakeFiles/Makefile2:76: recipe for target 'lib/CMakeFiles/XSDModel.dir/all' failed
make[1]: *** [lib/CMakeFiles/XSDModel.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

This problem was faced on openSUSE Leap-42.2 with gcc 4.8. The root cause of this issue on openSUSE is that on the official distribution of the image on docker hub, no default locale is defined in the image, so the transcoder cannot find the source locale. To fix this problem just initiate the current locale as en_US.UTF-8 like:

$ export LANG=en_US.UTF-8

and after running this command you should see the result as UTF-8.

$ locale charmap
Issue 4 – not finding some libraries while compilation

In some Linux distributions like openSUSE 11.04 some dependent libraries are created inside a folder namely lib64 instead of lib. So, in this case, make sure that add this folder in to the LD_LIBRARY_PATH variable as well.

Issue 5 – not finding HDF5

If while making Damaris you found that Damaris makefile cannot find HDF5, put the /bin directory of HDF5 in the PATH variable.

Comments are closed.