How to install or-tools (binary)
Follow the official instructions for a binary installation, C++.
⚠️ It's a ~50MB download! It might take a while.
If you're not sure about which system you have, pick the latest Ubuntu with the "LTS" label (meaning: official release).
After the installation (the make test command must have worked):
- Stay inside the ortools directoy (where you ran the successful make test command)
- Run this if you use Linux:
sudo rm -f lib/libortools.so /usr/lib/libortools.so.9 /usr/lib/libortools.so
ln -s "$PWD/lib/libortools.so.9" "$PWD/lib/libortools.so"
sudo ln -s "$PWD/lib/libortools.so.9" /usr/lib/libortools.so.9
sudo ln -s "$PWD/lib/libortools.so.9" /usr/lib/libortools.so
- Run this if you have a Mac:
sudo ln -s $PWD/lib/libortools.9.dylib /usr/local/lib
- Create a test subdirectory right here in the current directory, i.e., the or-tools directory:
mkdir test
- Go inside the test directory, download and uncompress test_ortools.tar.gz:
curl http://fabien.viger.free.fr/oc/test_ortools.tar.gz --output test_ortools.tar.gz
tar xf test_ortools.tar.gz
- Only if you have a Mac, change the Makefile like this: mv Makefile.apple Makefile
- Verify that it all works:
make ortools_test
If it just works, CONGRATS! The ortools installation was successful. You can now move on to the exercise.
Else, here are some common errors:
- On Mac, you get a system prompt telling you that the libortools library isn't trusted, or something similar
→ If you have the "Run" or "Proceed" option, do it. If not, go to your system setting, in "Security" you should see a checkbox that'll allow you to run this in the future.
- ./ortools_test.test: error while loading shared libraries: libortools.so.9: cannot open shared object file: No such file or directory
→ the above set of commands related to libortools.so.9 wasn't done correctly or didn't work
- ortools_test.cc:3:10: fatal error: ortools/linear_solver/linear_solver.h: No such file or directory
→ did you create the test subdirectory in the right place? See above.
- undefined reference to `operations_research::MPSolver::~MPSolver()'
→ There's probably a problem with the Makefile. Did you unpack test.tar.gz correctly? Did you modify the Makefile?
Then, when you're doing td7, td8, etc:
- Create a td7 (or td8, etc) subdirectory in the or-tools directory, just like the
test subdirectory you just created
- You can again go inside that subdirectory, unpack the TD's test.tar.gz (from the TD page), and
you should be able to run:
make or_tools_test