ankane / or-tools-ruby

Operations research tools for Ruby
Apache License 2.0
179 stars 25 forks source link

Gem installation in macOS Catalina 10.15.7 #10

Closed stevenchern closed 3 years ago

stevenchern commented 3 years ago

Hi, I'm having a problem installing gem. I run: gem install or-tools -v '0.4.0' and I get the error below:

Building native extensions. This could take a while...
ERROR:  Error installing or-tools:
    ERROR: Failed to build gem native extension.

    current directory: /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/ext/or-tools
/Users/stevenchern/.rbenv/versions/2.6.3/bin/ruby -I /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/2.6.0 -r ./siteconf20210217-92877-129hv8h.rb extconf.rb
checking for -lstdc++... yes
checking for -lortools... yes
creating Makefile

current directory: /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/ext/or-tools
make "DESTDIR=" clean

current directory: /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/ext/or-tools
make "DESTDIR="
compiling ext.cpp
In file included from ext.cpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/constraint_solver/routing.h:186:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/lp_solver.h:20:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/preprocessor.h:27:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/revised_simplex.h:99:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/basis_representation.h:18:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/lu_factorization.h:17:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/markowitz.h:84:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/sparse.h:38:
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/sparse_column.h:102:21: warning: loop variable 'e' of type 'const operations_research::glop::SparseColumnEntry' creates a copy from type 'const operations_research::glop::SparseColumnEntry' [-Wrange-loop-analysis]
    for (const auto e : *this) {
                    ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/sparse_column.h:102:10: note: use reference type 'const operations_research::glop::SparseColumnEntry &' to prevent copying
    for (const auto e : *this) {
         ^~~~~~~~~~~~~~
                    &
In file included from ext.cpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/constraint_solver/routing.h:186:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/lp_solver.h:20:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/preprocessor.h:27:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/revised_simplex.h:99:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/basis_representation.h:20:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/rank_one_update.h:19:
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/lp_utils.h:84:34: warning: loop variable 'e' of type 'const SparseColumn::Entry' (aka 'const operations_research::glop::SparseColumnEntry') creates a copy from type 'const SparseColumn::Entry' [-Wrange-loop-analysis]
  for (const SparseColumn::Entry e : v) {
                                 ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/lp_utils.h:84:8: note: use reference type 'const SparseColumn::Entry &' (aka 'const operations_research::glop::SparseColumnEntry &') to prevent copying
  for (const SparseColumn::Entry e : v) {
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/lp_utils.h:106:34: warning: loop variable 'e' of type 'const SparseColumn::Entry' (aka 'const operations_research::glop::SparseColumnEntry') creates a copy from type 'const SparseColumn::Entry' [-Wrange-loop-analysis]
  for (const SparseColumn::Entry e : v) {
                                 ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/lp_utils.h:106:8: note: use reference type 'const SparseColumn::Entry &' (aka 'const operations_research::glop::SparseColumnEntry &') to prevent copying
  for (const SparseColumn::Entry e : v) {
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/lp_utils.h:121:19: warning: loop variable 'e' of type 'const operations_research::glop::ScatteredColumnEntry' creates a copy from type 'const operations_research::glop::ScatteredColumnEntry' [-Wrange-loop-analysis]
  for (const auto e : v) {
                  ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/lp_utils.h:121:8: note: use reference type 'const operations_research::glop::ScatteredColumnEntry &' to prevent copying
  for (const auto e : v) {
       ^~~~~~~~~~~~~~
                  &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/lp_utils.h:133:34: warning: loop variable 'e' of type 'const SparseColumn::Entry' (aka 'const operations_research::glop::SparseColumnEntry') creates a copy from type 'const SparseColumn::Entry' [-Wrange-loop-analysis]
  for (const SparseColumn::Entry e : v) {
                                 ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/lp_utils.h:133:8: note: use reference type 'const SparseColumn::Entry &' (aka 'const operations_research::glop::SparseColumnEntry &') to prevent copying
  for (const SparseColumn::Entry e : v) {
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 &
In file included from ext.cpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/constraint_solver/routing.h:191:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/theta_tree.h:20:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/integer.h:39:
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_base.h:114:22: warning: loop variable 'literal' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
  for (const Literal literal : literals) {
                     ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_base.h:114:8: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
  for (const Literal literal : literals) {
       ^~~~~~~~~~~~~~~~~~~~~~~
                     &
In file included from ext.cpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/constraint_solver/routing.h:191:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/theta_tree.h:20:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/integer.h:40:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:38:
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/clause.h:128:24: warning: loop variable 'l' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
    for (const Literal l : new_clause) literals_[size_++] = l;
                       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/clause.h:128:10: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
    for (const Literal l : new_clause) literals_[size_++] = l;
         ^~~~~~~~~~~~~~~~~
                       &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/clause.h:654:26: warning: loop variable 'b' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
      for (const Literal b : implications_[i]) {
                         ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/clause.h:654:12: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
      for (const Literal b : implications_[i]) {
           ^~~~~~~~~~~~~~~~~
                         &
In file included from ext.cpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/constraint_solver/routing.h:191:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/theta_tree.h:20:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/integer.h:40:
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:163:43: warning: loop variable 'p' of type 'const std::pair<Literal, double>' creates a copy from type 'const std::pair<Literal, double>' [-Wrange-loop-analysis]
    for (const std::pair<Literal, double> p : prefs) {
                                          ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:163:10: note: use reference type 'const std::pair<Literal, double> &' to prevent copying
    for (const std::pair<Literal, double> p : prefs) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                          &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:882:24: warning: loop variable 'l' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
    for (const Literal l : literals) {
                       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:882:10: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
    for (const Literal l : literals) {
         ^~~~~~~~~~~~~~~~~
                       &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:896:24: warning: loop variable 'l' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
    for (const Literal l : literals) {
                       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:896:10: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
    for (const Literal l : literals) {
         ^~~~~~~~~~~~~~~~~
                       &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:910:24: warning: loop variable 'l' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
    for (const Literal l : literals) {
                       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:910:10: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
    for (const Literal l : literals) {
         ^~~~~~~~~~~~~~~~~
                       &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:939:24: warning: loop variable 'l' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
    for (const Literal l : literals) {
                       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:939:10: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
    for (const Literal l : literals) {
         ^~~~~~~~~~~~~~~~~
                       &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:956:24: warning: loop variable 'l' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
    for (const Literal l : enforcement_literals) {
                       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:956:10: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
    for (const Literal l : enforcement_literals) {
         ^~~~~~~~~~~~~~~~~
                       &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:959:24: warning: loop variable 'l' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
    for (const Literal l : clause) {
                       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:959:10: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
    for (const Literal l : clause) {
         ^~~~~~~~~~~~~~~~~
                       &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:973:24: warning: loop variable 'l' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
    for (const Literal l : literals) {
                       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/sat_solver.h:973:10: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
    for (const Literal l : literals) {
         ^~~~~~~~~~~~~~~~~
                       &
In file included from ext.cpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/constraint_solver/routing.h:191:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/theta_tree.h:20:
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/integer.h:1529:26: warning: loop variable 'literal' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
      for (const Literal literal : enforcement_literals) {
                         ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/integer.h:1529:12: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
      for (const Literal literal : enforcement_literals) {
           ^~~~~~~~~~~~~~~~~~~~~~~
                         &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/integer.h:1538:26: warning: loop variable 'literal' of type 'const operations_research::sat::Literal' creates a copy from type 'const operations_research::sat::Literal' [-Wrange-loop-analysis]
      for (const Literal literal : enforcement_literals) {
                         ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/integer.h:1538:12: note: use reference type 'const operations_research::sat::Literal &' to prevent copying
      for (const Literal literal : enforcement_literals) {
           ^~~~~~~~~~~~~~~~~~~~~~~
                         &
In file included from ext.cpp:4:
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/constraint_solver/routing.h:629:33: warning: loop variable 'disjunction' of type 'const operations_research::RoutingModel::DisjunctionIndex' (aka 'const IntType<operations_research::RoutingDisjunctionIndex_tag_, int>') creates a copy from type 'const operations_research::RoutingModel::DisjunctionIndex' [-Wrange-loop-analysis]
    for (const DisjunctionIndex disjunction : GetDisjunctionIndices(index)) {
                                ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/constraint_solver/routing.h:629:10: note: use reference type 'const operations_research::RoutingModel::DisjunctionIndex &' (aka 'const IntType<operations_research::RoutingDisjunctionIndex_tag_, int> &') to prevent copying
    for (const DisjunctionIndex disjunction : GetDisjunctionIndices(index)) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                &
In file included from ext.cpp:13:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rice-3.0.0/ruby/lib/include/rice/Array.hpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rice-3.0.0/ruby/lib/include/rice/Builtin_Object.hpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rice-3.0.0/ruby/lib/include/rice/Builtin_Object_defn.hpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rice-3.0.0/ruby/lib/include/rice/Object_defn.hpp:7:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rice-3.0.0/ruby/lib/include/rice/Identifier.hpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rice-3.0.0/ruby/lib/include/rice/detail/ruby.hpp:20:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/include/ruby-2.6.0/ruby.h:33:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/include/ruby-2.6.0/ruby/ruby.h:2111:
/Users/stevenchern/.rbenv/versions/2.6.3/include/ruby-2.6.0/ruby/intern.h:56:19: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
void rb_mem_clear(register VALUE*, register long);
                  ^~~~~~~~~
/Users/stevenchern/.rbenv/versions/2.6.3/include/ruby-2.6.0/ruby/intern.h:56:36: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
void rb_mem_clear(register VALUE*, register long);
                                   ^~~~~~~~~
In file included from ext.cpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/constraint_solver/routing.h:186:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/lp_solver.h:20:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/preprocessor.h:27:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/revised_simplex.h:99:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/basis_representation.h:18:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/lu_factorization.h:17:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/markowitz.h:84:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/sparse.h:37:
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/scattered_vector.h:148:22: warning: loop variable 'index' of type 'const gtl::IntType<operations_research::glop::ColIndex_tag_, int>' creates a copy from type 'const gtl::IntType<operations_research::glop::ColIndex_tag_, int>' [-Wrange-loop-analysis]
    for (const Index index : non_zeros) is_non_zero[index] = true;
                     ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/rank_one_update.h:173:8: note: in instantiation of member function 'operations_research::glop::ScatteredVector<gtl::IntType<operations_research::glop::ColIndex_tag_, int>, operations_research::glop::VectorIterator<operations_research::glop::ScatteredRowEntry> >::RepopulateSparseMask' requested here
    y->RepopulateSparseMask();
       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/scattered_vector.h:148:10: note: use reference type 'const gtl::IntType<operations_research::glop::ColIndex_tag_, int> &' to prevent copying
    for (const Index index : non_zeros) is_non_zero[index] = true;
         ^~~~~~~~~~~~~~~~~~~
                     &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/scattered_vector.h:138:24: warning: loop variable 'index' of type 'const gtl::IntType<operations_research::glop::ColIndex_tag_, int>' creates a copy from type 'const gtl::IntType<operations_research::glop::ColIndex_tag_, int>' [-Wrange-loop-analysis]
      for (const Index index : non_zeros) {
                       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/rank_one_update.h:183:8: note: in instantiation of member function 'operations_research::glop::ScatteredVector<gtl::IntType<operations_research::glop::ColIndex_tag_, int>, operations_research::glop::VectorIterator<operations_research::glop::ScatteredRowEntry> >::ClearSparseMask' requested here
    y->ClearSparseMask();
       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/scattered_vector.h:138:12: note: use reference type 'const gtl::IntType<operations_research::glop::ColIndex_tag_, int> &' to prevent copying
      for (const Index index : non_zeros) {
           ^~~~~~~~~~~~~~~~~~~
                       &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/scattered_vector.h:148:22: warning: loop variable 'index' of type 'const gtl::IntType<operations_research::glop::RowIndex_tag_, int>' creates a copy from type 'const gtl::IntType<operations_research::glop::RowIndex_tag_, int>' [-Wrange-loop-analysis]
    for (const Index index : non_zeros) is_non_zero[index] = true;
                     ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/rank_one_update.h:207:8: note: in instantiation of member function 'operations_research::glop::ScatteredVector<gtl::IntType<operations_research::glop::RowIndex_tag_, int>, operations_research::glop::VectorIterator<operations_research::glop::ScatteredColumnEntry> >::RepopulateSparseMask' requested here
    d->RepopulateSparseMask();
       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/scattered_vector.h:148:10: note: use reference type 'const gtl::IntType<operations_research::glop::RowIndex_tag_, int> &' to prevent copying
    for (const Index index : non_zeros) is_non_zero[index] = true;
         ^~~~~~~~~~~~~~~~~~~
                     &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/scattered_vector.h:138:24: warning: loop variable 'index' of type 'const gtl::IntType<operations_research::glop::RowIndex_tag_, int>' creates a copy from type 'const gtl::IntType<operations_research::glop::RowIndex_tag_, int>' [-Wrange-loop-analysis]
      for (const Index index : non_zeros) {
                       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/glop/rank_one_update.h:218:8: note: in instantiation of member function 'operations_research::glop::ScatteredVector<gtl::IntType<operations_research::glop::RowIndex_tag_, int>, operations_research::glop::VectorIterator<operations_research::glop::ScatteredColumnEntry> >::ClearSparseMask' requested here
    d->ClearSparseMask();
       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/lp_data/scattered_vector.h:138:12: note: use reference type 'const gtl::IntType<operations_research::glop::RowIndex_tag_, int> &' to prevent copying
      for (const Index index : non_zeros) {
           ^~~~~~~~~~~~~~~~~~~
                       &
In file included from ext.cpp:4:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/constraint_solver/routing.h:180:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/constraint_solver/constraint_solver.h:91:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/util/piecewise_linear_function.h:32:
In file included from /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/util/saturated_arithmetic.h:19:
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/util/bitset.h:773:28: warning: loop variable 'i' of type 'const gtl::IntType<operations_research::sat::BooleanVariable_tag_, int>' creates a copy from type 'const gtl::IntType<operations_research::sat::BooleanVariable_tag_, int>' [-Wrange-loop-analysis]
    for (const IntegerType i : to_clear_) bitset_.ClearBucket(i);
                           ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/util/bitset.h:784:7: note: in instantiation of member function 'operations_research::SparseBitset<gtl::IntType<operations_research::sat::BooleanVariable_tag_, int> >::SparseClearAll' requested here
      SparseClearAll();
      ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/pb_constraint.h:694:11: note: in instantiation of member function 'operations_research::SparseBitset<gtl::IntType<operations_research::sat::BooleanVariable_tag_, int> >::ClearAndResize' requested here
    seen_.ClearAndResize(BooleanVariable(num_variables));
          ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/util/bitset.h:773:10: note: use reference type 'const gtl::IntType<operations_research::sat::BooleanVariable_tag_, int> &' to prevent copying
    for (const IntegerType i : to_clear_) bitset_.ClearBucket(i);
         ^~~~~~~~~~~~~~~~~~~~~
                           &
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/util/bitset.h:773:28: warning: loop variable 'i' of type 'const gtl::IntType<operations_research::sat::IntegerVariable_tag_, int>' creates a copy from type 'const gtl::IntType<operations_research::sat::IntegerVariable_tag_, int>' [-Wrange-loop-analysis]
    for (const IntegerType i : to_clear_) bitset_.ClearBucket(i);
                           ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/util/bitset.h:784:7: note: in instantiation of member function 'operations_research::SparseBitset<gtl::IntType<operations_research::sat::IntegerVariable_tag_, int> >::SparseClearAll' requested here
      SparseClearAll();
      ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/sat/integer.h:787:8: note: in instantiation of member function 'operations_research::SparseBitset<gtl::IntType<operations_research::sat::IntegerVariable_tag_, int> >::ClearAndResize' requested here
    p->ClearAndResize(NumIntegerVariables());
       ^
/Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0/tmp/or-tools/include/ortools/util/bitset.h:773:10: note: use reference type 'const gtl::IntType<operations_research::sat::IntegerVariable_tag_, int> &' to prevent copying
    for (const IntegerType i : to_clear_) bitset_.ClearBucket(i);
         ^~~~~~~~~~~~~~~~~~~~~
                           &
25 warnings and 2 errors generated.
make: *** [ext.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/or-tools-0.4.0 for inspection.
Results logged to /Users/stevenchern/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/or-tools-0.4.0/gem_make.out
ankane commented 3 years ago

Hey @stevenchern, thanks for reporting! Based on this discussion (https://github.com/oracle/truffleruby/issues/1924), it looks like you can either:

  1. Use Ruby 2.7+ OR
  2. Use GCC instead of Clang. However, I don't see any easy way tell Ruby/Rice to do this right now.
stevenchern commented 3 years ago

I changed the gem version to 0.3.4 and it worked. The ruby version in this application is 2.6.3

Just in case someone is using Ubuntu, it worked with gem version 0.4.0 and ruby version 2.6.3. Pushing it to Heroku also worked with these versions.

ankane commented 3 years ago

Great, glad it's working. 0.3.4 should work on Mac with Ruby 2.6 since it doesn't use C++17, and 0.4.0 should work on Linux with Ruby 2.6 since it uses GCC instead of Clang (basically, Ruby 2.6 + Clang + C++17 is causing the error).