isamu / rocksdb-ruby

A simple RocksDB library for Ruby
MIT License
75 stars 24 forks source link

LoadError: cannot load such file -- rocksdb/RocksDB #38

Open vt-alt opened 1 year ago

vt-alt commented 1 year ago
$ bundle config set --local path 'vendor/bundle'
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Fetching ffi 1.15.5
Fetching rack 3.0.8
Fetching rocksdb-ruby 1.0.4
Fetching zlib 3.0.0
Fetching thread 0.2.2
Installing zlib 3.0.0 with native extensions
Installing thread 0.2.2
Installing rocksdb-ruby 1.0.4 with native extensions
Installing rack 3.0.8
Installing ffi 1.15.5 with native extensions
Fetching ffi-libarchive 1.1.3
Fetching sys-filesystem 1.4.3
Installing ffi-libarchive 1.1.3
Installing sys-filesystem 1.4.3
Bundle complete! 6 Gemfile dependencies, 8 gems now installed.
Bundled gems are installed into `./vendor/bundle`

$ pry
[1] pry(main)> require 'bundler/setup'
=> true
[2] pry(main)> require 'rocksdb'
LoadError: cannot load such file -- rocksdb/RocksDB
from <internal:/usr/local/lib/ruby/rubygems/core_ext/kernel_require.rb>:38:in `require'

After straceing that require call into logfile a:

$ grep vendor/bundle/ruby/3.1.0/gems/rocksdb-ruby-1.0.4.*RocksDB.so a
openat(AT_FDCWD, "vendor/bundle/ruby/3.1.0/gems/rocksdb-ruby-1.0.4/ext/rocksdb/RocksDB.so", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "vendor/bundle/ruby/3.1.0/gems/rocksdb-ruby-1.0.4/lib/rocksdb/RocksDB.so", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 ENOENT (No such file or directory)

$ find -name RocksDB.so
./vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0/rocksdb-ruby-1.0.4/RocksDB/RocksDB.so
./vendor/bundle/ruby/3.1.0/gems/rocksdb-ruby-1.0.4/ext/RocksDB/RocksDB.so

$ ls -l vendor/bundle/ruby/3.1.0/gems/rocksdb-ruby-1.0.4/ext/
total 8
drwxr-xr-x 2 indexer indexer 4096 Aug 13 16:15 rocksdb
drwxr-xr-x 2 indexer indexer 4096 Aug 13 16:12 RocksDB

$ ls -l vendor/bundle/ruby/3.1.0/gems/rocksdb-ruby-1.0.4/ext/*
vendor/bundle/ruby/3.1.0/gems/rocksdb-ruby-1.0.4/ext/rocksdb:
total 76
-rw-r--r-- 1 indexer indexer  511 Aug 13 16:12 extconf.rb
-rw-r--r-- 1 indexer indexer 8517 Aug 13 16:12 Makefile
-rw-r--r-- 1 indexer indexer 1073 Aug 13 16:12 rocksdb_batch_rb.cc
-rw-r--r-- 1 indexer indexer  330 Aug 13 16:12 rocksdb_batch_rb.h
-rw-r--r-- 1 indexer indexer 8384 Aug 13 16:12 rocksdb_db_rb.cc
-rw-r--r-- 1 indexer indexer 1539 Aug 13 16:12 rocksdb_db_rb.h
-rw-r--r-- 1 indexer indexer 8496 Aug 13 16:12 rocksdb_iterator_rb.cc
-rw-r--r-- 1 indexer indexer 1308 Aug 13 16:12 rocksdb_iterator_rb.h
-rw-r--r-- 1 indexer indexer 5209 Aug 13 16:12 rocksdb_rb.cc
-rw-r--r-- 1 indexer indexer 1328 Aug 13 16:12 rocksdb_rb.h
-rw-r--r-- 1 indexer indexer   18 Aug 13 16:12 rocksdb_status_rb.cc
-rw-r--r-- 1 indexer indexer   18 Aug 13 16:12 rocksdb_status_rb.h

vendor/bundle/ruby/3.1.0/gems/rocksdb-ruby-1.0.4/ext/RocksDB:
total 564
-rwxr-xr-x 1 indexer indexer 576336 Aug 13 16:12 RocksDB.so

So RocksDB.so is in RocksDB/ not in rocksdb/, perhaps you should put it in rocksdb/. Not all systems have case insensitive filenames.

bo-tato commented 1 year ago

I had same issue and like you say moving from ext/RocksDB/RocksDB.so into ext/rocksdb/RocksDB.so fixed it

jtippett commented 11 months ago

similar issue. Ludicrous workaround in my Dockerfile was

RUN bundle install
RUN cp /usr/local/bundle/gems/rocksdb-ruby-1.0.4/ext/RocksDB/* /usr/local/bundle/gems/rocksdb-ruby-1.0.4/ext/rocksdb