ankane / or-tools-ruby

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

Trouble installing on Ubuntu 18.04LTS #47

Closed scrapcycle closed 1 year ago

scrapcycle commented 1 year ago

Hello,

Not sure what the right way to do this is, but landed here after wrestling with this for a week.

I've used this library before, but don't remember having this problem.

Are there prereqs I need to have installed before this works. When I try to install just by adding the gem, I get this error:

find_header: checking for rice/rice.hpp in /home/ubuntu/.rvm/gems/ruby-3.2.0/gems/rice-4.1.0/include... -------------------- no

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib "g++ -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0 -I.     conftest.cc  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby  -lm -lpthread  -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib "g++ -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0 -I.     -std=c++17   -c conftest.cc"
conftest.cc:3:10: fatal error: rice/rice.hpp: No such file or directory
 #include <rice/rice.hpp>
          ^~~~~~~~~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <rice/rice.hpp>
/* end */

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib "g++ -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0 -I.     -std=c++17  -I/home/ubuntu/.rvm/gems/ruby-3.2.0/gems/rice-4.1.0/include -c conftest.cc"
In file included from conftest.cc:3:0:
/home/ubuntu/.rvm/gems/ruby-3.2.0/gems/rice-4.1.0/include/rice/rice.hpp:1208:10: fatal error: filesystem: No such file or directory
 #include <filesystem>
          ^~~~~~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <rice/rice.hpp>
/* end */

--------------------

I've tried adding rice "manually" by gem installing and adding to the Gemfile, but nothing seems to work.

Any ideas?

Bob

ankane commented 1 year ago

Hi @scrapcycle, it looks like Rice 4.1.0 uses filesystem, which is experimental with GCC 7.4 (the default version on Ubuntu 18.04). Try using an earlier version in your Gemfile.

gem "rice", "< 4.1"
scrapcycle commented 1 year ago

Similar output plus new failures w/ or-tools:

find_header: checking for rice/rice.hpp in /home/ubuntu/.rvm/gems/ruby-3.2.0/gems/rice-4.0.4/include... -------------------- yes

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib "g++ -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0 -I.     conftest.cc  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby  -lm -lpthread  -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib "g++ -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0 -I.     -std=c++17   -c conftest.cc"
conftest.cc:3:10: fatal error: rice/rice.hpp: No such file or directory
 #include <rice/rice.hpp>
          ^~~~~~~~~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <rice/rice.hpp>
/* end */

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib "g++ -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0 -I.     -std=c++17  -I/home/ubuntu/.rvm/gems/ruby-3.2.0/gems/rice-4.0.4/include -c conftest.cc"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <rice/rice.hpp>
/* end */

--------------------

have_library: checking for -lstdc++... -------------------- yes

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib "g++ -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0 -I. -I/home/ubuntu/.rvm/gems/ruby-3.2.0/gems/rice-4.0.4/include     conftest.cc  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby -lstdc++  -lm -lpthread  -lc"
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11: 
12:   return !!argv[argc];
13: }
14: 
15: int t(void) { ; return 0; }
/* end */

--------------------

have_library: checking for -lortools... -------------------- no

LD_LIBRARY_PATH=.:/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib "g++ -o conftest -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-3.2.0/include/ruby-3.2.0 -I. -I/home/ubuntu/.rvm/gems/ruby-3.2.0/gems/rice-4.0.4/include -I/home/ubuntu/.rvm/gems/ruby-3.2.0/gems/or-tools-0.10.1/tmp/or-tools/include     conftest.cc  -L. -L/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib -Wl,-rpath,/home/ubuntu/.rvm/rubies/ruby-3.2.0/lib -Wl,-rpath,'$ORIGIN/../../tmp/or-tools/lib' -L/home/ubuntu/.rvm/gems/ruby-3.2.0/gems/or-tools-0.10.1/tmp/or-tools/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed    -lstdc++  -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby -lortools -lstdc++  -lm -lpthread  -lc"
/home/ubuntu/.rvm/gems/ruby-3.2.0/gems/or-tools-0.10.1/tmp/or-tools/lib/libortools.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve()@GLIBCXX_3.4.29'
/home/ubuntu/.rvm/gems/ruby-3.2.0/gems/or-tools-0.10.1/tmp/or-tools/lib/libortools.so: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/home/ubuntu/.rvm/gems/ruby-3.2.0/gems/or-tools-0.10.1/tmp/or-tools/lib/libortools.so: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()@GLIBCXX_3.4.26'
/home/ubuntu/.rvm/gems/ruby-3.2.0/gems/or-tools-0.10.1/tmp/or-tools/lib/libortools.so: undefined reference to `std::to_chars(char*, char*, double)@GLIBCXX_3.4.29'
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11: 
12:   return !!argv[argc];
13: }
14: 
15: int t(void) { ; return 0; }
/* end */

--------------------

Any new ideas? ( or did I do it wrong? )

I gem uninstalled rice ( all versions) and ran bundle w/ the new entry in the Gemfile.

ankane commented 1 year ago

Not sure why that one's failing, but think it may be something specific to your set up (Ubuntu 18.04 was working on CI before GitHub Actions retired it, fwiw). Since Ubuntu 18.04 will reach EOL shortly, I won't be able to spend more time on it.

scrapcycle commented 1 year ago

Ha. ok. Thanks for trying.