Error while installing OR-Tools from source on Linux

856 views
Skip to first unread message

Christine Tawfik

unread,
Feb 12, 2021, 4:05:57 AM2/12/21
to or-tools-discuss
Hi everyone, 

I am trying to install OR-Tools on Ubuntu 18.04 from source. I cloned the stable branch:
https://github.com/google/or-tools, got the prerequisites for C++ tools but I still get an error when trying to run make third_party as follows:

makefiles/Makefile.third_party.unix.mk:210: recipe for target 'dependencies/install/lib/libprotobuf.a' failed
make: *** [dependencies/install/lib/libprotobuf.a] Error 1

Has anybody encountered a similar issue? 

Thanks in advance for your help,
Christine

Mizux Seiha

unread,
Feb 13, 2021, 5:23:21 AM2/13/21
to or-tools-discuss
strange, Do you have any more messages before this one ?

Which version of CMake do you have ?

Christine Tawfik

unread,
Feb 15, 2021, 12:15:22 PM2/15/21
to or-tools-discuss
Yes, it is strange indeed. This is the whole output:

$ make third_party
Makefile:57: Makefile.local: No such file or directory
/bin/sh: 0: Illegal option -r
/bin/sh: 0: Illegal option -r
/bin/sh: 0: Illegal option -r
makefiles/Makefile.python.mk:1013: warning: overriding recipe for target 'temp_python'
makefiles/Makefile.python.mk:844: warning: ignoring old recipe for target 'temp_python'
rm -f Makefile.local
Generating Makefile.local
/bin/sh: 0: Illegal option -r
/bin/sh: 0: Illegal option -r
/bin/sh: 0: Illegal option -r
mkdir -p dependencies/install
mkdir -p dependencies/install/bin
mkdir -p dependencies/install/lib
mkdir -p dependencies/install/lib/pkgconfig
mkdir -p dependencies/install/include
mkdir -p dependencies/install/include/coin
rm -rf dependencies/sources/protobuf-v3.14.0
git clone --quiet -b v3.14.0 https://github.com/google/protobuf.git dependencies/sources/protobuf-v3.14.0
Note: checking out '2514f0bd7da7e2af1bed4c5d1b84f031c4d12c10'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

cd dependencies/sources/protobuf-v3.14.0 && \
    git apply "/home/christine/or-tools/patches/protobuf-v3.14.0.patch"
cd dependencies/sources/protobuf-v3.14.0 && \
   /usr/bin/cmake -Hcmake -Bbuild_cmake \
    -DCMAKE_PREFIX_PATH="/home/christine/or-tools/dependencies/install" \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_CXX_STANDARD=17 \
    -DCMAKE_CXX_STANDARD_REQUIRED=ON \
    -DCMAKE_CXX_EXTENSIONS=OFF \
    -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
    -DBUILD_SHARED_LIBS=OFF \
    -DBUILD_TESTING=OFF \
    -Dprotobuf_BUILD_TESTS=OFF \
    -Dprotobuf_BUILD_EXAMPLES=OFF \
    -DCMAKE_CXX_FLAGS="" \
    -DCMAKE_INSTALL_PREFIX=../../install && \
  /usr/bin/cmake --build build_cmake --config Release -v -- -j 4 && \
  /usr/bin/cmake --build build_cmake --config Release --target install
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 
-- 3.14.0.0
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TESTING


-- Build files have been written to: /home/christine/or-tools/dependencies/sources/protobuf-v3.14.0/build_cmake
Unknown argument -v
Usage: cmake --build <dir> [options] [-- [native-options]]
Options:
  <dir>          = Project binary directory to be built.
  --target <tgt> = Build <tgt> instead of default targets.
                   May only be specified once.
  --config <cfg> = For multi-configuration tools, choose <cfg>.
  --clean-first  = Build target 'clean' first, then build.
                   (To clean only, use --target 'clean'.)
  --use-stderr   = Ignored.  Behavior is default in CMake >= 3.0.
  --             = Pass remaining options to the native tool.
makefiles/Makefile.third_party.unix.mk:210: recipe for target 'dependencies/install/lib/libprotobuf.a' failed
make: *** [dependencies/install/lib/libprotobuf.a] Error 1


Xiang Chen

unread,
Feb 15, 2021, 12:20:32 PM2/15/21
to or-tools...@googlegroups.com
Did you install the prerequisites from https://developers.google.com/optimization/install/python/source_linux#c++-tools
?
I think I had the error /bin/sh: 0: Illegal option -r because I was missing swig.

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/5989028e-fde6-446d-bd73-c1b6cce9d50bn%40googlegroups.com.

Mizux Seiha

unread,
Feb 16, 2021, 2:31:35 AM2/16/21
to or-tools-discuss

Mizux Seiha

unread,
Feb 16, 2021, 2:33:15 AM2/16/21
to or-tools-discuss

Mizux Seiha

unread,
Feb 16, 2021, 2:44:00 AM2/16/21
to or-tools-discuss
Bionic seems to be stuck in 3.10
https://packages.ubuntu.com/en/bionic/cmake

the easiest way to install a new CMake version, IMHO, is to use the kitware provided script (lastest version is 3.19.5)
```sh
cmake --version

Christine Tawfik

unread,
Feb 16, 2021, 1:43:36 PM2/16/21
to or-tools-discuss
It was indeed an issue of the CMake version. It works well now!

Thank you very much for your help!

Christine Tawfik

unread,
Feb 18, 2021, 3:05:07 PM2/18/21
to or-tools-discuss
Unfortunately, Or-tools is showing some unexpected behavior on standard models. I guess the multiple installations may not have been entirely correct.
Now, I need to uninstall it system-wide as it was installed and try again with a brand new installation from source. Is there any 'uninstall' command that would remove any residue files from my system?
Thanks again in advance.

Mizux Seiha

unread,
Feb 19, 2021, 2:50:36 AM2/19/21
to or-tools-discuss
What do you mean by system-wide install ? AFAIK Makefile based build won't install or-tools in your system...

Could you explain us which command did you run ? which language are you targeting ?

Christine Tawfik

unread,
Feb 19, 2021, 8:39:31 AM2/19/21
to or-tools-discuss
It is for C++. I cloned or-tools from the stable branch ( git clone https://github.com/google/or-tools )  and ran:
make third_party
make cc
make test_cc 
make install_cc 

As a result, several library files were added to usr/local/lib and usr/local/include

Now, I would like to make a brand new installation from source and to remove the previously added files from my system.
Reply all
Reply to author
Forward
0 new messages