LewlSauce
LewlSauce

Reputation: 5872

New Ubuntu install, trying to install Ruby 2.3.1 alongside 2.5.0 for another project

So I've just installed Ubuntu, installed Ruby on Rails (the latest) based on the article here: https://gorails.com/setup/ubuntu/17.10

I can run rails just fine on a brand new application; however, I'm trying to run an application that requires Ruby 2.3.1. If I go to the rails directory of that application and try to do bundle install, I get:

Your Ruby version is 2.5.0, but your Gemfile specified 2.3.1

I tried to install Ruby 2.3.1 using rbenv install 2.3.1 but I get an error log that looks like a memory stack or something. Nothing that seems to be of any help.

How can I go about installing Ruby 2.3.1 without screwing up my other installation of 2.5.0 since this isn't working? This is the error log I get when trying to install 2.3.1 using rbenv.

~/apps/smartadmin(master*) » rbenv install 2.3.1                                        4:33PM/01.11
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...

BUILD FAILED (Ubuntu 17.10 using ruby-build 20171226-3-g01e7b7b)

Inspect or clean up the working tree at /tmp/ruby-build.20180111163349.20841
Results logged to /tmp/ruby-build.20180111163349.20841.log

Last 10 log lines:
 RAX: 0x0000000000000000 RBX: 0x00005600d84126c0 RCX: 0x0000000200000040
 RDX: 0x00005600d840cf60 RDI: 0x00005600d840cf70 RSI: 0x000000000010dbd0
  R8: 0x00000000ffffffff  R9: 0x00005600d8099000 R10: 0x00005600d8367d40
 R11: 0x00005600d83d1dc8 R12: 0x00005600d840cf70 R13: 0x00005600d79c522a
 R14: 0x00007ffde1bf3fc0 R15: 0x00005600d84126c0 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
Segmentation fault (core dumped)
uncommon.mk:654: recipe for target 'enc.mk' failed
make: *** [enc.mk] Error 139

Before I got too ahead of myself and trying to install rvm and using rvm to install 2.3.1, I wanted to get some advice here. I've already had to spin up a fresh VM after getting into a big mess with this.

Upvotes: 1

Views: 782

Answers (1)

bao trung chu
bao trung chu

Reputation: 11

According to this: https://bugs.ruby-lang.org/issues/14076 The problem is gcc version (gcc-7 in Artful). So we need to install gcc-6 in Artful.

Download gcc-6.4 built for Artful from: https://packages.ubuntu.com/artful/gcc-6

Install the .deb file (either by clicking on the file or using terminal command).

Then try the solution proposed in the first link above. CC=/usr/bin/gcc-6 rbenv install 2.3.1

Then, you should have 2.3.1 installed on Artful. Good luck!

Upvotes: 1

Related Questions