Installation with Cmake (experimental)¶
Standard install¶
Note: Ibex can either be compiled with Gaol or Filib . The library installed by default is Gaol, since our experiments have shown that this library prevails over the others. So the standard installation will automatically extract and build the Gaol library (and its dependencies) from the bundle. However, because of some installation problems with Gaol under Windows, the library installed by default under this platform as of today is Filib (this will be changed in the future).
Linux and MacOS¶
If you are on MacOS and use the MacPorts package manager, you can install Ibex by simply executing:
sudo port install ibex-lib
Otherwise, you can install Ibex from source with the following instructions. The installation assumes your system meets some requirements.
Save the archive ibex-2.8.8.tar.gz
in some Ibex
folder and:
~/Ibex$ tar xvfz ibex-2.8.8.tar.gz
~/Ibex$ cd ibex-2.8.8
~/Ibex/ibex-2.8.8$ mkdir build
~/Ibex/ibex-2.8.8/build$ cd build
~/Ibex/ibex-2.8.8/build$ cmake ..
~/Ibex/ibex-2.8.8/build$ make
~/Ibex/ibex-2.8.8/build$ sudo make install
If you want to install Ibex in a local folder, use -DCMAKE_INSTALL_PREFIX
, ex:
~/Ibex/ibex-2.8.8/build$ cmake -DCMAKE_INSTALL_PREFIX=$HOME ..
See the options. The folder full path must not contain any white space or wierd characters like '"\()`*[]
.
Windows¶
(to be completed)
Requirements¶
The following applications must be installed.
g++
gcc
flex
bison
cmake
pkg-config (optionnal)
On Ubuntu, you can install all you need with:
~$ sudo apt-get install -y g++ gcc flex bison cmake pkg-config
Configuration options¶
cmake
supports the following options:
Option |
Description |
---|---|
CMAKE_INSTALL_PREFIX |
Ex: Set the folder where Ibex must be installed (by default, Warning The full path of the folder must not contain white space or weird characters like |
INTERVAL_LIB |
Ex: Set the underlying interval library. Possible values are either TODO: |
LP_LIB |
Ex: Set the linear programming library. Possible values are either
If you install your own version of Soplex, use the make ZLIB=false
and if Ibex is installed as a dynamic library ( make ZLIB=false SHARED=true
Under Windows, add also Note
|
GAOL_DIR |
Ex: Set the path of Goal when using Ibex with your own version of Goal. Note that the plugin archive embeds a version of Gaol so it is not necessary to have Goal already installed on your system. Default value is “” (means: use embedded version). Only to be used with |
MATHLIB_DIR |
Ex: Set the path of Mathlib when using Ibex with your own version of Goal. Mathlib is a tierce library required by Gaol. Note that the plugin archive embeds a version of Gaol so it is not necessary to have Goal already installed on your system. Default value is “” (means: use embedded version). |
FILIB_DIR |
Ex: Set the path of Filib when using Ibex with your own version of Filib. Note that the plugin archive embeds a version of Filib so it is not necessary to have Filib already installed on your system. Default value is “” (means: use embedded version). Only to be used with |
SOPLEX_DIR |
Ex: Set the path of Soplex when using Ibex with your own version of Soplex. Note that the plugin archive contains a version of Soplex so this option is not required. If Ibex is compiled as a shared library, you must also add the libpath of Soplex
in ~/Ibex/ibex-2.8.8/$ export LD_LIBRARY_PATH=[prefix]/lib/:[soplex-path]/lib/
Under Windows, if you run a program from a command window, the > set IBEX_PATH=C:\MinGW\msys\1.0\home\[user]\Ibex\ibex-2.8.8
> set SOPLEX_PATH=...
> set PATH=%PATH%;%IBEX_PATH%\lib;%SOPLEX_PATH%\lib;C:\MinGW\bin
Only to be used with |
CPLEX_DIR |
Ex: TODO Set the path of Cplex when using Ibex with your own version of Cplex. If Ibex is compiled as a shared library, you must also add the libpath of Cplex in
Only to be used with |
CMAKE_BUILD_TYPE |
Ex: Set the build mode either to In debug mode, compiler optimizations are all discarded ( Once Ibex has been compiled with this option, you should also compile your executable
in debug mode. If you use the make DEBUG=yes ...
|
BUILD_TESTING |
Ex: |
BUILD_SHARED_LIBS |
Ex: Whether Ibex is also compiled as a dynamic library. Possibles values are 0 (only static libraries) or 1 (static and dynamic libraries). If Ibex is compiled as a dynamic library in a local folder, you must set the library path accordingly to execute a program. Under Linux: $ export LD_LIBRARY_PATH=[prefix]/lib/
Under MacOS: $ export DYLD_LIBRARY_PATH=[prefix]/lib
Under MinGW: $ export PATH=$PATH:/c/MinGW/msys/1.0/home/[user]/Ibex/ibex-2.8.8/lib
Under a Windows command window: > set PATH=%PATH%;C:\MinGW\msys\1.0\home\[user]\Ibex\ibex-2.8.8\lib;C:\MinGW\bin
|
Compiling a Test Program¶
Copy-paste the following example code in a file named foo.cpp
#include "ibex.h"
#include <iostream>
using namespace std;
using namespace ibex;
int main(int argc, char** argv) {
Interval x(0,1);
cout << "My first interval:" << x << endl;
}
There is a simple “makefile” in the examples
folder that you can use to compile your own programs (note: this makefile uses the extended syntax of GNU make).
This makefile however assumes pkg-config
is installed on your system, which is done by default on many Linux distribution).
To install pkg-config
under MinGW, follow the steps given here.
So, place the file foo.cpp
in the examples/
folder and:
~/Ibex/ibex-2.8.8/$ cd examples
~/Ibex/ibex-2.8.8/examples$ make foo
~/Ibex/ibex-2.8.8/examples$ ./foo
Note
It may be necessary to set the
PKG_CONFIG_PATH
to [prefix]/share/pkgconfig
where [prefix] is/usr/local
by default or whatever path specified via-DCMAKE_INSTALL_PREFIX
:~/Ibex/ibex-2.8.8/$ export PKG_CONFIG_PATH=/usr/local/share/pkgconfig/
Under Windows, if you have compiled Ibex with -DBUILD_SHARED_LIBS=1
you can run the program from a command window.
Just update the path to dynamically link against Ibex:
> set IBEX_PATH=C:\MinGW\msys\1.0\home\[user]\Ibex\ibex-2.8.8
> set PATH=%PATH%;%IBEX_PATH%\lib;C:\MinGW\bin
> cd %IBEX_PATH%\examples
> foo.exe
Plugins/Packages¶
There are many developments based on ibex which offer additional functionalities, typically algorithms tailored to some class of problems (e.g., parameter estimation, semi-infinite programming, etc.).
If Ibex is compiled with waf, they are rather plugins as they are installed and compiled with the core library. With Cmake, they are compiled separately and generate their own libraries. So we call them here packages.
The same steps must be done to compile a package as for the core library. See the current list of available plugins/packages in the download page of Ibex.
We assume here that the package to be installed is ibex-ampl:
~/Ibex/ibex-ampl$ mkdir build
~/Ibex/ibex-ampl$ cd build
~/Ibex/ibex-ampl/build$ cmake ..
~/Ibex/ibex-ampl/build$ make
~/Ibex/ibex-ampl/build$ sudo make install
The CMAKE_INSTALL_PREFIX
option allows to install the package locally, ex:
~/Ibex/ibex-ampl$ cmake -DCMAKE_INSTALL_PREFIX=~/Ibex/ibex-ampl ..
In this case the sudo
before make install
is unecessary.
If Ibex has been installed in a local folder, say ~/Ibex/ibex-2.8.8
you need to indicate this
path using the CMAKE_PREFIX_PATH
option:
~/Ibex/ibex-ampl$ cmake -DCMAKE_PREFIX_PATH=~/Ibex/ibex-2.8.8 ..
Of course, you can combine both:
~/Ibex/ibex-ampl$ cmake -DCMAKE_PREFIX_PATH=~/Ibex/ibex-2.8.8 -DCMAKE_INSTALL_PREFIX=~/Ibex/ibex-ampl ..
As said above, packages result in separate libraries. To link you own code with a package, you will
have to add the following line in the CMakeLists.txt
file of your project:
find_package(ibex-ampl REQUIRED)
Running unit tests¶
You can also run the whole unit tests suite with the installed version of Ibex.
To this end, you must install first the cppunit library. Then run:
~/Ibex$ cd ibex-2.8.8/build
~/Ibex/ibex-2.8.8/build$ make check
Uninstall¶
Linux/Macos¶
After running make install
you can uninstall by running:
~/Ibex$ cd ibex-2.8.8/build
~/Ibex/ibex-2.8.8/build$ make uninstall
Then, you can remove the build directory:
~/Ibex$ cd ~/Ibex/ibex-2.8.8
~/Ibex/ibex-2-8-7$ rm -Rf build
Windows¶
(to be completed)