 |
Compiling Mathemagix from
its sources |
 |
This section concerns the compilation, installation, or local use of
several Mathemagix packages together, from
sources.
1.Dependencies
For a minimal build of the Mathemagix
interpreter, you will need to ensure that Libtool
has been installed on your system with support for building dynamic
libraries. In addition, you probably want to install Readline, which is convenient if you want to use
the interpreter from a shell.
The other packages of Mathemagix each come with
their specific dependencies; see the package list. The
two most important dependencies are Gmp
and Mpfr, which are required by
almost all other packages. Developers also need to install Autotools, cmake, Doxygen,
and TeXmacs.
2.Downloading from the svn server
The sources of Mathemagix can be downloaded from
the svn server located at http://gforge.inria.fr/projects/mmx/
via the following command:
This will create a mmx directory containing all the
source files.
3.Installation and use via autotools
Mathemagix packages comply with the standard GNU
installation procedure. For a complete description please refer to the
documentation of individual packages. In this section we describe how
several packages can be configured, compiled and installed with the
top level tools available in the mmx directory.
3.1.Configuration
In a text terminal or console, and within the mmx
directory, you can type the following command:
The default list of the packages to be handled is thus printed. The
latter list can be customized thanks to the –enable-package
options. Dependencies are treated automatically. For instance
will build the package algebramix and the interpreter
mmxlight, as well as all dependencies (in this case
basix and numerix). Notice that extra
packages can be enabled a posteriori, simply by redoing a ./configure; this will not recompile the packages
which are already available.
To build Mathemagix on certain architectures you
may need to specify additional include and library paths. For example,
if external dependencies have been installed via Macports
on a MacOS platform then you have to type:
Default installation path is /usr/local/, but you can
customize it with the –prefix option as follows:
In order to build the html documentation, you have to
add the option –enable-doc to the configure
script, but it requires that TeXmacs and Doxygen are installed on your platform. Finally the
list of all configuration options is obtained using:
3.2.Compilation
Once the configuration stage is finished you can start the compilation
and installation by typing:
Please notice that running the make command without
the argument install, in order to launch the sole
compilation, will fail here, because low level (regarding to the
dependency chain) packages must be installed in order to be detected
at the right place by higher level packages.
3.3.Development mode
If you do not want to install Mathemagix, then
you can use it, either to try or to contribute, via the
development mode. First of all, you need to
setup the paths needed for the applications to be built and used
locally, by typing the following command in the mmx
directory:
Then you can proceed to the configuration as explained above with
adding the option –enable-devel, and then type:
This will allow you for instance to run the tests, the benchmarks, and
the interpreter without installation, by typing for instance:
Since Mathemagix consists of several packages,
this development mode is convenient for developers. Indeed, otherwise
reinstalling a package after a modification may cause dependant
packages to be recompiled over and over again. In case you have passed
the –enable-doc option you can build the whole
html documentation by typing make html.
If the one wants to run make in the specific package only then one can type:
The other targets (which behave similarly) are:
-
check [package-check]
-
run the test suite of the package(s).
-
clean [package-clean]
-
clean the package(s).
-
confclean [package-confclean]
-
clean the configuration file of the package(s).
-
dist [package-dist]
-
build the distribution archive .tar.gz for each
selected package.
-
distclean [package-distclean]
-
clean the built files and the Makefile(s).
-
html [package-html]
-
build the html documentation of the package(s).
-
install [package-install]
-
install the package(s) in the directory specified by the option –prefix=... of configure.
-
uninstall [package-uninstall]
-
unsintall the package(s).
4.Configuration and compilation using cmake
Mathemagix packages also comply with cmake building tools. For a complete description please
refer to the documentation of individual packages. In this section we
describe how several packages can be configured, compiled and
installed with the top level tools available in the mmx
directory.
4.1.Configuration
Once the sources are downloaded, you should create a directory
outside the Mathemagix source tree, say
build, where the Mathemagix
packages are going to be compiled. Then you can proceed to the
configuration by running cmake from your build
directory as follows:
where path-to-mmx represents the actual path to the
mmx source directory.
In order to customize and select only some of the packages
(e.g. realroot, mmxlight),
you can add the following kind of options:
To build test files, you have to set -DTEST=ON. The
sources of the test files are located in the subdirectories named test.
The option which controls the construction of the applications
available from the subdirectories called app is APP. The default value is APP=ON. If these
applications are built, then their binaries are put in the folder build/bin.
To construct the glue to the Mathemagix
interpreter, you have to add the option -DGLUE=ON (if
not already set by default). To construct the plugins for Axel, you have to add the option -DAXEL=ON.
In these cases, the dependencies with other packages are checked,
depending on the list pkg.glue and pkg.axel
defined in the file pkg/specif/pkg-cmake.mmx.
In a similar way you can activate the production of the html
documentation by adding -DDOC=ON.
The installation destination can be specified through the variable CMAKE_INSTALL_PREFIX (the default value being /usr/local):
4.2.Compilation
Once configured, you can launch the compilation and installation by
typing:
To see more details on the commands that are run to build files, one
can use the option VERBOSE:
To see the available targets of the make command, use
4.3.Development mode
As described above with the autotools you might
want to use mathemagix without installing it,
either for a simple try or to contribute to it. The development mode
is activated by passing the option -DDEV=ON to cmake. Then you need to setup the
paths needed for using the applications, that will be built
locally, by typing from your build
directory:
The compilation is then performed by simply typing:
As a result, the packages will be configured and compiled
automatically in a suitable order. When done you should have the
binary mmx-light of the interpreter in your path:
Typing 1+1 at the prompt should produce the output 2.
5.Global Variables
The following variables should not be modified, unless you really know
what you are doing.
-
MMX_PREFIX_DIR: prefix used for the installation. If
not set then basix-config –prefix is used by
default.
-
MMX_USER_DIR: path to user's ressources. If not set
then $HOME/.mathemagix is used by default.
-
MMX_SYSCONF_DIR: path to configuration directory. It
is set to $MMX_PREFIX_DIR/etc by default.
-
MMX_LOAD_PATH: path for loading Mathemagix
files. If not set then .:'user_path'/mmx:'prefix_path'/mmx
is used by default.
Beside global variables a global boot file is located at 'prefix_path'/etc/mathemagix/boot.mmx.
It is automatically loaded by mmx-light. At the end,
the latter boot file further loads a user boot file located at $MMX_USER_DIR/etc/boot.mmx. Use the shell option –noboot to disable these loadings.
6.Known problems
-
Within the autotools, the development mode
(i.e. with option –enable-devel
set) does not perfectly behave. In fact, if a version of Mathemagix is already installed on your
system (in /usr/local/ as a default place) then
you must prevent from of accidental linking conflicts by using the
following 'trick':
assuming that /tmp/dummy is an empty directory.
The latter option ensures that no local installation is to be
found in the /tmp/dummy directory, hence
preventing from linking of a library in development with another
one already installed. On the other hand, please never use make install, when in development mode.
-
cmake uses a cache file CMakeCache.txt
to store the values of the configuration variables. Thus if you
need to redo the configuration step from scratch, then you have to
clean this file:
A convenient and safe way is to do it systematically is to use the
following alias:
If on the contrary, you want to keep or edit the configuration
variables, you can use the command ccmake to
access the stored values and edit them.
-
Windows support via MinGW
is still incomplete. You will need to configure using the option –enable-embedded. This will result in one huge
executable to which all individual libraries have been linked
statically. Not all packages have been tested yet too.
-
Under some Linux distributions you may face a problem with SELinux
whenever it is in standard strict mode. Indeed SELinux will prevent
you from loading Mathemagix's dynamic
librairies when in the development mode. As a solution you can go to
your administration / security menu and Allow
the use of shared libraries with Text Relocation. We strongly
recommend you to refer to the SELinux documentation to really know
what this change involves for the global security of your system.
© 2008 Joris van der Hoeven, Grégoire Lecerf, Bernard
Mourrain
Permission is granted to copy, distribute and/or modify this document
under the terms of the
GNU General Public License. If you
don't have this file, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.