Gem installation failing on Ubuntu despite installing libtorch
Closed this issue · 3 comments
derrelldurrett commented
I'm trying to install torchvision
on Ubuntu 18.04 (Ruby 2.7.1). It fails with:
have_library: checking for -ltorch... -------------------- no
"g++ -o conftest -I/home/derrell/.rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/x86_64-linux -I/home/derrell/.rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/backward -I/home/derrell/.rvm/rubies/ruby-2.7.1/include/ruby-2.7.0 -I. -I/home/derrell/.rvm/gems/ruby-2.7.1/gems/rice-2.2.0/ruby/lib/include -g -O2 conftest.c -L. -L/home/derrell/.rvm/rubies/ruby-2.7.1/lib -Wl,-rpath,/home/derrell/.rvm/rubies/ruby-2.7.1/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -L/home/derrell/.rvm/gems/ruby-2.7.1/gems/rice-2.2.0/ruby/lib/lib -lrice -L/usr/local/lib -lgomp -lstdc++ -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby -ltorch -lgomp -lstdc++ -lm -lc"
/usr/bin/ld: cannot find -ltorch
collect2: error: ld returned 1 exit status
This is despite having directly installed libtorch
via apt install libtorch
:
~/RubymineProjects/MachineLearningRuby$ locate libtorch
/usr/lib/libtorch.so.3
/usr/lib/libtorch.so.3.0.0
Any suggestions?
Thanks!
derrelldurrett commented
Grrr. Apparently this can be solved by linking /usr/lib/libtorch.so
to the underlying version.
Unfortunately, build problems persist with no torch.h
anywhere...
ankane commented
Hey @derrelldurrett, it looks like apt install libtorch
installs libtorch3c2
, which is a different package. Try the instructions here: https://github.com/ankane/torch.rb#libtorch-installation
ankane commented
Cleaning up issues