Overview
This source code distribution uses the GNU autoconf/make mechanism and Doxygen for extracting the documentation.
HQP can be compiled and tested by invoking:
$ ./configure
$ make
Basically two libraries are built: hqp and omu. Furthermore an example is created in ./hqp_docp, tesing HQP alone, and a demo collection in ./odc, testing HQP together with the front-end Omuses.
An up-to-date reference documentation can be created from the sources with
$ make doc
The results of make (object codes, lib, executables) can be removed with
$ make clean
The results of make and configure (makefiles) can removed with
$ make distclean
Installation details
Required software
The compilation of HQP relies on the following software:
-
an sh-compatible command interpreter (IEEE POSIX Shell and Tools spec)
-
GNU make
-
a compiler for C, C++ and optionally Fortran 77
Moreover, HQP uses the Tool Command Language
-
Tcl version 8.1 or higher
The required software is normally there under Linux.
Hints for Windows
The freely available Cygwin is an easy way to get the required software under Windows all at once (see http://sources.redhat.com/cygwin/). When using the Net installation wizard setup.exe, make sure to select the following packages for installation:
- Libs/tcltk
- Devel/gcc
- Devel/gcc-g++
- Devel/gcc-g77
- (only to use additional integrators, e.g. DASPK)
- Devel/gcc-mingw
- (only to compile a non-cygwin version)
- Devel/gcc-mingw-g++
- (only to compile a non-cygwin version)
- Devel/gcc-mingw-g77
- (only to compile a non-cygwin version)
- Devel/doxygen
- (only to re-generate reference documentation)
Note: Tcl is not installed properly under Cygwin (<=1.5.5), causing Hqp not to find the Tcl library (init.tcl). See section "Known Problems" below.
Detailed installation steps
-
Unpack the distribution file by invoking
tar -xzf hqp<version>.tar.gz
This creates the new directory hqp containing everything.
-
cd to the created directory and invoke
./configure
This creates the files ./makedirs, ./makedefs ./odc/Makefile, ./hqp_docp/Makefile, lib/pkgIndex.tcl, and ./doc/Doxyfile. Following options can be specified:
Feature options:
- --enable-fortran
- Include the numerical integration routines RKsuite and optionally DASPK with libomu (see also daspk/README). This requires an f77 compiler on your machine. Note: The automatic settings done by ./configure are only guesses. Please check the variables FORTRAN_* in ./makedefs.
- --enable-mex
- Include MEX S-function interface with Omuses. This requires MATLAB(R) and Simulink(R) on your machine for include files declaring data structures and for runtime libs implementing mxArray.
Additionally you may specify:
--with-matlab
Root directory of MATLAB(R) installation, e.g. --with-matlab=/usr/local/matlab
--with-matlab-libs
Directory containing MATLAB(R) runtime libraries, e.g. --with-matlab-libs=/usr/local/matlab/extern/lib/glnx86
Note: see "Problems with MEX" below, if this feature does not work
- --enable-cute
- Include CUTE interface with HQP.
- --enable-ascend
- Include current preliminary version of an interface to Ascend4. This requires that this distribution is unpacked in the directory of the Ascend distribution, e.g. in /home/myname/ascendiv-0.9 (for Ascend see http://www.cs.cmu.edu/~ascend/Home.html)
Installation options:
- --prefix=PATH
- Path where you'd like to install the libraries and include files (default is /usr/local).
Build options:
- --disable-shared (--enable-shared)
- Build shared (static) libraries. Shared is default, except for Windows, where building a DLL is somewhat tricky. Shared libraries are required if Hqp/Omuses shall be used as package extending a Tcl application.
- --enable-symbols
- build debug version, including symbolic information
- --enable-gmalloc
- Use GNU malloc instead of the system routines. Gmalloc will be enabled automatically if your system malloc doesn't work properly (e.g. under DEC OSF). According to the authors experience gmalloc doesn't work on all machines, but fortunately it does where it's needed :-)
Use a specific Tcl installation, which is not found automatically:
- --with-tcl
- Directory containing Tcl configuration file tclConfig.sh, e.g. --with-tcl=/usr/local/lib
- --with-tclinclude
- Directory containing include file tcl.h.
-
Compile the distribution by invoking
make
(or
make -f Makefile.hqp
to skip building Omuses and Odc)
-
Directly after compilation, a test run of an example in ./odc is performed automatically that should produce the result "optimal". Some more examples are given in ./odc (please see also the documentation in ./doc).
-
Optionally install the libraries and includes by invoking
make install
The following directories and files are created:
$prefix / lib / Hqp<version> / pkgIndex.tcl
/ libhqp-<version>.so
/ libomu-<version>.so
/ libhqp.so -> libhqp-<version>.so
/ libomu.so -> libomu-<version>.so
/ include / hqp-<version> / *.h
/ hqp -> hqp-<version>
-
See ./hqp_docp/README if you want to apply HQP directly to multistage problems, without using ADOL-C or differential equations.
-
See ./hqp_cute/README if you want to use HQP in the testing environment CUTE.
-
Send correspondence to the developers listed at http://hqp.sf.net
Using alternative compilers
Gernerally for using an other compiler, say cl, invoke
CC=cl ./configure
Hints for using cl, i.e. the "native" compiler under Windows
-
you still need Cygwin (see http://www.cygwin.com) or MinGW (see http://www.mingw.org) in order to run the automatic configuration and make
-
the location of cl must be in your PATH environment
-
the automatically generated file makedirs may need to be customized manually with drive names for absolute paths (e.g. insead of "/Programs/Tcl/lib" write "c:/Programs/Tcl/lib"
-
cl does work for ADOL-C used in the front-end Omuses. That is why --disable-adolc must be specfied for configure.
-
dynamic link libraries are not yet installed automatically
Alternative for Windows
-
compile everything under MinGW/MSYS (tested with MinGW 1.1, MSYS 1.0.7 prerelease 1, Tcl 8.4a3)
Yet another alternative for Windows
Cygwin can also be used to compile libraries and programs that run natively under Windows not relying on the Posix emulation layer provided by cygwin1.dll.
-
install a Windows version of Tcl and make sure it is found in the PATH before the version coming with cygwin (or uninstall the cygwin package tcltk)
-
invoke
CC="gcc -mno-cygwin" ./configure
Known Installation Problems
Problems with Tcl
application-specific initialization failed: Can't find a usable init.tcl in the following directories: C:/cygwin/share/tcl8.4 ...
This error is caused by an unproper installation of Tcl. Two work-arounds are possible:
-
set the environment variable TCL_LIBRARY to the directory containing init.tcl, e.g. to c:/cygwin/usr/share/tcl8.4
-
create a link
$ ln -s /usr/share /share
Fail to link Omuses with Matlab(R) runtime library (--enable-mex)
Message: Cannot export libmx_NULL_THUNK_DATA: symbol not found
This problem can be solved by generating a gcc compatible library stub from libmx.lib coming with Matlab(R). Generate liblibmx.a with the following commands in the directory MATLAB_LIBDIR:
$ echo EXPORTS > libmx.def
$ nm libmx.lib | grep ' T _' | sed 's/.* T _//' >> libmx.def
$ dlltool --def libmx.def --dllname libmx.dll --output-lib liblibmx.a
Fail to load MEX S-function (mdlInitializeSizes fails)
The lcc compiler coming with Matlab(R) does not appropriately export the mexFunction of the DLL. That is why the dynamic load fails. Use an other compiler to generate the S-function with mex. For instance gcc (see http://gnumex.sf.net) or Microsoft Visual C++ (directly supported by Matlab(R)) work.
Problems with specific gcc versions:
-
gcc 2.8.0 and egcs 1.0.3 can't compile a method "resize" (tested and rejected by automatic configuration)
-
gcc 2.7 does not work under DEC OSF with code optimization (Please edit the automatically generated file makedefs. The optimization is not disabled automatically as the generated code will be rather slow)
Problems with Cygwin
-
some early version of Cygwin 1.1 did setup HUGE_VAL wrong
Problems with MinGW/MSYS
-
"TCL_LIB_SPEC" isn't set correctly in tclConfig.sh for Tcl 8.4a3; "@TCL_LIB_SPEC@" must be replaced by "-ltcl84" in hqp_docp/Makefile and odc/Makefile
-
mkdirhier and gunzip are not included in the standard MinGW/MSYS installation