Library not loaded (libcrypto) - ruby

After updating ruby and rubyenv packages I'm facing an error. The libcrypto library is not loaded.
When executing the suggested command it seems that it is searching for openssl in ruby /Users/User/.rvm/rubies/ruby-2.4.1. But on my system I use /usr/local/Cellar/ruby/2.6.5.
$ gem pristine executable-hooks --version 1.3.2
Error loading RubyGems plugin "/Users/User/.rvm/gems/ruby-2.4.1#global/gems/gem-wrappers-1.2.7/lib/rubygems_plugin.rb": dlopen(/Users/User/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /Users/User/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle
Reason: image not found - /Users/User/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle (LoadError)
ERROR: Loading command: pristine (LoadError)
dlopen(/Users/User/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /Users/User/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle
Reason: image not found - /Users/User/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin16/openssl.bundle
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
I used the above command to diagnose another error (maybe this helps):
$ bundle install --system
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2
Ignoring gem-wrappers-1.2.7 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.2.7
Ignoring unf_ext-0.0.7.4 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.4
/Users/User/.rbenv/versions/2.3.1/lib/ruby/2.3.0/digest.rb:16:in `const_missing': library not found for class Digest::MD5 -- digest/md5 (LoadError)
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/source/rubygems/remote.rb:26:in `cache_slug'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/fetcher/compact_index.rb:107:in `cache_path'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/fetcher/compact_index.rb:83:in `compact_index_client'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/cli.rb:630:in `warn_on_outdated_bundler'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/cli.rb:15:in `ensure in start'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/cli.rb:16:in `start'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/exe/bundle:35:in `block in <top (required)>'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/exe/bundle:27:in `<top (required)>'
from /Users/User/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
from /Users/User/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'
mdm:ios si$ export PATH="/usr/local/opt/openssl#1.1/bin:$PATH"
mdm:ios si$ bundle install --system
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2
Ignoring gem-wrappers-1.2.7 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.2.7
Ignoring unf_ext-0.0.7.4 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.4
/Users/User/.rbenv/versions/2.3.1/lib/ruby/2.3.0/digest.rb:16:in `const_missing': library not found for class Digest::MD5 -- digest/md5 (LoadError)
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/source/rubygems/remote.rb:26:in `cache_slug'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/fetcher/compact_index.rb:107:in `cache_path'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/fetcher/compact_index.rb:83:in `compact_index_client'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/cli.rb:630:in `warn_on_outdated_bundler'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/cli.rb:15:in `ensure in start'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/cli.rb:16:in `start'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/exe/bundle:35:in `block in <top (required)>'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
from /Users/User/.rvm/gems/ruby-2.4.1#global/gems/bundler-1.15.1/exe/bundle:27:in `<top (required)>'
from /Users/User/.rbenv/versions/2.3.1/bin/bundle:23:in `load'
from /Users/User/.rbenv/versions/2.3.1/bin/bundle:23:in `<main>'

I did a quick test:
rvm 2.6.5
To determine that ruby-2.6.5 was not installed, so I installed it:
rvm install "ruby-2.6.5"

You say you are using the system Ruby from /usr/local/ yet the error messages are from an RVM installation.
You need to either uninstall RVM, or set the system Ruby as default for RVM:
rvm --default use system
More discussion here:
Disable RVM or use Ruby which was installed without RVM?

Related

Why does `gem install` succeed but `bundle install` fails?

I'm trying to install gtk3, but bundle install chokes while installing atk. Most of the responses seem to resolve around mismatched versions in the lock file. Removing the lock file doesn't help, neither does installing the matching version of bundle.
$ bundle install
Fetching gem metadata from https://rubygems.org/....
Resolving dependencies...
Using bundler 2.4.6
Fetching native-package-installer 1.1.5
Fetching pkg-config 1.5.1
Installing pkg-config 1.5.1
Installing native-package-installer 1.1.5
Fetching glib2 3.5.1
Installing glib2 3.5.1 with native extensions
Fetching atk 3.5.1
Installing atk 3.5.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/gems/atk-3.5.1/dependency-check
rake RUBYARCHDIR\=/home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/atk-3.5.1
RUBYLIBDIR\=/home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/atk-3.5.1
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems.rb:263:in `find_spec_for_exe': can't find gem
rake (>= 0.a) with executable rake (Gem::GemNotFoundException)
from /home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems.rb:282:in `activate_bin_path'
from /home/sproctor/.rvm/gems/ruby-2.7.7/bin/rake:23:in `<main>'
from /home/sproctor/.rvm/gems/ruby-2.7.7/bin/ruby_executable_hooks:22:in `eval'
from /home/sproctor/.rvm/gems/ruby-2.7.7/bin/ruby_executable_hooks:22:in `<main>'
rake failed, exit code 1
Gem files will remain installed in /home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/gems/atk-3.5.1 for inspection.
Results logged to
/home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/atk-3.5.1/gem_make.out
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:102:in `run'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/rake_builder.rb:28:in `build'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:170:in `build_extension'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:204:in `block in
build_extensions'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:201:in `each'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:201:in `build_extensions'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/installer.rb:843:in `build_extensions'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/rubygems_gem_installer.rb:72:in `build_extensions'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/rubygems_gem_installer.rb:28:in `install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/source/rubygems.rb:200:in `install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/gem_installer.rb:54:in `install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/parallel_installer.rb:155:in
`do_install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/parallel_installer.rb:146:in `block in
worker_pool'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:62:in `apply_func'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:57:in `block in process_queue'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:54:in `loop'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:54:in `process_queue'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:90:in `block (2 levels) in
create_threads'
An error occurred while installing atk (3.5.1), and Bundler cannot continue.
In Gemfile:
atk
However, installing via gem works fine.
gem install atk -v 3.5.1
Building native extensions. This could take a while...
Successfully installed atk-3.5.1
Parsing documentation for atk-3.5.1
Done installing documentation for atk after 0 seconds
1 gem installed
This isn't a great answer, so if someone has a more in depth explanation, please feel free to give a better answer.
gem install gtk3 and bundle install use a different copy of rake.
The only difference between the two is the shebang line. The version from bundler is #!/usr/bin/env ruby_executable_hooks while the other version points to a specific version of ruby.
I'm not sure why this fails for the bundler version.
An easy workaround mentioned here: https://github.com/postmodern/digest-crc/issues/18#issuecomment-652889761 is to add gem "rake" to your Gemfile.

Ignoring bcrypt-3.1.16 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.16

I'm receiving this giant error when i try to install bundler or rails or even when i try to start the server. any suggestions please? I am a beginner and have no idea what to do??? I already tried what the error suggested (install libyaml) and reinstalling ruby but it still does the same thing. Also tried gem pristine all but nothing.
gem install bundler
Ignoring bcrypt-3.1.16 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.16
Ignoring bindex-0.8.1 because its extensions are not built. Try: gem pristine bindex --version 0.8.1
Ignoring bootsnap-1.13.0 because its extensions are not built. Try: gem pristine bootsnap --version 1.13.0
Ignoring bootsnap-1.7.5 because its extensions are not built. Try: gem pristine bootsnap --version 1.7.5
Ignoring byebug-11.1.3 because its extensions are not built. Try: gem pristine byebug --version 11.1.3
Ignoring date-3.3.3 because its extensions are not built. Try: gem pristine date --version 3.3.3
Ignoring debug-1.7.1 because its extensions are not built. Try: gem pristine debug --version 1.7.1
Ignoring debug-1.6.2 because its extensions are not built. Try: gem pristine debug --version 1.6.2
Ignoring digest-3.1.0 because its extensions are not built. Try: gem pristine digest --version 3.1.0
Ignoring eventmachine-1.2.7 because its extensions are not built. Try: gem pristine eventmachine --version 1.2.7
Ignoring ffi-1.15.3 because its extensions are not built. Try: gem pristine ffi --version 1.15.3
Ignoring ffi-1.15.1 because its extensions are not built. Try: gem pristine ffi --version 1.15.1
Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
/Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
Traceback (most recent call last):
23: from /Users/angie/.rvm/rubies/ruby-2.7.4/bin/gem:21:in `<main>'
22: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/gem_runner.rb:44:in `run'
21: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/gem_runner.rb:79:in `do_configuration'
20: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/gem_runner.rb:79:in `new'
19: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/config_file.rb:182:in `initialize'
18: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/config_file.rb:332:in `load_file'
17: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems.rb:715:in `load_yaml'
16: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
15: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
14: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/yaml.rb:4:in `<top (required)>'
13: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
12: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
11: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/psych.rb:15:in `<top (required)>'
10: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
9: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
8: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/psych/nodes.rb:2:in `<top (required)>'
7: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
6: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
5: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/psych/nodes/node.rb:4:in `<top (required)>'
4: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
3: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
2: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/psych/scalar_scanner.rb:2:in `<top (required)>'
1: from /Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
/Users/angie/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require': dlopen(/Users/angie/.rvm/gems/ruby-2.7.4/gems/strscan-3.0.4/lib/strscan.bundle, 0x0009): tried: '/Users/angie/.rvm/gems/ruby-2.7.4/gems/strscan-3.0.4/lib/strscan.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/strscan.bundle' (no such file), '/usr/lib/strscan.bundle' (no such file) - /Users/angie/.rvm/gems/ruby-2.7.4/gems/strscan-3.0.4/lib/strscan.bundle (LoadError)

"invalid gem" with different versions of ruby and its packages

I know very little about ruby and its package management. On a Ubuntu 16.04 system, there seems to be something messed up with different versions of ruby. I tried to run pdfbeads ruby program.
$ pdfbeads -o all.pdf
/home/t/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require': iconv will be deprecated in the future, use String#encode instead.
/home/t/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:128:in `require': libMagickCore.so.5: cannot open shared object file: No such file or directory - /home/t/.rvm/gems/ruby-1.9.3-p551/extensions/x86_64-linux/1.9.1/rmagick-2.13.4/RMagick2.so (LoadError)
from /home/t/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from /home/t/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:39:in `require'
from /home/t/.rvm/gems/ruby-1.9.3-p551/gems/rmagick-2.13.4/lib/rmagick_internal.rb:11:in `<top (required)>'
from /home/t/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/t/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/t/.rvm/gems/ruby-1.9.3-p551/gems/rmagick-2.13.4/lib/RMagick.rb:1:in `<top (required)>'
from /home/t/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/t/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/t/.rvm/gems/ruby-1.9.3-p551/gems/pdfbeads-1.1.1/lib/pdfbeads.rb:35:in `<top (required)>'
from /home/t/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/t/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/t/.rvm/gems/ruby-1.9.3-p551/gems/pdfbeads-1.1.1/bin/pdfbeads:38:in `<top (required)>'
from /home/t/.rvm/gems/ruby-1.9.3-p551/bin/pdfbeads:23:in `load'
from /home/t/.rvm/gems/ruby-1.9.3-p551/bin/pdfbeads:23:in `<main>'
from /home/t/.rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in `eval'
from /home/t/.rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in `<main>'
I first found that the default pdfbeads isn't the one for the latest version of ruby, so I call the latter directly:
$ which pdfbeads
/home/t/.rvm/gems/ruby-1.9.3-p551/bin/pdfbeads
$ whereis pdfbeads
pdfbeads: /usr/local/bin/pdfbeads /home/t/.rvm/gems/ruby-1.9.3-p551/bin/pdfbeads
$ whereis gem
gem: /usr/bin/gem2.3 /usr/bin/gem /home/t/.rvm/rubies/ruby-1.9.3-p551/bin/gem /usr/share/man/man1/gem.1.gz
$ gem --version
2.4.3
$ /usr/local/bin/pdfbeads -o all.pdf
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2
Ignoring gem-wrappers-1.2.7 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.2.7
Ignoring nokogiri-1.6.6.2 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.6.2
Ignoring rmagick-2.13.4 because its extensions are not built. Try: gem pristine rmagick --version 2.13.4
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- iconv (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/t/.rvm/gems/ruby-1.9.3-p551/gems/pdfbeads-1.1.1/bin/pdfbeads:35:in `<top (required)>'
from /usr/local/bin/pdfbeads:23:in `load'
from /usr/local/bin/pdfbeads:23:in `<main>'
Hoping to solve the problem, I run the suggested gem command, but what does the error mean here?
$ gem pristine executable-hooks --version 1.3.2
Restoring gems to pristine condition...
Cached gem for executable-hooks-1.3.2 not found, attempting to fetch...
Fetching: executable-hooks-1.3.2.gem (100%)
ERROR: While executing gem ... (Gem::InstallError)
invalid gem: No such file or directory - /home/t/.rvm/gems/ruby-1.9.3-p551#global/cache/executable-hooks-1.3.2.gem
How can I clean up the old version of ruby and its packages, if I only need the newer version?
Thanks.
You are missing some libraries (imagemagick). Please try installing them:
sudo apt-get install imagemagick libmagickwand-dev
After that try again to install your gem.
To cleanup old version of a gem run:
gem cleanup pdfbeads
To uninstall a specific ruby version run:
rvm remove 1.9.3
You can also take a look in the folder /home/t/.rvm/ and clean up by hand. But do that with care. Or just take a look in this folder to find out which ruby versions and gemsets are installed and clean up with the rvm commands.

Jekyll fails to serve (Ruby incompatible library version)

When trying to run jekyll serve, it seems to build correctly (though with warnings that I haven't been able to resolve), but then fails to serve. jekyll build completes, but the resulting files are missing the compiled CSS.
Output from jekyll serve:
Ignoring ffi-1.9.10 because its extensions are not built. Try: gem pristine ffi --version 1.9.10
Ignoring curb-0.9.3 because its extensions are not built. Try: gem pristine curb --version 0.9.3
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2
Ignoring ffi-1.9.10 because its extensions are not built. Try: gem pristine ffi --version 1.9.10
Ignoring gem-wrappers-1.2.7 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.2.7
Ignoring json-1.8.2 because its extensions are not built. Try: gem pristine json --version 1.8.2
Ignoring thin-1.6.1 because its extensions are not built. Try: gem pristine thin --version 1.6.1
Configuration file: /home/jtebert/OwnCloud/Projects/Programming/python/AMS/mockup/_config.yml
Source: /home/jtebert/OwnCloud/Projects/Programming/python/AMS/mockup
Destination: /home/jtebert/OwnCloud/Projects/Programming/python/AMS/mockup/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 1.404 seconds.
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require': incompatible library version - /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/ffi-1.9.10/lib/ffi_c.so (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/ffi-1.9.10/lib/ffi.rb:6:in `rescue in <top (required)>'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/ffi-1.9.10/lib/ffi.rb:3:in `<top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/rb-inotify-0.9.7/lib/rb-inotify/native.rb:1:in `<top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/rb-inotify-0.9.7/lib/rb-inotify.rb:1:in `<top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/adapter/linux.rb:30:in `_configure'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/adapter/base.rb:45:in `block in configure'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/adapter/base.rb:40:in `each'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/adapter/base.rb:40:in `configure'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/adapter/base.rb:63:in `start'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/backend.rb:26:in `start'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/listener.rb:67:in `block in <class:Listener>'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/fsm.rb:120:in `instance_eval'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/fsm.rb:120:in `call'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/fsm.rb:91:in `transition_with_callbacks!'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/fsm.rb:57:in `transition'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/listen-3.0.6/lib/listen/listener.rb:90:in `start'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/jekyll-watch-1.3.1/lib/jekyll/watcher.rb:12:in `watch'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/jekyll-3.1.3/lib/jekyll/commands/build.rb:72:in `watch'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/jekyll-3.1.3/lib/jekyll/commands/build.rb:39:in `process'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/jekyll-3.1.3/lib/jekyll/commands/serve.rb:34:in `block (2 levels) in init_with_program'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
from /home/jtebert/.rvm/gems/ruby-2.0.0-p643/gems/jekyll-3.1.3/bin/jekyll:13:in `<top (required)>'
from /usr/local/bin/jekyll:23:in `load'
from /usr/local/bin/jekyll:23:in `<main>'
When trying to start a Jekyll project, I did have to create a link of Ruby versions because it was looking for 'Ruby2.1', but I'm not sure if this is playing a role in the current problem: ln -s /usr/bin/ruby '/usr/bin/ruby2.1'.
According to my package manager, I've installed Ruby 2.3.0. But according to which ruby, I'm using 2.0.0 which it's getting from rvm: /home/xxxxxxx/.rvm/rubies/ruby-2.0.0-p643/bin/ruby. And as I mentioned before, Jekyll seems to want v2.1 for something. I'm guessing these conflicting versions are somehow causing the problem, but I don't know how to resolve it.
In my case I had to install the ffi library with gem:
gem install ffi
This error is probably caused by an older version of the library installed in the system. gem then installs the correct version for your project.
The problem for me seemed to be rvm (which I'm not sure how I ended up using). The solution was to remove rvm with rvm implode, then reinstall jekyll with gem install jekyll. Both the warnings and errors disappeared, and it is serving properly.

Ruby bundler installing unwanted version of puppet gem

I have the following script
PUPPET_VERSION=3.7.4
ruby='1.8.7-p374'
rvm use $ruby#$$ --create
gem install bundler
bundle install --gemfile=.gemfile
This has worked for several months but sadly now it has decided to stop working.
After this script rake is called to run some rspec tasks
On the centos 6.6 bamboo test runner the process fails.
On the centos 6.4 development machine it still works
On my development machine this script (+rake tasks ) works like so
Fetching gem metadata from http://rubygems.org/.........
Fetching version metadata from http://rubygems.org/..
Installing rake 10.4.2
Installing CFPropertyList 2.2.8
Installing builder 3.2.2
Installing diff-lcs 1.2.5
Installing facter 2.4.1
Installing json_pure 1.8.2
Installing hiera 1.3.4
Installing metaclass 0.0.4
Installing mocha 1.1.0
Installing puppet 3.7.4
Installing puppet-lint 1.1.0
Installing puppet-syntax 1.4.1
Installing rspec-core 2.99.2
Installing rspec-expectations 2.99.2
Installing rspec-mocks 2.99.3
Installing rspec 2.99.0
Installing rspec-puppet 2.0.0
Installing puppetlabs_spec_helper 0.8.2
Installing rspec_junit_formatter 0.2.0
Using bundler 1.9.4
Bundle complete! 3 Gemfile dependencies, 20 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
manifests found
~/gitf/puppetmaster_np/local_modules/iop_4store/spec/fixtures/modules ~/gitf/puppetmaster_np/local_modules/iop_4store
~/gitf/puppetmaster_np/local_modules/iop_4store
/home/jan/.rvm/rubies/ruby-1.9.3-p484/bin/ruby -S rspec ./spec/classes/iop_4store_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null
WARN: Unresolved specs during Gem::Specification.reset:
rake (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Removing gemset 16612......
However on the bamboo agent node it does this
The source :rubygems is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Using rake 10.4.2
Using CFPropertyList 2.2.8
Using builder 3.2.2
Using diff-lcs 1.2.5
Using facter 2.4.3
Using json_pure 1.8.2
Using hiera 2.0.0
Using metaclass 0.0.4
Using mocha 1.1.0
Using puppet 4.0.0
Using puppet-lint 1.1.0
Using puppet-syntax 2.0.0
Using rspec-support 3.2.2
Using rspec-core 3.2.3
Using rspec-expectations 3.2.1
Using rspec-mocks 3.2.1
Using rspec 3.2.0
Using rspec-puppet 2.0.1
Using puppetlabs_spec_helper 0.10.2
Using rspec_junit_formatter 0.2.0
Using bundler 1.9.4
Bundle complete! 3 Gemfile dependencies, 21 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
manifests found
~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/fixtures/modules ~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store
~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store
/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby -I/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-support-3.2.2/lib:/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null
WARN: Unresolved specs during Gem::Specification.reset:
rake (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/usr/local/rvm/gems/ruby-1.9.3-p484/gems/puppetlabs_spec_helper-0.10.2/lib/puppetlabs_spec_helper/module_spec_helper.rb:23:in `block in <top (required)>': undefined method `environmentpath=' for #<RSpec::Core::Configuration:0x000000025a4068> (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core.rb:101:in `configure'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/puppetlabs_spec_helper-0.10.2/lib/puppetlabs_spec_helper/module_spec_helper.rb:22:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
from /home/bamboo/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/spec_helper.rb:2:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/bamboo/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/classes/iop_4store_spec.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `block in load_spec_files'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `load_spec_files'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:97:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec:4:in `<main>'
/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby -I/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-support-3.2.2/lib:/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null failed
/usr/local/rvm/gems/ruby-1.9.3-p484#27314 did not previously exist. Ignoring.
The tests fail and I'm sure that having a wildly different version of puppet (and other gems) is not helping. Also, our systems aren't running puppet 4
Here is the gemfile that is being used
source :rubygems
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>=
2.7']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'rspec_junit_formatter'
So my problem is that the scripts shown previously loaded the correct gems into rvm and executed the tests "as if" puppet 3.7.0. Now they try and load puppet 4 and the tests fail.
Thanks
Here's what I did to "make it work" Not entirely sure why this fixed it
First, alter the gemfile to copy most of the versions of the gem dependencies from the other server where it still works
source 'https://rubygems.org'
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>=
2.7', '< 4.0']
gem 'diff-lcs', '1.2.5'
gem 'facter'
gem 'hiera', '1.3.4'
gem 'json_pure', '1.8.2'
gem 'metaclass', '0.0.4'
gem 'mocha', '1.1.0'
gem 'puppet', puppetversion
gem 'puppet-lint', '1.1.0'
gem 'puppet-syntax', '1.4.1'
gem 'puppetlabs_spec_helper', '0.8.2'
gem 'rake'
gem 'rspec', '2.99.0'
gem 'rspec-core', '2.99.2'
gem 'rspec-expectations', '2.99.2'
gem 'rspec-mocks', '2.99.3'
gem 'rspec-puppet', '2.0.0'
gem 'rspec_junit_formatter', '0.2.0'
Next, add a couple of "bundle update" and a "bundlee clean --force" to the script.
PUPPET_VERSION=3.7.4
ruby='1.9.3-p484'
rvm use $ruby#$$ --create
gem install bundler
ln -s .gemfile Gemfile
bundle clean --force
bundle update rspec
bundle install --gemfile=.gemfile
bundle update rspec
(the eagle eyed will note that I'm running a different ruby too)

Resources