Installing RVM on OpenBSD: ruby: can't load library - ruby

Using a [fairly vanilla] OpenBSD 6.0 x64 VM to try out RVM. I follow the instructions on how to install RVM and do the following:
# curl -sSL https://get.rvm.io | bash -s stable --ruby
ksh: bash: not found
ksh: curl: not found
# pkg_add curl bash
quirks-2.241 signed on 2016-07-26T16:56:10Z
curl-7.49.0:libidn-1.32p1: ok
curl-7.49.0: ok
bash-4.3.46: ok
# curl -sSL https://get.rvm.io | bash -s stable --ruby
Trying to install GNU version of tar, might require sudo password
quirks-2.241 signed on 2016-07-26T16:56:10Z
gtar-1.29: ok
Downloading https://github.com/rvm/rvm/archive/1.28.0.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.28.0/1.28.0.tar.gz.asc
curl: (22) The requested URL returned error: 404 Not Found
Could not download 'https://github.com/rvm/rvm/releases/download/1.28.0/1.28.0.tar.gz.asc'.
curl returned status '22'.
Creating group 'rvm'
Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:
* First you need to add all users that will be using rvm to 'rvm' group,
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
* To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# Administrator,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: https://rvm.io/help and https://twitter.com/rvm_io
rvm 1.28.0 (latest) by Wayne E. Seguin , Michal Papis [https://rvm.io/]
Searching for binary rubies, this might take some time.
No binary rubies available for: openbsd/6.0/x86_64/ruby-2.3.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for openbsd.
WARNING: $PKG_PATH was not set, using fallback 'http://ftp.openbsd.org/pub/OpenBSD/6.0/packages/amd64/',
see http://www.openbsd.org/ftp.html for list of available mirrors.
Installing requirements for openbsd.
Updating system.
Installing required packages: gcc-4, automake-1, libtool, bison, readline-6, libyaml-0.
Requirements installation successful.
Found user configured '-j' flag in 'rvm_make_flags', please note that RVM can detect number of CPU threads and set the '-j' flag automatically if you do not set it.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.3.3, this may take a while depending on your cpu(s)...
ruby-2.3.3 - #downloading ruby-2.3.3, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.7M 100 13.7M 0 0 3734k 0 0:00:03 0:00:03 --:--:-- 4000k
ruby-2.3.3 - #extracting ruby-2.3.3 to /usr/local/rvm/src/ruby-2.3.3....
ruby-2.3.3 - #configuring..........................................................
ruby-2.3.3 - #post-configuration.
ruby-2.3.3 - #compiling................................................................................................
ruby-2.3.3 - #installing........
ruby-2.3.3 - #making binaries executable..
ruby-2.3.3 - #downloading rubygems-2.6.8
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 736k 100 736k 0 0 1087k 0 --:--:-- --:--:-- --:--:-- 1089k
ruby-2.3.3 - #extracting rubygems-2.6.8....
ruby-2.3.3 - #removing old rubygems.........
$LANG was empty, setting up LANG=en_US.UTF-8, if it fails again try setting LANG to something sane and try again.
ruby-2.3.3 - #installing rubygems-2.6.8.
Error running 'env GEM_HOME=/usr/local/rvm/gems/ruby-2.3.3#global GEM_PATH= /usr/local/rvm/rubies/ruby-2.3.3/bin/ruby -d /usr/local/rvm/src/rubygems-2.6.8/setup.rb --no-docu ment',
showing last 15 lines of /usr/local/rvm/log/1482173449_ruby-2.3.3/rubygems.install.log
[2016-12-19 13:56:46] /usr/local/rvm/rubies/ruby-2.3.3/bin/ruby
current path: /usr/local/rvm/src/rubygems-2.6.8
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/local/rvm/bin
command(7): env GEM_HOME=/usr/local/rvm/gems/ruby-2.3.3#global GEM_PATH= /usr/local/rvm/rubies/ruby-2.3.3/bin/ruby -d /usr/local/rvm/src/rubygems-2.6.8/setup.rb --no-documen t
ruby: can't load library 'libruby.so.2.30'
First, I tried to install RVM using the same procedure on one of our OpenBSD 5.8 development machines as a local user and got the same issue. I decided to try it on a newer VM as root which is what I show above. Both cases 'libruby.so.2.30' exists either locally (~/.rvm/rubies/ruby-2.3.0/lib/libruby.so.2.30) for the user or in /usr/local/rvm/rubies/ruby-2.3.3/lib for the case I show above.
If I try to add the path to the linker config using ldconfig and manually execute the failing command :
# ldconfig /usr/local/lib /usr/local/rvm/rubies/ruby-2.3.3/lib
# cd /usr/local/rvm/src/rubygems-2.6.8
# env GEM_HOME=/usr/local/rvm/gems/ruby-2.3.3#global GEM_PATH= /usr/local/rvm/rubies/ruby-2.3.3/bin/ruby -d /usr/local/rvm/src/rubygems-2.6.8/setup.rb --no-document
Exception `LoadError' at /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems.rb:1345 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems.rb:1354 - cannot load such file -- rubygems/defaults/ruby
Exception `LoadError' at /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- did_you_mean
Exception `LoadError' at /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:135 - cannot load such file -- did_you_mean
... lots of stdoutput regarding RubyGems changelog...
It seems the library has been built and it can execute the command (with errors, but the binary works) which probably has something to do with me executing this stuff out of the context of the script itself I assume.
This is a scripted install. It seems that RVM should be setting up something for the linker to know about the existence of these libraries (it created them in the first place), but it doesn't appear to be working out.
Is this a bug with RVM on OpenBSD or it is something I am not doing correctly?

Related

How to recover from failed Ruby version update?

On attempting to update Ruby version I get a failure with some dependencies. The output of which is copied below. I need to correct this situation or perform a time machine restore (ideally without rolling back my entire system).
What would be the best way to recover from this situation?
Pauls-MacBook-Pro:~ pauldriver$ cd Sites/base/sites/all/themes/primal/
ruby-1.9.3-p551 is not installed.
To install do: 'rvm install ruby-1.9.3-p551'
Pauls-MacBook-Pro:primal pauldriver$ rvm list
rvm rubies
=* ruby-1.9.3-p547 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Pauls-MacBook-Pro:primal pauldriver$ rvm install ruby-1.9.3-p551
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-1.9.3-p551.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system.....
Installing required packages: gcc48.....
Error running 'requirements_osx_brew_libs_install gcc48',
showing last 15 lines of /Users/pauldriver/.rvm/log/1417181615_ruby-1.9.3- p551/package_install_gcc48.log
++ case "$1" in
++ [[ -t 1 ]]
++ return 1
++ printf %b 'There were package installation errors, make sure to read the log.
Try `brew tap --repair` and make sure `brew doctor` looks reasonable.
Check Homebrew requirements https://github.com/Homebrew/homebrew/wiki/Installation\n'
There were package installation errors, make sure to read the log.
Try `brew tap --repair` and make sure `brew doctor` looks reasonable.
Check Homebrew requirements https://github.com/Homebrew/homebrew/wiki/Installation
++ case "$_system_version" in
++ return 1
Requirements installation failed with status: 1.
Pauls-MacBook-Pro:primal pauldriver$
It seems that my problem was connected with gcc48 and some confusion with an earlier version.
I eventually found a solution via the following stackoverflow post Error installing Ruby in Yosemite

Installing RVM: getting error "There was an error(23)."

I am trying to install Ruby Version Manager (RVM) without success.
How to get through this error I am getting?
ubuntu#ip-172-31-0-20:/tmp$ rvm install ruby-1.9.3-p484
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/14.04/x86_64/ruby-1.9.3-p484.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for ubuntu.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p484, this may take a while depending on your cpu(s)...
ruby-1.9.3-p484 - #downloading ruby-1.9.3-p484, this may take a while depending on your connection...
Warning: Failed to create the file ruby-1.9.3-p484.tar.bz2.part: Permission
Warning: denied
0 9806k 0 1002 0 0 22905 0 0:07:18 --:--:-- 0:07:18 23302
curl: (23) Failed writing body (0 != 1002)
There was an error(23).
Checking fallback: http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.bz2
Warning: Failed to create the file ruby-1.9.3-p484.tar.bz2.part: Permission
Warning: denied
0 9806k 0 1167 0 0 4300 0 0:38:55 --:--:-- 0:38:55 4290
curl: (23) Failed writing body (0 != 1167)
There was an error(23).
Failed download
There has been an error fetching the ruby interpreter. Halting the installation.
ubuntu#ip-172-31-0-20:/tmp$
Your RVM is installed in /usr/local/rvm - it's often called system installation, this requires that your user ubuntu will be added to rvm group:
rvm group add rvm "$USER"
yes use $USER it will be replaced by your shell with your user name
then log out and log in, ensure with:
id
that your user is in rvm group,
finally just in case update permissions for RVM:
rvm fix-permissions
The solution by #mpasis might not work if you're installing rvm using ubuntu_rvm as by default because of copy+paste it'll be installed as root.
Try installing rvm with without sudo or with curl as explained on rvm.io.

Ruby gem running forever and Ruby, gem path error

I have problem with my gem and Ruby command, I think it's because of path problem.
gem install jekyll
takes for a long time to run, and outputs an error message:
ERROR: Could not find a valid gem 'jekyll' (>= 0)
Unable to download data from https://rubygems.org/ - too many connection resets(https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz)
I entered which ruby, which output:
/usr/local/bin/ruby
If I enter which gem, it prints out:
gem () {
typeset result
(
typeset rvmrc
rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
then
rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc")
fi
for rvmrc in "${rvm_rvmrc_files[#]}"
do
[[ -s "${rvmrc}" ]] && source "${rvmrc}" || true
done
unset rvm_rvmrc_files
command gem "$#"
) || result=$?
hash -r
return ${result:-0}
}
Enter whereis gem, prints out:
/usr/bin/gem
Does anyone know how to fix it? I've tried for a long time and get confused.
UPDATE:
Enter gem env I got:
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-darwin13.0.0]
- INSTALLATION DIRECTORY: /Users/lijung/.rvm/gems/ruby-1.9.3-p374
- RUBY EXECUTABLE: /usr/local/Cellar/ruby/2.0.0-p247/bin/ruby
- EXECUTABLE DIRECTORY: /Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-13
- GEM PATHS:
- /Users/lijung/.rvm/gems/ruby-1.9.3-p374
- /usr/local/bin/gem
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
enter rvm info:
ruby-1.9.3-p374:
system:
uname: "Darwin chi.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64"
system: "osx/10/x86_64"
bash: "/usr/local/bin/bash => GNU bash, version 4.2.37(2)-release (i386-apple-darwin12.2.0)"
zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"
rvm:
version: "rvm 1.18.3 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "9 months 18 days 11 hours 37 minutes 54 seconds ago"
ruby:
interpreter: "ruby"
version: "2.0.0p247"
date: "2013-06-27"
platform: "x86_64-darwin13.0.0"
patchlevel: "2013-06-27 revision 41674"
full_version: "ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0]"
homes:
gem: "/Users/lijung/.rvm/gems/ruby-1.9.3-p374"
ruby: "/Users/lijung/.rvm/rubies/ruby-1.9.3-p374"
binaries:
ruby: "/usr/local/bin/ruby"
irb: "/usr/local/bin/irb"
gem: "/usr/local/bin/gem"
rake: "/usr/local/bin/rake"
environment:
PATH: "/usr/local/bin:/usr/local/sbin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374#global/bin:/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/MacOS/bin"
GEM_HOME: "/Users/lijung/.rvm/gems/ruby-1.9.3-p374"
GEM_PATH: "/usr/local/bin/gem"
MY_RUBY_HOME: "/Users/lijung/.rvm/rubies/ruby-1.9.3-p374"
IRBRC: "/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/.irbrc"
RUBYOPT: ""
gemset: ""
The first thing I see that is a "really bad thing" when using RVM is:
PATH: "/usr/local/bin:/usr/local/sbin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374#global/bin:/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/MacOS/bin"
Even with how Stack Overflow formats this you can see that the RVM initialization isn't correct. RVM must be the first thing in your path. Look in your ~/.bash_profile or ~/.bashrc file and adjust the PATH manipulations so it comes first, then close the terminal window and reopen it. Checking the PATH should look something like:
"/Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374#global/bin:/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/MacOS/bin"
The path is the chain of directories used by your shell when looking for a command. Your current path is telling the shell to find commands in /usr/local/bin and /usr/local/sbin first, which means it will find all Ruby-related commands in that directory first, which are NOT the ones that RVM installed for you.
Fixing the RVM initializer so it runs at the right point in your ~/.bash_profile or ~/.bashrc is the first step.
Your RVM is out of date too. Every couple weeks you should run rvm get stable to make sure you've got the latest settings and bug-fixes. Once your path is straightened out you can run that.
The error:
Unable to download data from https://rubygems.org/ - too many connection resets...
is indicative of internet problems between you and your server. Usually that will be fixed on its own. If it doesn't heal itself in a reasonable time, try restarting your machine, which will give the IP stack a chance to restart and flush all its caches; Though that code is well tested, there are still times it can lose it's mind and do dumb things. The reset is a poke in its eye which gets its attention. If THAT doesn't fix it consider calling your ISP.
I be able to use Ruby, that I've downloaded from brew? How can I set my gem path to the right path?
Deal with things in the right order. You can't use your Ruby as it's currently configured because your gems are not correctly associated with the right Ruby version and any changes you make to the Ruby installations will only result in confusion and mayhem. Once you have the path corrected and RVM running correctly, then it's a very simple RVM command to enable other Homebrew Rubies:
rvm use system --default
At that point, RVM will step out of the way and your other Rubies will be accessible via the PATH chain. You have to manage which Ruby version will be executed at that point.
Avoiding that hassle is why we use RVM or rbenv; They can easily install multiple Ruby versions and let you switch between them with a simple command, or even automatically when you chdir into a directory, if you set them up to do so. Brew only muddies the water, and trying to use a Brew installed Ruby was the source of your problem, so I'd recommend seriously rethinking that decision.
Finally, because you don't seem to understand what you're doing, and you're on Mac OS X, I'd recommend fixing this path problem, then backing away from the computer, READ ALL THE RVM PAGES until you REALLY understand what it does, then carefully make changes. Don't trust what other sites say about installing RVM, trust what the RVM authors say first. The authors know what works best for using it.
You might want to look into using JewelryBox also.

Error Installing ruby with RVM Single User mode on Arch Linux

I've just installed RVM on ArchLinux x64 in single user mode via the recommended install script
curl -L https://get.rvm.io | bash -s stable
I've also installed all the requirements listed in rvm requirements
However, I'm having trouble actually installing any version of ruby. And getting the following error:
arch:~ % rvm install 1.9.3
No binary rubies available for: ///ruby-1.9.3-p194.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to /home/christopher/.rvm/archives
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 460k 100 460k 0 0 702k 0 --:--:-- --:--:-- --:--:-- 767k
Extracting yaml-0.1.4.tar.gz to /home/christopher/.rvm/src
Prepare yaml in /home/christopher/.rvm/src/yaml-0.1.4.
Configuring yaml in /home/christopher/.rvm/src/yaml-0.1.4.
Error running ' ./configure --prefix=/home/christopher/.rvm/usr ', please read /home/christopher/.rvm/log/ruby-1.9.3-p194/yaml/configure.log
Compiling yaml in /home/christopher/.rvm/src/yaml-0.1.4.
Error running 'make', please read /home/christopher/.rvm/log/ruby-1.9.3-p194/yaml/make.log
Please note that it's required to reinstall all rubies:
rvm reinstall all --force
Installing Ruby from source to: /home/christopher/.rvm/rubies/ruby-1.9.3-p194, this may take a while depending on your cpu(s)...
ruby-1.9.3-p194 - #downloading ruby-1.9.3-p194, this may take a while depending on your connection...
ruby-1.9.3-p194 - #extracting ruby-1.9.3-p194 to /home/christopher/.rvm/src/ruby-1.9.3-p194
ruby-1.9.3-p194 - #extracted to /home/christopher/.rvm/src/ruby-1.9.3-p194
Skipping configure step, 'configure' does not exist, did autoreconf not run successfully?
ruby-1.9.3-p194 - #compiling
Error running 'make', please read /home/christopher/.rvm/log/ruby-1.9.3-p194/make.log
There has been an error while running make. Halting the installation.
The log files are as follows:
arch:~ % cat ~/.rvm/log/ruby-1.9.3-p194/yaml/configure.log
__rvm_log_command:32: permission denied:
arch:~ % cat ~/.rvm/log/ruby-1.9.3-p194/yaml/make.log
make: *** No targets specified and no makefile found. Stop.
arch:~ % cat ~/.rvm/log/ruby-1.9.3-p194/make.log
make: *** No targets specified and no makefile found. Stop.
I'm having this same problem on two machines running Mac OS 10.6.8.
I was able to fix the yaml problem by manually cd-ing into the directory and running ./configure. eg:
$ cd /home/christopher/.rvm/src/yaml-0.1.4
$ ./configure --prefix=/home/christopher/.rvm/usr
After running "rvm install 1.9.3" a couple more times, it picked up the configuration I'd done, and stopped bothering me about the yaml issue.
I was also able to cd into the ruby directory and configure and make it. eg:
$ /home/christopher/.rvm/src/ruby-1.9.3-p194
$ ./configure
$ make
$ make install
...However, this didn't cause rvm to pick it up. I'm guessing I was missing some necessary command line options and flags.
But considering I was able to get as far as I did, it seems to me like it's an rvm bug.

rvm get latest is throwing error

Trying to upgrade RVM on my OSx. I am getting the below error.
$ rvm get latest
Original installed RVM version:
rvm 1.2.9 by Wayne E. Seguin (wayneeseguin#gmail.com) [http://rvm.beginrescueend.com/]
rvm-<html>
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 172 0 172 0 0 210 0 --:--:-- --:--:-- --:--:-- 304
ERROR:
.tar.gz downloaded does not match it's md5 checksum <html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.0.8</center>
</body>
./html>
Aborting RVM Installation.
What could be wrong ?
try:
rvm get head
rvm reload
rvm get stable
in case `rvm get head fails use installer instead:
curl -L get.rvm.io | bash -s stable
rvm reload
The rvm reload is important, it was required earlier but now RVM will autoreload itself.
Also note that around 1.4 RVM changed .rvmrc trusting mechanism and you will have to trust all your projects again ... or use the new project files which do not require trusting: https://rvm.io/workflow/projects/#ruby-versions

Resources