Building mlpack From Source
mlpack uses CMake as a build system and allows several flexible build configuration options. One can consult any of numerous CMake tutorials for further documentation, but this tutorial should be enough to get mlpack built and installed.
Once the mlpack source is unpacked, you should create a build directory.
$ cd mlpack-1.0.3 $ mkdir build
The directory can have any name, not just 'build', but 'build' is sufficient enough.
mlpack depends on the following libraries, which need to be installed on the system and have headers present:
- Armadillo >= 2.4.0
- Boost (math_c99, program_options, unit_test_framework, random)
In Ubuntu and Debian, you can get all of these dependencies through apt:
# apt-get install libboost-math-dev libboost-program-options-dev libboost-random-dev libboost-test-dev libxml2-dev libarmadillo-dev
If you are using an Ubuntu version older than 12.04 ("Precise Pangolin") or Debian older than Wheezy, you will have to compile Armadillo from source. See the README.txt distributed with Armadillo for more information.
On Fedora, Red Hat, or CentOS, these same dependencies can be obtained via yum:
# yum install boost-devel boost-random boost-test boost-program-options boost-math libxml2-devel armadillo-devel
On Red Hat Enterprise Linux 6 and older (as well as CentOS 6), the Armadillo version available is too old and must be compiled by hand. The same applies for Fedora 16 and older.
Running CMake is the equivalent to running `./configure` with autotools. If you run CMake with no options, it will configure the project to build with debugging symbols and profiling information:
$ cd build $ cmake ../
You can specify options to compile without debugging information and profiling information (i.e. as fast as possible):
$ cd build $ cmake -D DEBUG=OFF -D PROFILE=OFF ../
The full list of options mlpack allows:
- DEBUG=(ON/OFF): compile with debugging symbols (default ON)
- PROFILE=(ON/OFF): compile with profiling symbols (default ON)
- ARMA_EXTRA_DEBUG=(ON/OFF): compile with extra Armadillo debugging symbols (default OFF)
Each option can be specified to CMake with the '-D' flag. Other tools can also be used to configure CMake, but those are not documented here.
Once CMake is configured, building the library is as simple as typing 'make'. This will build all library components as well as 'mlpack_test'.
$ make Scanning dependencies of target mlpack [ 1%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/optimizers/aug_lagrangian/aug_lagrangian_test_functions.cpp.o <...>
You can specify individual components which you want to build, if you do not want to build everything in the library:
$ make pca allknn allkfn
If the build fails and you cannot figure out why, register an account on Trac and submit a ticket and the mlpack developers will quickly help you figure it out:
Alternately, mlpack help can be found in IRC at #mlpack on irc.freenode.net.
If you wish to install mlpack to /usr/include/mlpack/ and /usr/lib/ and /usr/bin/, once it has built, make sure you have root privileges (or write permissions to those two directories), and simply type
# make install
You can now run the executables by name; you can link against mlpack with -lmlpack, and the mlpack headers are found in /usr/include/mlpack/.
Generated on Thu May 2 2013 01:04:28 for mlpack by 1.7.1