Building MPSolve
MPSolve can be built with or without some optional modules. Moreover, runtime detection of the libraries installed on the system is performed via the configure script, so some components may not be built if the required software is not installed.
This page is aimed as a brief guide of the various options.
General instructions
The general procedure to build MPSolve is to follow these steps:
- Extract the MPSolve tarball. For example, for version 3.1.1:
tar xvzf mpsolve-3.1.1.tar.gz
. - Run the configure script in the source directory:
cd mpsolve-3.1.1 && ./configure
- If it does run well, type
make
to compile the software, otherwise install the missing libraries and go back to step 2.
Note that if you install missing dependencies to build additional modules (as explained below) you will need to run the configure script again for MPSolve to detect them.
Once the command make
completes successfully you will find the built executables in the src/
and in the examples/
folder.
After a succesfull compilation you may proceed with the command sudo make install
to globally install MPSolve on your system. This is usually discouraged by GNU/Linux distribution (for good reasons). If possible, you should rely on distribution packages where available. If you run sudo make install
and install the software in /usr/local/lib
then run sudo ldconfig
to update your ld cache (it may not be necessary, but it does not hurt).
Note, however, that while you can use MPSolve from the tarball without installing it (by executing ./src/mpsolve/mpsolve
or ./src/xmpsolve/xmpsolve
, for example) you may need some trickery to use the Matlab ™ and Octave modules.
Usually, the following steps work:
- Export an environment variable that specifies where the
libmps
library is located: export LD_LIBRARY_PATH=”/path/to/mpsolve/src/libmps/.libs” - Go to the directory where the module has been compiled (say,
examples/matlab
, or copy it to your current directory. Launch Matlab™ or Octave from that directory.
Modules
MPSolve is composed by the following modules:
libmps
is the library that contains the algorithms and is the core of the software. This is always built and requires only a C compiler and GMP.mpsolve
is the main executable that provides a command line interface to libmps. This is alwasy built and has the same requirements oflibmps
. It has an optional component, though, that display visually the convergence path of the approximations and can be invoked with the option-x
at command line.xmpsolve
is a simple graphical interface tolibmps
, not (yet) as feature complete asmpsolve
, but useful for rapid experiments with the software.- There are additional interfaces for MATLAB ™, GNU Octave, Fortran and Python.
- Finally, some examples are placed in the folder
examples
.
Module dependencies
The bare minimum requirements to build MPSolve are the following:
- A C compiler with some C99 capabilities (namely variadic macros). It should be possible to build MPSolve with an ANSI C compiler but is currently an untested and unsupported procedure.
- The GMP library. If you use a custom build of GMP you can set the environment variables GMP_LIBS and GMP_CFLAGS according to your setup. Say, for example, that you have build (and not installed) GMP in
/home/user/gmp-5.1.0
. You can used that version of GMP by executing the following commands:export GMP_LIBS=”-L/home/user/gmp-5.1.0/.libs -lgmp” export GMP_CFLAGS=”-I/home/user/gmp-5.1.0/” ./configure make The following libraries, instead, allow to build more modules: - GTK+ is used to build the graphical debugger in
mpsolve
, that allows to visually track the approximations during the iterations. Moreover the exampleroots_of_unity
in the folderexamples/GTK
will be built if GTK+ are available. Note that both GTK+-2.0 and GTK+-3.0 are supported, but if you are using GTK+-2.0 you must also havelibcairo
installed on the system. That should be automatically installed on recent distributions, but you might have to manually install it on older ones. To install these dependencies in Ubuntu you can use the command sudo apt-get install libgtk-3-dev or, if your distrubution is older than Ubuntu 11.10, sudo apt-get install libgtk2.0-dev libcairo2-dev - Qt4 can be used to build the executable
xmpsolve
that provides a simple graphical interface tolibmps
. To install it under Ubuntu, use the following command:sudo apt-get install libqt4-dev This should work on all the supported version. If it does not, please report a bug clicking on New ticket above.
- A Matlab ™ module will be compiled in case Matlab is installed and the
mex
compiler’s executable is in your path. - A GNU Octave module will be built if you have the
mkoctfile
command and a recent version of Octave (>= 3.0.0). To install all the necessary dependencies in Ubuntu you can run sudo apt-get install liboctave-dev or, on older releases, sudo apt-get install octave3.2-headers - If you have a Fortran compiler then the example in
examples/fotran
will be built that shows how to use MPSolve from Fortran in a simple way. - A Python module will be built if Python and Cython are found on the system. You can get this on Ubuntu and Debian machines with the command sudo apt-get install cython python-dev
Debugging configuration issues
When you are done installing the dependencies, you should run the configure
script that you find in the tarball distribution. After it completes it will print a short summary of the components that will be built and the one that are disabled. You can check that alle the modules that you need are marked as “yes” in that summary. Otherwise, check in the messages that are printed above to understand why they were not included.