Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

globally installed gems are not accessible in OOD #3452

Open
johrstrom opened this issue Mar 25, 2024 · 3 comments
Open

globally installed gems are not accessible in OOD #3452

johrstrom opened this issue Mar 25, 2024 · 3 comments
Labels
area/installation bug Existing functionality not working as expected
Milestone

Comments

@johrstrom
Copy link
Contributor

From discourse: https://discourse.openondemand.org/t/dynamic-custom-dashboard-widgets/3340/15

We had a user who simply wanted to use the sqlite3 gem in a custom dashboard widget. Only to find out, OOD will not load system installed gems.

This is the current workaround, to modify the $LOAD_PATH.

<%-
  $LOAD_PATH.unshift('/usr/local/share/gems/gems/sqlite3-1.7.3-x86_64-linux/lib')
  require 'sqlite3'
-%>

It seems like we should be able to find/use gems in system installed locations like /usr/local/share/gems.

@johrstrom johrstrom added bug Existing functionality not working as expected area/installation labels Mar 25, 2024
@johrstrom johrstrom added this to the 4.0 milestone Mar 25, 2024
@treydock
Copy link
Contributor

This can open up issues if that gem was built with different version of Ruby. That location also looks custom.

$ sudo dnf provides /usr/local/share/gems/gems/sqlite3-1.7.3-x86_64-linux/lib
Updating Subscription Management repositories.
Last metadata expiration check: 0:43:19 ago on Thu 28 Mar 2024 11:15:04 AM EDT.
Error: No Matches found

Doing this shows paths not under /usr/local:

$ sudo dnf repoquery -l rubygem-sqlite3
<SNIP>
/usr/share/gems/gems/sqlite3-1.4.2/lib/sqlite3.rb
<SNIP>

This path is custom which is why it wasn't loaded. We should limit how much we support custom things as that can open up maintenance issues.

@johrstrom
Copy link
Contributor Author

Yea the EL module system doesn't work well for us here. The ruby we use comes from a module, but there aren't rubygem-* variants for all the modules - they all rely on the base version (from epel i think?) which on EL is like 2.5.

This can open up issues if that gem was built with different version of Ruby. That location also looks custom.

That's where gem install sqlite3 put it when running as root.

@treydock
Copy link
Contributor

I took fresh OnDemand install for 3.1 and seeing issues, not sure if related.

[root@ca7cd0983147 /]# scl enable ondemand -- gem install sqlite3 --no-doc
[root@ca7cd0983147 /]# scl enable ondemand -- gem which sqlite3
/usr/local/share/gems/gems/sqlite3-1.7.3-aarch64-linux/lib/sqlite3.rb
[root@ca7cd0983147 /]# scl enable ondemand -- gem list | grep sqlite3
sqlite3 (1.7.3 aarch64-linux)
[root@ca7cd0983147 /]# scl enable ondemand -- irb
irb(main):001:0> require 'sqlite3'
<internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/local/share/gems/gems/sqlite3-1.7.3-aarch64-linux/lib/sqlite3.rb:6:in `rescue in <top (required)>'
	from /usr/local/share/gems/gems/sqlite3-1.7.3-aarch64-linux/lib/sqlite3.rb:2:in `<top (required)>'
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:160:in `require'
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require'
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:149:in `require'
	from (irb):1:in `<main>'
	from /usr/share/gems/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
	from /usr/bin/irb:25:in `load'
	from /usr/bin/irb:25:in `<main>'
<internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require': /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/share/gems/gems/sqlite3-1.7.3-aarch64-linux/lib/sqlite3/3.1/sqlite3_native.so) - /usr/local/share/gems/gems/sqlite3-1.7.3-aarch64-linux/lib/sqlite3/3.1/sqlite3_native.so (LoadError)

I was able to install sqlite and load it but sqlite3 throws errors related to glibc. However this works:

[root@ca7cd0983147 /]# scl enable ondemand -- gem install sqlite3 --no-doc --platform ruby
[root@ca7cd0983147 /]# scl enable ondemand -- irb
irb(main):001:0> require 'sqlite3'
=> true

Not sure if this is because I'm testing on ARM64 Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/installation bug Existing functionality not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants