Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
C++ toolkit installation on Unix

Directory structure

Directory Files Description
gnu/include msparser.hpp and a number of other include files. You only need to #include "msparser.hpp" – this includes the other files. Make sure that this directory is on your include path.
gnu/lib libmsparser.a Static library for C++ development, and can be linked against as long as one of the supported compilers is used.
libmsparser.so.1 Shared library for C++ development, and can potentially be used by compilers other than mentioned here.
gnu/example_cxx *.cpp
Source code for C++ examples.

Installation and compilation under Linux

One version of the libraries is supplied. The libraries in the gnu directory are compiled using GNU g++ 5.5.0. These are compatible with both GNU g++ 5.5.0 or later and the Intel® C++ Compiler if you use GCC 5.5.0 or later as the underlying toolchain.

There are four ways to link Mascot Parser in your program:

  1. Static library using GNU g++
  2. Static library using Intel® C++ Compiler
  3. Shared library using GNU g++
  4. Shared library using Intel® C++ Compiler

The static library file is gnu/lib/libmsparser.a, while the shared library file is gnu/lib/libmsparser.so.1. To use libmsparser.so.1 in its existing directory, simply add the directory to LD_LIBRARY_PATH. Under bash and sh, for example, you can do:

    export LD_LIBRARY_PATH=/path/to/msparser/gnu/lib:$LD_LIBRARY_PATH

You also need to make a soft link to the .so file:

    cd /path/to/msparser/gnu/lib
    ln -s libmsparser.so.1 libmsparser.so

Remove the soft link if you want to revert to using the static library.

Optionally, you can install the shared library in /usr/local/lib:

  1. cp libmsparser.so.1 /usr/local/lib
  2. cd /usr/local/lib
  3. ln -s libmsparser.so.1 libmsparser.so
  4. ldconfig -v

Static library using GNU g++

To compile the example code in the example_cxx directory and statically link to Mascot Parser, use the following command:

    g++ -m64 -D__LINUX64__ -D_GLIBCXX_USE_CXX11_ABI=0 -I../include -pthread -static resfile_summary.cpp -L../lib -lmsparser

This will produce a binary that has no dependencies on any shared libraries.

Static library using IntelĀ® C++ Compiler

The library gnu/lib/libmsparser.a has been built without -Kpic. It has been compiled using the GNU stdc++ library.

It may be possible to build a binary that links to all C and C++ libraries statically using the Intel® C++ Compiler (Parallel Studio or OneAPI). The Intel® C++ compiler is binary compatible with libraries compiled with GCC 5.5.0 or later. Please consult the Intel® compiler documentation for suitable command-line arguments and switches.

Shared library using GNU g++

To compile the example code in the example_cxx directory, use the following command:

    g++ -m64 -D__LINUX64__ -D_GLIBCXX_USE_CXX11_ABI=0 -I../include -pthread resfile_summary.cpp -L../lib -lmsparser

This will produce a binary that has dependencies on libmsparser.so and on the GNU stdc++ and C libraries (use ldd a.out to list the dependencies). In some versions of GCC, you may also need to use the flag -static-libstdc++ to link statically to the GNU stdc++ library.

Shared library using IntelĀ® C++ Compiler

To compile the example code in the example_cxx directory and dynamically link to Mascot Parser, use the following command:

    icpc -D__LINUX64__ -I../include resfile_summary.cpp -pthread  -L../lib -lmsparser

This will produce a binary that has dependencies on libmsparser.so, the Intel® compiler libraries, libstdc++ and glibc (use ldd a.out to list the dependencies). In some versions of the compiler, the dependency on the Intel® compiler libraries can again be removed by using the -i-static flag.