But you can also {anchor anchor='options' text='customize'} the installation.
Requirements
The following applications must be installed.
- g++
- gcc
- flex
- bison
- python2.x (warning: the script are currently not compatible with python3)
- make
- pkg-config (optionnal)
- jdk (optionnal)
Windows
- Install MinGW+Msys
Select the following components to be installed:
- C Compiler
- C++ Compiler
- MSYS Basic System
- MinGW Developer ToolKit
- Install Python2 (warning: the script are currently not compatible with python3)
- Create a new directory Ibex in the shell of MinGW (to open the shell of MinGW,
click on Start -> MinGW -> MinGWShell)
~$ mkdir Ibex
- Assuming you have installed MinGW in C:\, the Ibex directory you have
created should be located on your system here:
C:\MinGW\msys\1.0\home\[user]\Ibex
Download Soplex 1.7.0 and save the archive in Ibex.
- Compile Soplex in Ibex (still in the shell of MinGW):
~$ cd Ibex
~/Ibex$ tar xvfz soplex-1.7.0.tgz
~/Ibex$ cd soplex-1.7.0
~/Ibex/soplex-1.7.0$ make ZLIB=false
~/Ibex/soplex-1.7.0$ cd ..
- Save the archive ibex-2.1.1.tar.gz in Ibex
- Compile ibex (still in the shell of MinGW)
~/Ibex/$ export PATH="$PATH:/c/Python27"
~/Ibex/$ tar xvfz ibex-2.1.1.tar.gz
~/Ibex/$ cd ibex-2.1.1
~/Ibex/ibex-2.1.1/$ ./waf configure --prefix=[path]
where [path] is the place where you want Ibex to be installed.
This path must be entered in Windows-style and with double backslash («\\») as separator, e.g.,
C:\\MyLibraires\\Ibex.
Finally:
~/Ibex/ibex-2.1.1/$ ./waf install
Customized Installation
Configuration options
waf configure supports the following options:
Installation as a dynamic library (--enable-shared or --with-jni)
You can install Ibex as a dynamic library.
We recommend you, in this case, to use the interval libraries supplied with Ibex.
Indeed, if Ibex is compiled with Profil/Bias or your own version of Gaol, you may run into problems at some point, even if the installation apparenlty succeeds
(this is due to the -fPIC option missing in the installation of these libraries).
Note: Combining --enable-shared with --with-bias is not supported under Mac OS 64 bits.
There are only a few differences with the standard installation:
Then, you can run waf configure
with either --enable-shared or --with-jni.
Installation of the Java interface (--with-jni)
Important notice:
- This interface is under development
- The Ibex-Choco interface is supported by Choco 3 (not Choco 2).
- As for --enable-shared, we recommend you to use the interval libraries supplied with Ibex.
Furthermore, some configurations (Ibex+Gaol under 64 bits) yield a 32-bit library although the platform is 64 bits. Hence,
Java will fail in loading Ibex (unless you have a 32-bits JVM of course).
The only additional requirement is that the environment variable JAVA_HOME must be set.
This installation will generate, in addition to the Ibex library:
- the libibex-java library that contains the glue code between C++ and Java
- the [java package].jar file where [java package] is the name given with
the --with-java-package option.
This file is put into the [prefix]/share/java where [prefix] is
/usr/local by default or whatever path specified via --prefix.
Compiling and running examples
Using the Makefile (recommended)
If you have installed Ibex following the {anchor anchor='stand-install' text='standard installation'}, there is a simple makefile
you can use to compile examples as well as your own programs.
This makefile however assumes pkg-config is installed on your system (which is done by default on many Linux distribution).
If you have installed Ibex in the local folder, or if you don't want pkg-config to be installed,
you may consider the {anchor anchor='basic-make' text='basic command line'} instead.
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 --prefix:
~/Ibex/ibex-2.1.1/$ export PKG_CONFIG_PATH=/usr/local/share/pkgconfig/
Note: if some libraries are linked dynamically (like libultim), it may be necessary to set the LD_LIBRARY_PATH accordingly.
Here is an example:
~/Ibex/ibex-2.1.1/$ cd examples
~/Ibex/ibex-2.1.1/$ make defaultsolver
~/Ibex/ibex-2.1.1/$ ./defaultsolver ../benchs/cyclohexan3D.bch 1e-05 10
The default solver solves the systems of equations in argument (cyclohexan3D) with a precision less than 1e-05 and
within a time limit of 10 seconds.
To compile your own program, just copy-paste the makefile of Ibex/examples.
Note: this makefile uses the extended syntax of GNU make.
Basic command line
You can alternatively try the following command line directly, but the success is less guaranteed.
If Ibex is installed with Gaol, the basic line is:
g++ -I[prefix]/include/ibex -I[soplex path]/src -L[soplex path]/lib -libex -lsoplex -lz -lultim
-o [filename] [filename].cpp
where [prefix] is /usr/local by default or whatever path specified via --prefix.
- If your have compiled Ibex with Gaol under 64 bits platform
Add the -m32 option
- If Ibex is installed in a local folder
- If you have compiled Ibex with Profil/Bias
- Add -I[profil path]/include
- Add -L[profil path]/lib
- At the end of the line, add
-lProfil -lBias -llr -lsoplex -lz
Java examples
If you have installed Ibex with the --with-jni option, you can run a java test example.
- Linux
~$ export LD_LIBRARY_PATH=[prefix]/lib
where [prefix] is
/usr/local by default or whatever path specified via --prefix.
Then:
~$ cd Ibex/ibex-2.1.1/__build__/src/java
~/Ibex/ibex-2.1.1/__build__/src/java$ $JAVA_HOME/bin/java Test
Alternatively, you can give the library path directly in argument of the java command instead of using an environment
variable:
~$ cd Ibex/ibex-2.1.1/__build__/src/java
~/Ibex/ibex-2.1.1/__build__/src/java$ $JAVA_HOME/bin/java -Djava.library.path=[prefix]/lib Test
- MacOS
~$ export DYLD_LIBRARY_PATH=[prefix]/lib
where [prefix] is
/usr/local by default or whatever path specified via --prefix.
Then:
~$ cd Ibex/ibex-2.1.1/__build__/src/java
~/Ibex/ibex-2.1.1/__build__/src/java$
Alternatively, you can give the library path directly in argument of the java command instead of using an environment variable:
~$ cd Ibex/ibex-2.1.1/__build__/src/java
~/Ibex/ibex-2.1.1/__build__/src/java$ $JAVA_HOME/bin/java -Djava.library.path=[prefix]/lib Test
- Windows
We assume here that MinGW has been installed in C:\ and Ibex in C:\MinGW\msys\1.0\home\[user]\Ibex\ibex-2.1.1.
Open a command window (not the shell of MinGW) and type:
C:\Documents and Settings\[user]> cd C:\MinGW\msys\1.0\home\[user]\Ibex\ibex-2.1.1\__build__\src\java
C:\MinGW\msys\1.0\home\[user]\Ibex\ibex-2.1.1\__build__\src\java>set PATH=%PATH%;[prefix]/bin;C:\MinGW\bin
C:\MinGW\msys\1.0\home\[user]\Ibex\ibex-2.1.1\__build__\src\java>java Test
Notice: $JAVA_HOME ensures the JVM is compatible with the version of Java you have compiled Ibex with.
Uninstall
Simply type in the path of IBEX (under the shell of MinGW for Windows)
~/Ibex/ibex-2.1.1$sudo ./waf uninstall
~/Ibex/ibex-2.1.1$ ./waf distclean
Note: sudo is useless if Ibex is installed in a local folder.
Troubleshooting
UnsatisfiedLinkError with Choco
When running the "CycloHexan" example from Choco using Ibex, the following error appears:
Exception in thread "main" java.lang.UnsatisfiedLinkError: solver.constraints.real.Ibex.add_ctr(ILjava/lang/String;I)V
at solver.constraints.real.Ibex.add_ctr(Native Method)
at solver.constraints.propagators.real.RealPropagator.<init>(RealPropagator.java:77)
at solver.constraints.real.RealConstraint.addFunction(RealConstraint.java:82)
at samples.real.CycloHexan.buildModel(CycloHexan.java:87)
at samples.AbstractProblem.execute(AbstractProblem.java:130)
at samples.real.CycloHexan.main(CycloHexan.java:134)
Solution: You probably did not set the Java package properly. The java package of the Ibex class in Choco is solver.constraints.real, try:
./waf configure [....] --with-java-package=solver.constraints.real
When running waf configure, I get messages like this:
Checking for header ['gaol/gaol.h', 'gaol/gaol_interval.h'] : not found
...
Does it mean that Ibex is not properly installed?
Answer: No, this mesage simply indicates that gaol was not found on your system and that it will be automatically extracted from the bundle. It is not an error message.
JAVA_HOME does not seem to be set properly
I get this message when running waf configure.
Solution: The JAVA_HOME must be the path of the JDK and contain a subdirectoy include which, in turn, contains the jni.h
header file. On MacOS this path can be /Library/Java/JavaVirtualMachines/jdkXXXX.jdk/Contents/Home.