ibmdb / ruby-ibmdb

Rails Adapter/Ruby driver for IBM DB2 and IBM Informix
42 stars 48 forks source link

libdb2.so.1: cannot open shared object file: No such file or directory #142

Closed styrken closed 1 year ago

styrken commented 1 year ago

Hello,

I have installed version 5.3.2 of this gem and bundling worked fine:

Fetching gem metadata from https://rubygems.org/
Fetching gem metadata from https://rubygems.org/.........
Using rake 13.0.6
Using concurrent-ruby 1.1.10
Using minitest 5.16.3
Using zeitwerk 2.6.6
Using erubi 1.11.0
Using racc 1.6.0
Using crass 1.0.6
Using rack 2.2.4
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using marcel 1.0.2
Using builder 3.2.4
Using mini_mime 1.1.2
Using multi_json 1.15.0
Using method_source 1.0.0
Using thor 1.2.1
Using public_suffix 5.0.0
Using net-ssh 7.0.1
Using bcrypt 3.1.18
Using bindex 0.8.1
Using msgpack 1.5.6
Using rb-fsevent 0.11.2
Using ffi 1.15.5
Using uniform_notifier 1.16.0
Using bundler 2.2.22
Using cancancan 3.4.0
Using matrix 0.4.2
Using regexp_parser 2.5.0
Using mini_magick 4.11.0
Using ssrf_filter 1.1.1
Using childprocess 4.1.0
Using chronic 0.10.2
Using cocoon 1.2.15
Using coffee-script-source 1.12.2
Using execjs 2.8.1
Using rexml 3.2.5
Using daemons 1.4.1
Using database_cleaner-core 2.0.1
Using parslet 1.8.2
Using io-console 0.5.11
Using ruby2_keywords 0.0.5
Using tilt 2.0.11
Using orm_adapter 0.5.0
Using diff-lcs 1.5.0
Using docile 1.4.0
Using hashdiff 1.0.1
Using zip 2.0.2
Using json 2.6.2
Using kaminari-core 1.2.2
Using redis 4.8.0
Using rubyzip 2.3.2
Using ruby-ole 1.2.12.2
Using rspec-support 3.11.1
Using select2-rails 4.0.13
Using websocket 1.2.9
Using simplecov-html 0.12.3
Using simplecov_json_formatter 0.1.4
Using sqlite3 1.5.0 (x86_64-linux)
Using i18n 1.12.0
Using tzinfo 2.0.5
Using nokogiri 1.13.9 (x86_64-linux)
Using rack-test 2.0.2
Using warden 1.2.9
Using sprockets 4.1.1
Using request_store 1.5.1
Using rack-cors 1.1.1
Using puma 5.6.5
Using activesupport 6.1.7
Using rack-protection 3.0.0
Using loofah 2.19.0
Using websocket-driver 0.7.5
Using mail 2.7.1
Using addressable 2.8.1
Using net-scp 1.2.1
Using bootsnap 1.13.0
Using rb-inotify 0.10.1
Using xpath 3.2.0
Using ruby-vips 2.1.4
Using coffee-script 2.4.1
Using crack 0.4.5
Using ddl_parser 0.0.16
Using reline 0.3.1
Using mustermann 3.0.0
Using sassc 2.4.0
Using roo 2.9.0
Using spreadsheet 1.3.0
Using rspec-expectations 3.11.1
Using rspec-core 3.11.0
Using rspec-mocks 3.11.1
Using selenium-webdriver 4.4.0
Using simplecov 0.21.2
Using whenever 1.0.0
Using rails-html-sanitizer 1.4.3
Using sshkit 1.21.3
Using sass-listen 4.0.0
Using capybara 3.37.1
Using irb 1.4.1
Using image_processing 1.12.2
Using launchy 2.5.0
Using recipient_interceptor 0.3.1
Using roo-xls 1.2.0
Using rspec-collection_matchers 1.2.0
Using webdrivers 5.1.0
Using webmock 3.18.1
Using rails-dom-testing 2.0.3
Using globalid 1.0.0
Using activemodel 6.1.7
Using airbrussh 1.4.1
Using sass 3.7.4
Using bullet 7.0.3
Using delayed_job 4.1.10
Using factory_bot 4.11.1
Using time_difference 0.5.0
Using sinatra 3.0.0
Using actionview 6.1.7
Using activejob 6.1.7
Using activerecord 6.1.7
Using bootstrap-sass 2.2.2.0
Using capistrano 3.17.1
Using debug 1.6.2
Using letter_opener 1.8.1
Using protected_attributes_continued 1.8.2
Using carrierwave 2.2.2
Using default_value_for 3.4.0 from https://github.com/FooBarWidget/default_value_for.git (at master@7f6cdb7)
Using delayed_job_active_record 4.1.7
Using delayed_job_web 1.4.4
Fetching ibm_db 5.3.2
Using jbuilder 2.11.5
Using kaminari-actionview 1.2.2
Using kaminari-activerecord 1.2.2
Using paper_trail 13.0.0
Using actionpack 6.1.7
Using awesome_nested_set 3.5.0
Using annotate 3.2.0
Using database_cleaner-active_record 2.0.1
Using actioncable 6.1.7
Using activestorage 6.1.7
Using actionmailer 6.1.7
Using railties 6.1.7
Using acts_as_commentable_with_threading 2.0.1
Using sprockets-rails 3.4.2
Using kaminari 1.2.2
Using rails-controller-testing 1.0.5
Using simple_form 5.1.0
Using actionmailbox 6.1.7
Using actiontext 6.1.7
Using activerecord-session_store 2.0.0
Using bootstrap-wysihtml5-rails 0.3.3.8
Using coffee-rails 5.0.0
Using cssbundling-rails 1.1.1
Using database_cleaner 2.0.1
Using responders 3.0.1
Using factory_bot_rails 4.11.1
Using jquery-rails 4.5.0
Fetching sassc-rails 2.1.2
Installing sassc-rails 2.1.2
Installing ibm_db 5.3.2 with native extensions
Using jsbundling-rails 1.0.3
Using rspec-rails 5.1.2
Using stimulus-rails 1.1.0
Using turbo-rails 1.3.0
Using web-console 4.2.0
Using rails 6.1.7
Using devise 4.8.1
Using highlight_js-rails 7.1.0
Fetching sass-rails 6.0.0
Installing sass-rails 6.0.0
Fetching jquery-datatables-rails 3.4.0
Installing jquery-datatables-rails 3.4.0
Bundle complete! 59 Gemfile dependencies, 165 gems now installed.
Bundled gems are installed into `./vendor/bundle`

But when i run the rails app it fails:

RAILS_ENV=staging bundle exec rails s

/home/rts/app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': libdb2.so.1: cannot open shared object file: No such file or directory - /home/rts/app/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/ibm_db-5.3.2/ibm_db.so (LoadError)
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
        from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/runtime.rb:61:in `each'
        from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/runtime.rb:61:in `block in require'
        from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/runtime.rb:50:in `each'
        from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/runtime.rb:50:in `require'
        from /usr/share/gems/gems/bundler-2.2.22/lib/bundler.rb:174:in `require'
        from /home/rts/app/config/application.rb:7:in `<main>'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `block in require'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:299:in `load_dependency'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in `require'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails/commands/server/server_command.rb:138:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails/commands/server/server_command.rb:135:in `perform'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails/command/base.rb:69:in `perform'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails/command.rb:48:in `invoke'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails/commands.rb:18:in `<main>'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
        from /home/rts/app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'

Server Information

I was under the impression the driver is automatically installed during bundling. Is there anything i am doing wrong here?

praveen-db2 commented 1 year ago

@styrken Its failing becoz it couldnt find libdb2.so.1 library. You need to set below env variable as per environment. _Windows: set LIB=%IBM_DB_HOME%/lib;%LIB%

AIX:
export LIBPATH=$IBM_DB_HOME/lib:$LIBPATH

MAC:
export DYLD_LIBRARY_PATH=$IBM_DB_HOME/lib:$DYLD_LIBRARY_PATH

Other platforms:
export LD_LIBRARY_PATH=$IBM_DB_HOME/lib:$LD_LIBRARY_PATH_

Ideally above env variable must be pointing to location where libdb2.so is located.

I am giving above information assuming you had set IBM_DB_HOME env var, if not you need set as below export IBM_DB_HOME="path to clidriver folder"

styrken commented 1 year ago

Hi @praveen-db2

Thank you, it seems to work now.