google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
11.24k stars 2.13k forks source link

.deb package for Debian Bullseye on arm64 (aka docker on Apple Silicon / M1) #4007

Closed trumbitta closed 11 months ago

trumbitta commented 11 months ago

What language and solver does this apply to? All

Describe the problem you are trying to solve.

I'm trying to install the or-tools Ruby gem inside docker on a M2 MacBook Pro, and the gem needs the ortools lib

Describe the solution you'd like

A readymade .debpackage for Debian on arm64

Describe alternatives you've considered

Additional context

If you deem supporting docker on Apple Silicon worthy of the time you have at your disposal for this project, thank you thank you so much 🙇

Mizux commented 11 months ago

may I have the error log, since we are building for manylinux arm64, it should work on debian arm64 image.

Also since we don't provide any ruby gem support which language do you need ? only the C++ version ?

trumbitta commented 11 months ago

may I have the error log, since we are building for manylinux arm64, it should work on debian arm64 image.

Error log for cmake -S. -Bbuild

42.47 -- Configuring done
42.97 CMake Error at cmake/cpp.cmake:355 (target_link_libraries):
42.97   Target "ortools" links to:
42.97 
42.97     absl::absl_check
42.97 
42.97   but the target was not found.  Possible reasons include:
42.97 
42.97     * There is a typo in the target name.
42.97     * A find_package call is missing for an IMPORTED target.
42.97     * An ALIAS target is missing.
42.97 
42.97 Call Stack (most recent call first):
42.97   CMakeLists.txt:412 (include)
42.97 
42.97 
42.97 CMake Error at ortools/graph/CMakeLists.txt:39 (target_link_libraries):
42.97   Target "ortools_graph" links to:
42.97 
42.97     Coin::Cbc
42.97 
42.97   but the target was not found.  Possible reasons include:
42.97 
42.97     * There is a typo in the target name.
42.97     * A find_package call is missing for an IMPORTED target.
42.97     * An ALIAS target is missing.
42.97 
42.97 
42.97 
42.97 CMake Error at ortools/gurobi/CMakeLists.txt:26 (target_link_libraries):
42.97   Target "ortools_gurobi" links to:
42.97 
42.97     Coin::Cbc
42.97 
42.97   but the target was not found.  Possible reasons include:
42.97 
42.97     * There is a typo in the target name.
42.97     * A find_package call is missing for an IMPORTED target.
42.97     * An ALIAS target is missing.
42.97 
42.97 
42.97 
42.97 CMake Error at ortools/linear_solver/CMakeLists.txt:34 (target_link_libraries):
42.97   Target "ortools_linear_solver" links to:
42.97 
42.97     Coin::Cbc
42.97 
42.97   but the target was not found.  Possible reasons include:
42.97 
42.97     * There is a typo in the target name.
42.97     * A find_package call is missing for an IMPORTED target.
42.97     * An ALIAS target is missing.
42.97 
42.97 
42.97 
42.97 CMake Error at ortools/sat/CMakeLists.txt:31 (target_link_libraries):
42.97   Target "ortools_sat" links to:
42.97 
42.97     Coin::Cbc
42.97 
42.97   but the target was not found.  Possible reasons include:
42.97 
42.97     * There is a typo in the target name.
42.97     * A find_package call is missing for an IMPORTED target.
42.97     * An ALIAS target is missing.
42.97 
42.97 
42.97 
42.97 -- Generating done
42.99 CMake Generate step failed.  Build files cannot be regenerated correctly.

I installed these deps:

apt-get install -y --no-install-recommends cmake/bullseye-backports libabsl-dev libprotobuf-dev libre2-dev libeigen3-dev coinor-libcoinutils-dev libcliquer1 libgsl25 libopenblas0 libtbb2;

curl -fsSL -o SCIPOptSuite-8.0.4-Linux-arm64.deb https://github.com/scipopt/scip/releases/download/v804/SCIPOptSuite-8.0.4-Linux-arm64.deb; \
dpkg -i SCIPOptSuite-8.0.4-Linux-arm64.deb;

Also since we don't provide any ruby gem support which language do you need ? only the C++ version ?

Yep, the gem doesn't find a package for arm64 and tries to use https://github.com/google/or-tools/releases/download/v9.6/or-tools_amd64_debian-11_cpp_v9.6.2534.tar.gz which doesn't work, so I think the cpp package is the one we need

Mizux commented 11 months ago

coinutils is just a deps of the CBC and CLP solver.... see: https://raw.githubusercontent.com/google/or-tools/main/cmake/docs/cmake.svg

Otherwise you can use -DBUILD_DEPS=ON so or-tools will FetchContent() deps... note: can still not use https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_TRY_FIND_PACKAGE_MODE too early (CMake 3.24...)

trumbitta commented 11 months ago

coinutils is just a deps of the CBC and CLP solver.... see: https://raw.githubusercontent.com/google/or-tools/main/cmake/docs/cmake.svg

thanks for the pointer! 🙇 the error message is different from the ones I was getting for the other missing deps, it totally fooled me.

I'll try and see where this brings me 🤞

Otherwise you can use -DBUILD_DEPS=ON so or-tools will FetchContent() deps... note: can still not use https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_TRY_FIND_PACKAGE_MODE too early (CMake 3.24...)

Yes, that works (it also takes too much time for my use case) but then I can't seem to find a way to make the ruby gem use it (not your problem, I know, telling you just FYI)

trumbitta commented 11 months ago

coinutils is just a deps of the CBC and CLP solver.... see: https://raw.githubusercontent.com/google/or-tools/main/cmake/docs/cmake.svg

Sadly seems a dead-end: I installed deb packages for coinor-libcoinutils-dev and coinor-libcoinutils3v5 but the errors didn't change a bit.
What's baffling me is that the errors talk about missing targets instead of missing deps 🧐

Mizux commented 11 months ago

What I don't understand is if using -DBUILD_DEPS=OFF (default) you should have trigger all find_package( REQUIRED) below... https://github.com/google/or-tools/blob/main/cmake/deps.cmake

You can also start testing without the coin-or (CBC, CLP) support (you'll still have glop, cp-sat...) using -DUSE_COINOR=OFF.

Also did you take a look at this community repo: https://github.com/or-tools/ruby_or-tools

trumbitta commented 11 months ago

I was able to build my own cpp .tar.gz archive for arm64 on debian11, so now my problem has a workaround.

Would be cool if you provided such archive yourselves so that then people over at the ruby gem repo can update the gem to use it: https://github.com/ankane/or-tools-ruby/issues/54

Mizux commented 11 months ago

https://github.com/google/or-tools/blob/main/tools/docker/Makefile do support arm64 qemu docker build so on my way to generate a arm64 debian-11 cpp archive... (should take ~4/5h to build)

Mizux commented 11 months ago

in v9.8 release page you have:

trumbitta commented 11 months ago

in v9.8 release page you have:

Thank you 🙇

ankane commented 11 months ago

Thanks @Mizux