Trying to install ruby 1.9.3 on Alpine 3.4 fails - ruby

I'm trying to build an alpine:3.4 image with ruby 1.9.3 using rvm but I get the following error message:
io.o: In function `linux_iocparm_len':
/home/travis/.rvm/src/ruby-1.9.3-p551/io.c:8086: undefined reference to `_IOC_SIZE'
collect2: error: ld returned 1 exit status
Makefile:165: recipe for target 'miniruby' failed
I've been able to install both ruby 2.2 and 2.3 without any problems, but had no luck with 1.9.3
The command I used for 2.3 is
rvm install 2.3.0 --disable-binary --movable --autolibs=0
I've installed rvm from https://github.com/rvm/rvm/archive/stable.tar.gz

I solved this by backporting the same conditionals the latest version of Ruby has for _IOC_SIZE to ruby/io.c. I was able to compile and install afterwards.
The pull request is https://github.com/ruby/ruby/pull/1485, the fix is https://github.com/rallen-temp/ruby/commit/cbaaf34a0aa3c90f6a43d4383258c14a803bed12.
I also referenced this issue in the PR. Hope this helps anyone else that runs into this.

Related

Rubocop installation (machine: linux-gnu, Ubuntu)

I go through the process of installing the rubocop gem install rubocop --version 0.86.0
And run rubocop -v afterwards to make sure everything is fine.
Instead, I receive the message below:
warning: parser/current is loading parser/ruby27, which recognizes
warning: 2.7.2-compliant syntax, but you are running 2.7.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
1.8.1
From what I can understand with my limited knowledge, it says that my ruby version is not compatible. Is that right? That I'm using 2.7.0 and I need to use 2.7.2 or above.
I run rvm ls
=* ruby-2.7.2 [ x86_64 ]
Then I try to run ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
I've gone through the process of rvm install 2.7.2 & rvm use 2.7.2 I have toggled-on 'Run command as a login shell' - because that was the only way I could get 'rvm' to work in the terminal.
If someone is able to help me with how I can upgrade my ruby version, it would be greatly appreciated.
Sidenote - I tried to follow the link https://github.com/whitequark/parser#compatibility-with-ruby-mri. 1.8.1 and I willingly admit I don't understand what's going on, on this page or how I can use it to solve the problem.
Lucas R
You can safely ignore this warning. The parser gem takes things very seriously; it is detecting that you are running a different patch version than it expects (2.7.2 instead of 2.7.0), but there are normally no syntax changes between patch versions.
Unrelated note: rubocop 0.86 is very old; you should upgrade if you can.

rbenv build failed on Ubuntu 14.04

I've successfully installed rbenv (along with the build tools) on my Ubuntu 14.04 desktop, and that appears to be working fine, but as soon as I try to install ruby 2.1.1, the build fails:
daniel#grape:~$ rbenv install 2.1.1
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /home/daniel/.rbenv/versions/2.1.1
Downloading ruby-2.1.1.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/e57fdbb8ed56e70c43f39c79da1654b2
Installing ruby-2.1.1...
BUILD FAILED
Inspect or clean up the working tree at /tmp/ruby-build.20140418142258.3543
Results logged to /tmp/ruby-build.20140418142258.3543.log
Last 10 log lines:
installing default ripper libraries
compiling ossl_pkcs7.c
compiling ossl_ssl.c
installing default openssl libraries
linking shared-object openssl.so
make[2]: Leaving directory `/tmp/ruby-build.20140418142258.3543/ruby-2.1.1/ext/openssl'
linking shared-object ripper.so
make[2]: Leaving directory `/tmp/ruby-build.20140418142258.3543/ruby-2.1.1/ext/ripper'
make[1]: Leaving directory `/tmp/ruby-build.20140418142258.3543/ruby-2.1.1'
make: *** [build-ext] Error 2
The contents of the log file can be found here: http://pastebin.com/SXxTeCJY
I've done some searching for help with this issue, including following what is said here: https://github.com/sstephenson/ruby-build/wiki - but I've not had any joy.
UPDATE: Use Ruby 2.1.2, it fixes this issue.
14.04 is probably shipping with readline 6.3, which uses rl_hook_func_t instead of Function.
This bug has already been reported and fixed in Ruby (https://bugs.ruby-lang.org/issues/9578), but not released yet.
Until Ruby 2.1.2 comes out (which I assume will contain this fix), you can use a patch to properly support the new rl_hook_func_t method. Use this to install Ruby 2.1.1:
curl -fsSL https://gist.github.com/mislav/a18b9d7f0dc5b9efc162.txt | rbenv install --patch 2.1.1
(Source: http://gorails.com/setup/ubuntu/14.04)
UPDATE: Ruby 2.1.2, fixes this issue. If you need to patch ruby with Chef for another reason follow the example here.
Chef installation of Ruby 2.1.1 on to Ubuntu 14.04 using LWRP
Code to patch Ruby 2.1.1 on Trusty Ubuntu (14.04) using Riotgames rbenv cookbook - cut and pasted - no warranty :-) I have a wrapper cookbook which is tested on Ubuntu 14.04 (release 1.0.4). Easiest way is get this going is to clone the repository and converge it on test kitchen. The main gotcha is that the cookbook uses Berkshelf 3.1.1 and most people are probably on 2 still. The pasted code should work on Berkshelf 2.x and 3.1.1.
Berksfile
cookbook 'rbenv', github: "RiotGames/rbenv-cookbook"
Metadata
depends 'rbenv'
Attributes (attributes/default.rb)
default['ruby']['version'] = '2.1.1'
Recipe (recipes/default.rb)
# patchutils is required to patch Ruby version
package 'patchutils'
include_recipe "rbenv::default"
include_recipe "rbenv::ruby_build"
# Installs a patched, global, ruby
rbenv_ruby node['ruby']['version'] do
global true
patch "https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/45225/diff?format=diff"
end
Discussion for patch
Rich

Jekyll on Windows Liquid Exception: Failed to get header

I'm trying to use Jekyll on my windows 7 (64bit) PC.
I have installed Ruby, Ruby Devkit, Python 2.7, Jekyll and Pygments but getting this error
E:\jekyll\my-site>jekyll serve
Configuration file: E:/jekyll/my-site/_config.yml
Source: E:/jekyll/my-site
Destination: E:/jekyll/my-site/_site
Generating... Liquid Exception: Failed to get header. in 2013-07-19-welcome-to-jekyll.markdown
error: Failed to get header.. Use --trace to view backtrace
I also got this error, and a couple of other similar errors too, and finally got to a solution: you need to have a couple of compatible versions of the required Ruby, Python and Pygments.
Install Ruby 1.9.3-p448 version (download here);
Install Python 2.7.5 version (download here);
Install Pygments 0.5.0
gem uninstall pygments.rb
gem install pygments.rb --version "=0.5.0"
I hope it helps.
Edited: Don't forget to add the correct PATHs to your system variables. In my case, it was:
C:\Python27;C:\Ruby193
In order to improve this content, there is a simple tutorial (written in Portuguese, but I guess you can understand the steps, always considering the versions of software/plugins listed above) - view tutorial.
Another possible cause for this error message on Windows is that the path to the Pygments scripts contains spaces. Took me a while to figure this one out...
For my situation, install pygments 0.5.0 or 0.5.4 both have problem. I fixed by re-install python 2.7.6. Please refer to following answer:
https://github.com/jekyll/jekyll/issues/1181#issuecomment-35963876
I had two versions of python installed on my system.(Windows 8.1)
Python22 and Python27.
I removed Python22, added Python27 to System variables and issue got fixed.

Ruby gem curb wont install on windows 7, even if I use libcurl

I'm trying to install the curb gem on windows 7 with libcurl but it returns errors. This is for the eventual purpose of running a ruby app on a vm with vagrant, explained here github catarse install. but it returns an error saying:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing curb:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe: invalid option -V (-h will show valid
options) (RuntimeError)
these are the versions I have used:
C:\>ruby -v
ruby 1.9.3p392 (2013-02-22) [i386-mingw32]
C:\>gem -v
2.0.3
C:\>vagrant -v
Vagrant version 1.2.2
So I've tried using http://beginrescue.blogspot.com.au/2010/07/installing-curb-with-ruby-191-in.html but there was an error and the make_gem.out file has a lot of these (as an example, I didnt think it necessary to post the whole file):
top:
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-curl-lib=C:\curl-7.30.0-devel-mingw32\bin --with-curl-include=C:\curl-7.30.0-devel-mingw32\include
checking for curl-config... no
checking for main() in -lcurl... yes
checking for curl/curl.h... yes
bottom:
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:454: undefined reference to `_imp__curl_free'
curb_postfield.o: In function `append_to_form':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:76: undefined reference to `_imp__curl_formadd'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:115: undefined reference to `_imp__curl_formadd'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:120: undefined reference to `_imp__curl_formadd'
collect2: ld returned 1 exit status
make: *** [curb_core.so] Error 1
I was getting the same lot of linker errors trying to install curb against the latest (at the time of this post) libcurl 7.32.0. Unfortunately, older versions that used to work for me before (e.g. 7.19.4) no longer include x86-mingw packages with the library and headers.
Here you can find a list of packages including libcurl 7.24.0 that can help you build the extensions. The first post also explains how to extract them and set up the environment. I was then able to install curb 0.8.5 with gem install curb -- --with-opt-dir=c:/path/to/libcurl.
I finally got curb to install by using the source for curl, curl-7.36.0.zip, after having to compile the DevKit, DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe with Ruby200 on windows 7 32bit. curl-7.36.0-win32-fix1.msi with curl-7.36.0-win32-fix1.zip didn't work, nor the older curl-7.34.0-devel-mingw32.zip.
It has been a harrowing experience, googling the problems to have answers given by individuals that don't connect to closed issues, etc.
My stack: Windows 7, git bash 1.8.4.msysgit, ruby 1.9.3p484, rubygems 1.8.28
I got it to work doing the following (mostly mentioned at http://beginrescue.blogspot.com.au/2010/07/installing-curb-with-ruby-191-in.html)
Install DevKit
Download and extract curl-7.34.0-devel-mingw32.zip to C: drive, let's called this location CURL7_HOME.
Add curl bin to the top of my PATH (something I missed the first time)
Install curb: gem install curb -- --with-curl-lib=$CURL7_HOME/bin --with-curl-include=$CURL7_HOME/include
Note: --with-curl-lib=$CURL7_HOME/bin is not a typo. Setting it to bin directory makes it work. I've tried --with-curl-dir=$CURL7_HOME and --with-curl-lib=$CURL7_HOME/lib and those don't work.

rvm pkg install ree_dependencies gives error about autoreconf

I am running this command on Linux Mint 14 Mate:
rvm pkg install ree_dependencies --verify-downloads 1
and I get this error:
Fetching ncurses-5.7.tar.gz to /home/john/.rvm/archives
Extracting ncurses to /home/john/.rvm/src/ncurses-5.7
Prepare ncurses in /home/john/.rvm/src/ncurses-5.7.
Error running 'autoreconf -is --force', please read /home/john/.rvm/log/ncurses/autoreconf.log
Configuring ncurses in /home/john/.rvm/src/ncurses-5.7.
Error running './configure --prefix=/home/john/.rvm/usr --with-shared --disable-rpath --without-debug --without-ada --enable-safe-sprintf --enable-sigwinch --without-progs', please read /home/john/.rvm/log/ncurses/configure.log
Compiling ncurses in /home/john/.rvm/src/ncurses-5.7.
Error running 'make', please read /home/john/.rvm/log/ncurses/make.log
and here is the log file:
configure:5967: error: possibly undefined macro: AC_DIVERT_HELP
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
I googled for the solution, but got nothing.
Your help is highly appreciated.
instead of ree_dependencies you should read output of rvm requirements - it will show you what needs to be installed.
A word of advice - REE is based on Ruby 1.8 which is no longer maintained, only security fixes will be released for few months, you really should try a newer ruby like 1.9.3, or if it's new project - try ruby 2.0.0 preview2:
rvm install ruby-2.0.0

Resources