Closed kgilpin closed 3 months ago
Steps to recreate the issue.
Using a CentOS Stream version 9 running on a virtual machine.
Using the mainline branch from this Rails project: https://github.com/land-of-apps/rails-test-project
System ruby on Stream 9 uses 3.0.4
- so i updated the Gemfile to support
ruby "3.0.4"
ruby -v
ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [aarch64-linux]
Then add AppMap to the Gemfile and bundle install
gem 'appmap', :groups => [:development, :test]
Bundle install should complete sucessfully.
Now run bundle exec rails server
You will get the following error:
$ bundle exec rails server
/home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/appmap-1.0.0/lib/appmap/agent.rb:12:in `require_relative': cannot load such file -- /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/appmap-1.0.0/lib/appmap/appmap (LoadError)
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/appmap-1.0.0/lib/appmap/agent.rb:12:in `<main>'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/appmap-1.0.0/lib/appmap.rb:24:in `<main>'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/centos/.local/share/gem/ruby/gems/bundler-2.3.22/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
from /home/centos/.local/share/gem/ruby/gems/bundler-2.3.22/lib/bundler/runtime.rb:55:in `each'
from /home/centos/.local/share/gem/ruby/gems/bundler-2.3.22/lib/bundler/runtime.rb:55:in `block in require'
from /home/centos/.local/share/gem/ruby/gems/bundler-2.3.22/lib/bundler/runtime.rb:44:in `each'
from /home/centos/.local/share/gem/ruby/gems/bundler-2.3.22/lib/bundler/runtime.rb:44:in `require'
from /home/centos/.local/share/gem/ruby/gems/bundler-2.3.22/lib/bundler.rb:187:in `require'
from /home/centos/rails-test-project/config/application.rb:7:in `<main>'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:137:in `block in perform'
from <internal:kernel>:90:in `tap'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:134:in `perform'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/centos/rails-test-project/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from bin/rails:4:in `<main>'
Additional testing internally
Coming back to this - still not entirely sure what is with this path issue with require_relative But i will still hit it with APPMAP=false > https://gist.github.com/petecheslock/0ebe798652c1c3d4b110b2ab513c9e70
if i do require_relative "../appmap" - i can get the app to start with APPMAP false
but running with appmap true will cause new problems. which kinda makes sense. https://gist.github.com/petecheslock/facc43532f68488b244c9402e1b143de
Ok - this seems to be directly related to the system ruby on Centos Stream 9 (although i can not tell you why).
Using ASDF to install ruby 3.1.2 - Works as expected, no error
Using ASDF to install the same version of ruby as the system ruby 3.0.4 - Works as expected, no error
So there is clearly some problem with the version of ruby that comes via installation using Centos package managers.
Recommend for users who find this github issue is to install another version of ruby using rbenv
or asdf
and not use the system ruby available from centos upstream package managers.
These are the affected versions
ruby.aarch64 3.0.4-161.el9 @appstream
ruby-default-gems.noarch 3.0.4-161.el9 @appstream
ruby-devel.aarch64 3.0.4-161.el9 @appstream
ruby-libs.aarch64 3.0.4-161.el9 @appstream