Compiling and Installing the R Interface ipoptr

The ipoptr interface can be build after IPOPT has been build and installed. In the best case, it is sufficient to execute the following command in R:

install.packages('$IPOPTDIR/build/Ipopt/contrib/RInterface', repos=NULL, type='source')

In certain situations, however, it can be necessary to setup the dynamic library load path to the path where the IPOPT library has been installed, e.g.,

  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$IPOPTDIR/build/lib

NOTE: R needs to be able to load the IPOPT library dynamically at runtime. Therefore, IPOPT must have been compiled with the -fPIC compiler flag. While per default, an Ipopt shared library is compiled with this flag, for a configuration of IPOPT in debug mode (-enable-debug) or as static library (-disable-shared), the configure flag -with- pic need to be used to enable compilation with -fPIC.

After installation of the ipoptr package, it should be possible to load the package in R and to view the help page:

> library('ipoptr')
> ?ipoptr