Fails to build with Ubuntu 22.04 LTS
theomelo opened this issue · comments
Theo Melo commented
When installing this gem into a Ubuntu server (QEMU ARM VM), I get an ERROR: Failed to build gem native extension.
Full Error
current directory: /home/dev/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/or-tools-0.10.1/ext/or-tools
/home/dev/.asdf/installs/ruby/3.2.2/bin/ruby extconf.rb --with-or-tools-dir\=/home/dev/or-tools
checking for rice/rice.hpp in /home/dev/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rice-4.1.0/include... yes
checking for -lstdc++... yes
checking for -lortools... yes
creating Makefile
current directory: /home/dev/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/or-tools-0.10.1/ext/or-tools
make DESTDIR\= sitearchdir\=./.gem.20231101-63192-jsji3m sitelibdir\=./.gem.20231101-63192-jsji3m clean
current directory: /home/dev/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/or-tools-0.10.1/ext/or-tools
make DESTDIR\= sitearchdir\=./.gem.20231101-63192-jsji3m sitelibdir\=./.gem.20231101-63192-jsji3m
compiling assignment.cpp
compiling bin_packing.cpp
compiling constraint.cpp
compiling ext.cpp
compiling linear.cpp
compiling network_flows.cpp
compiling routing.cpp
routing.cpp: In function ‘void init_routing(Rice::Module&)’:
routing.cpp:356:57: error: ‘GetPickupIndexPairs’ is not a member of ‘operations_research::RoutingModel’
356 | .define_method("pickup_index_pairs", &RoutingModel::GetPickupIndexPairs)
| ^~~~~~~~~~~~~~~~~~~
routing.cpp:357:59: error: ‘GetDeliveryIndexPairs’ is not a member of ‘operations_research::RoutingModel’
357 | .define_method("delivery_index_pairs", &RoutingModel::GetDeliveryIndexPairs)
| ^~~~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-shorten-64-to-32’ may have been intended to silence earlier diagnostics
make: *** [Makefile:240: routing.o] Error 1
make failed, exit code 2
Specs
- Command:
gem install or-tools -- --with-or-tools-dir=/home/dev/or-tools
- Ruby:
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [aarch64-linux]
- OR Tools:
v9.5
, installed from their repo - VM OS:
Linux 5.15.0-88-generic #98-Ubuntu SMP Mon Oct 2 15:23:16 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
- Host OS:
Apple M1 Sonoma 14.1
Theo Melo commented
Steps I took to install OR Tools locally:
git clone --branch v9.5 https://github.com/google/or-tools/ --depth 1 \
cd or-tools \
make third-party && make cc
Then, inside the Rails project's folder:
bundle config build.or-tools --with-or-tools-dir=/home/dev/or-tools
Theo Melo commented
Another variant of the --with-or-tools-dir
produced a slightly different result:
gem install or-tools -- --with-or-tools-dir=/home/dev/or-tools/install_make
current directory: /home/dev/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/or-tools-0.10.1/ext/or-tools
/home/dev/.asdf/installs/ruby/3.2.2/bin/ruby extconf.rb --with-or-tools-dir\=/home/dev/or-tools/install_make
checking for rice/rice.hpp in /home/dev/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rice-4.1.0/include... yes
checking for -lstdc++... yes
checking for -lortools... yes
creating Makefile
current directory: /home/dev/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/or-tools-0.10.1/ext/or-tools
make DESTDIR\= sitearchdir\=./.gem.20231101-63917-5gwyq7 sitelibdir\=./.gem.20231101-63917-5gwyq7 clean
current directory: /home/dev/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/or-tools-0.10.1/ext/or-tools
make DESTDIR\= sitearchdir\=./.gem.20231101-63917-5gwyq7 sitelibdir\=./.gem.20231101-63917-5gwyq7
compiling assignment.cpp
compiling bin_packing.cpp
compiling constraint.cpp
compiling ext.cpp
ext.cpp: In function ‘void Init_ext()’:
ext.cpp:33:9: error: ‘struct operations_research::CppFlags’ has no member named ‘stderrthreshold’
33 | flags.stderrthreshold = 2;
| ^~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-shorten-64-to-32’ may have been intended to silence earlier diagnostics
make: *** [Makefile:240: ext.o] Error 1
make failed, exit code 2
Andrew Kane commented
Hi @theomelo, 0.10.1 only works with OR-Tools 9.6.