SCIP on MacOS: how to install the MIP optimizer

SCIP is an open source optimizer that solves Mixed Integer Programs (MIP). Since version 8.0.3 it is released under the Apache 2.0 license, making it available to a large variety of projects (a huge “thank you” to the SCIP team for this license choice!). I have experimented with using SCIP via the recently released version 1.4.0 of Rust’s good_lp.

What ended up being the smoothest course for me was building from source:

wget https://scipopt.org/download/release/scipoptsuite-8.0.3.tgz
tar -xvzf scipoptsuite-8.0.3.tgz
cd scipoptsuite-8.0.3
brew install bison
brew install ipopt
brew install tbb
mkdir -p ~/lib/scip
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/lib/scip ..
make -j4 && make install
export LIBRARY_PATH=$LIBRARY_PATH:$HOME/lib/scip/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$HOME/lib/scip/lib

Below are two other methods, conda and binary bundles which did not result in a working library/binary for me.

Build with multi-threading support

To build with threading, configure the TPI parameter in CMake:

cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/lib/scip -DTPI=tny ..

Does not work: binary bundles

The binary bundles appear to be compiled only for x86_64. You might have tried to install the 8.0.3 binary package from the website. The first hint is that installation instructions ask for brew install gcc@10, which results in the following error on arm64 Macs:

$ brew install gcc@10
gcc@10: The x86_64 architecture is required for this software.
Error: gcc@10: An unsatisfied requirement failed this build.

Trying with gcc@11, the installed binary still expects x86_64:

$ brew install gcc@11
$ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/homebrew/Cellar/gcc@11/11.3.0/lib/gcc/11/
$ wget https://scipopt.org/download/release/SCIPOptSuite-8.0.3-Darwin-Ipopt-gcc10.sh
$ chmod u+x SCIPOptSuite-8.0.3-Darwin-Ipopt-gcc10.sh
$ ./SCIPOptSuite-8.0.3-Darwin-Ipopt-gcc10.sh --prefix=$HOME/lib --include-subdir
$ /Users/yonch/lib/SCIPOptSuite-8.0.3-Darwin/bin/scip
dyld[53260]: Library not loaded: /usr/local/opt/gcc/lib/gcc/10/libgfortran.5.dylib
  Referenced from: <646081BB-B4DB-3BA0-97D5-D97CF2622E2A> /Users/yonch/lib/SCIPOptSuite-8.0.3-Darwin/bin/scip
  Reason: tried: '/libgfortran.5.dylib' (no such file), '/opt/homebrew/Cellar/gcc@11/11.3.0/lib/gcc/11//libgfortran.5.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

note the `(have ‘arm64’, need ‘x86_64’)`.

Fragile: conda install

Conda libraries do not seem 100% compatible with the packages provided with Xcode and other brew package, and this incompatibility resulted in missing link symbols.

$ brew install miniconda
$ conda install --channel conda-forge scip
$ export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Caskroom/miniconda/base/lib/
$ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/homebrew/Caskroom/miniconda/base/lib/
$ cargo run
dyld[44079]: Symbol not found: _iconv
  Referenced from: <15170D86-C5DF-3B69-90CE-63CC469F021F> /opt/homebrew/Cellar/rust/1.67.0/bin/cargo
  Expected in:     <1DC18063-4642-3792-A05F-23DF6407E45B> /opt/homebrew/Caskroom/miniconda/base/lib/libiconv.2.dylib
Abort trap: 6

The QGIS community apparently also experienced a similar problem with missing _iconv on MacOS. The accepted workaround was to copy the system’s lib from `/usr/lib/libiconv.2.dylib` and overriding the supplied library. I decided not to pursue the conda angle further and instead compile from source (described above).

Posted in Tech Blog.

Leave a Reply

Your email address will not be published. Required fields are marked *