Matrix Science header

C++ toolkit installation on Unix
[C++ toolkit installation]

Directory structure

Directory Files Description
compiler/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.
compiler/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.
example_cxx *.cpp
Source code for C++ examples.

Installation and compilation under Linux

Two versions of the libraries are supplied. The libraries in the icc directory are compiled using Intel® C++ Compiler 11.1. The libraries in the gnu directory are compiled using GNU g++ 3.4.6.

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

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

The static library file is compiler/lib/libmsparser.a, while the shared library file is compiler/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/icc/lib:$LD_LIBRARY_PATH

This will add the icc version to LD_LIBRARY_PATH. You also need to make a soft link to the .so file:

    cd /path/to/msparser/icc/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/lib:

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

Static library using Intel C++ Compiler

The library icc/lib/libmsparser.a has been built without -Kpic. On 32-bit Linux, it has been compiled using the Intel C++ library. On 64-bit Linux, it has been compiled using the GNU stdc++ library, as the Intel C++ library cannot be used with 64-bit applications.

A binary can be built that links to all C and C++ libraries statically. For example, to compile an example in the example_cxx directory that statically links to Mascot Parser and all the Intel libraries, use the following command:

    icpc -D__LINUX__ -I../include -i-static resfile_summary.cpp -L../lib -pthread -lmsparser

On 64-bit Linux, you need to define __LINUX64__ instead of __LINUX__:

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

To build a binary that statically links to Mascot Parser and dynamically links to all other libraries:

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

On 64-bit Linux:

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

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++ -m32 -D__LINUX__ -I../include -pthread resfile_summary.cpp -L../lib -lmsparser

This will produce a binary that has no dependencies on any shared libraries. On 64-bit Linux, you need to use slightly different options:

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

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__LINUX__ -I../include resfile_summary.cpp -pthread  -L../lib -lmsparser

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

On 64-bit Linux, you need to use __LINUX64__ instead of __LINUX__:

    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). The dependency on the Intel compiler libraries can again be removed by using the -i-static flag.

Shared library using GNU g++

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

    g++ -m32 -D__LINUX__ -I../include 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).

On 64-bit Linux, slightly different options are needed:

    g++ -m64 -D__LINUX64__ -I../include resfile_summary.cpp -L../lib -lmsparser
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51