How to install specific version of ruby (1.8.6) with rbenv? - ruby

I have some old source code that runs on ruby 1.8 and rails 2.3 . I have rbenv on my system. How can I install exactly this version of ruby (v1.8.6) with rbenv?
$ rbenv install 1.8.6
Downloading ruby-1.8.6.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.bz2
Installing ruby-1.8.6...
WARNING: ruby-1.8.6 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: use readline from homebrew
BUILD FAILED (OS X 10.14.2 using ruby-build 20190423)
Inspect or clean up the working tree at /var/folders/_w/98n31_kn03qfjt51p2hmrfqh0000gp/T/ruby-build.20190701155134.45412
Results logged to /var/folders/_w/98n31_kn03qfjt51p2hmrfqh0000gp/T/ruby-build.20190701155134.45412.log
Last 10 log lines:
/var/folders/_w/98n31_kn03qfjt51p2hmrfqh0000gp/T/ruby-build.20190701155134.45412 ~
/var/folders/_w/98n31_kn03qfjt51p2hmrfqh0000gp/T/ruby-build.20190701155134.45412/ruby-1.8.6 /var/folders/_w/98n31_kn03qfjt51p2hmrfqh0000gp/T/ruby-build.20190701155134.45412 ~
checking build system type... i686-apple-darwin18.2.0
checking host system type... i686-apple-darwin18.2.0
checking target system type... i686-apple-darwin18.2.0
checking for gcc... /usr/local/bin/gcc-4.2
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
make: *** No targets specified and no makefile found. Stop.
I've tried this solution but it does not work for me...
https://github.com/rbenv/ruby-build/issues/999
Any ideas?

Related

RedHat C compiler does not compile?

i am sitting since yesterday at the problem ruby to install on my redhat 7 system. I already have gcc cc and g++ installed. Also several restarts have not helped I always get the following errors :
[root#ld01 bin]# rbenv install 2.6.1
Downloading ruby-2.6.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.1.tar.bz2
Installing ruby-2.6.1...
BUILD FAILED (Red Hat Enterprise Linux Server 7.6 using ruby-build 20190130-4-g0e33b11)
Inspect or clean up the working tree at /tmp/ruby-build.20190227084942.17275
Results logged to /tmp/ruby-build.20190227084942.17275.log
Last 10 log lines:
/tmp/ruby-build.20190227084942.17275 /usr/bin
/tmp/ruby-build.20190227084942.17275/ruby-2.6.1 /tmp/ruby-build.20190227084942.17275 /usr/bin
checking for ruby... false
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking whether the C compiler works... no
configure: error: in `/tmp/ruby-build.20190227084942.17275/ruby-2.6.1':
configure: error: C compiler cannot create executables
See `config.log' for more details
I think you'll need the config.log but where exactly can I find the log file ?
I'm guessing you've downloaded Ruby and are trying to install it over an existing version - if so, this can break things. If Ruby 2.5 will suffice, I suggest using the version available in RHEL as a Software Collection. Installation info is here.
Software Collections alongside the original Ruby version (used by the OS) so that nothing breaks.

Configure error installing Ruby 1.9.3 on Mac OS 10.10 with rvm and Homebrew

Note for those thinking of marking this duplicate: yes, my XCode tools are installed and up to date.
I started this morning with a system having neither rvm or Homebrew, and was able to install rvm and Ruby 1.9.3 successfully after overriding the default Homebrew installation directory, changing it from /usr/local to /opt/brew.
This afternoon, though, after seeing various warnings about possible weird behavior for some Homebrew recipes if installed anywhere other than /usr/local, I decided to blow all that away and reinstall with Homebrew in the default location.
Now, what worked this morning doesn't work: I get the error below (from configure.log):
[2015-02-04 15:39:24] ./configure
current path: /Users/dmoles/.rvm/src/ruby-1.9.3-p551
PATH=/usr/local/opt/gcc48/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/dmoles/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/ImageMagick/bin:/opt/bin:/opt/apache-ant-1.9/bin:/opt/apache-maven-3/bin:/opt/apache-tomcat-8.0.15/bin:/Users/dmoles/.rvm/bin:/usr/local/bin
command(7): ./configure --prefix=/Users/dmoles/.rvm/rubies/ruby-1.9.3-p551 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --without-tcl --without-tk --disable-install-doc --enable-shared
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... x86_64-apple-darwin14.1.0
checking host system type... x86_64-apple-darwin14.1.0
checking target system type... x86_64-apple-darwin14.1.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/dmoles/.rvm/src/ruby-1.9.3-p551':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
My guess is that this morning it was using the XCode toolchain, and this afternoon it's using Homebrew's, which for some reason isn't working. But it's not clear to me just how that would happen, since I can see above that rvm is playing various games with $PATH. (My usual $PATH: /Users/dmoles/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/ImageMagick/bin:/opt/bin:/opt/apache-ant-1.9/bin:/opt/apache-maven-3/bin:/opt/apache-tomcat-8.0.15/bin:/Users/dmoles/.rvm/bin -- without all the /usr/local/opt at the beginning or the extra /usr/local/bin at the end.)
My rvm version is 1.26.10; gcc-48 is Homebrew gcc48 4.8.4.

Error message installing Python 1.9.3 with rbenv

BUILD FAILED
Inspect or clean up the working tree at /var/folders/nm/7dd74jb52s16cfnjp_st1j8c0000gn/T/ruby-build.20130814195519.99873
Results logged to /var/folders/nm/7dd74jb52s16cfnjp_st1j8c0000gn/T/ruby-build.20130814195519.99873.log
Last 10 log lines:
x ruby-1.9.3-p0/win32/winmain.c
/var/folders/nm/7dd74jb52s16cfnjp_st1j8c0000gn/T/ruby-build.20130814195519.99873/ruby-1.9.3-p0 /var/folders/nm/7dd74jb52s16cfnjp_st1j8c0000gn/T/ruby-build.20130814195519.99873 ~
checking build system type... x86_64-apple-darwin12.4.0
checking host system type... x86_64-apple-darwin12.4.0
checking target system type... x86_64-apple-darwin12.4.0
checking whether the C compiler works... no
configure: error: in `/var/folders/nm/7dd74jb52s16cfnjp_st1j8c0000gn/T/ruby-build.20130814195519.99873/ruby-1.9.3-p0':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop.
Above is the error message I received when trying to do the install. I am TOTALLY new to ruby and I usually have just followed directions when installing packages, so I don't quite understand how to fix bugs.
If it helps, I was following the directions on this site:
http://octopress.org/docs/setup/rbenv/
You don't say what OS you are on but it appears it's OS X.
Do you have XCode with the command-line tools installed? Rbenv is a simple install and has worked on multiple OSes in my experience, but you have to have the compilers and tools installed first.
Looking at this:
checking whether the C compiler works... no
It looks you have a Mac and the C compiler not installed.
You should download and install from here:
https://github.com/kennethreitz/osx-gcc-installer
Although I am confused why your title has Python and you are new to Ruby. No offense but it's like you are saying I have a question about English I am new to Spanish.

How to fix this RVM error on a Macbook Pro i7 Running 10.6

I received the error described on this page http://www.fakingfantastic.com/2010/11/26/fixing-the-you-have-to-install-development-tools-first-error-with-nokogiri/ and in following their instructions i recieved the following error:
[2011-02-13 11:05:03] ./configure --prefix=/Users/MYNAME/.rvm/rubies/ruby-1.9.2-p136 --enable-shared
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/MYNAME/.rvm/src/ruby-1.9.2-p136':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
I thought that this : https://gist.github.com/767866 looked like an aswer but i cannot locate .rvmrc.
EDIT: i think the problem is i386. My the 1.8.2 install is x8x_64, it seems.
EDIT 2: after a bit more work i have it spitting this error out
[2011-02-13 11:51:05] ./configure --prefix=/Users/MYNAME/.rvm/rubies/ruby-1.9.2-p136 --enable-shared --build=i386-apple-darwin10.6.0 --host=i386-apple-darwin10.6.0
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for i386-apple-darwin10.6.0-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for i386-apple-darwin10.6.0-g++... no
checking for i386-apple-darwin10.6.0-c++... no
checking for i386-apple-darwin10.6.0-gpp... no
checking for i386-apple-darwin10.6.0-aCC... no
checking for i386-apple-darwin10.6.0-CC... no
checking for i386-apple-darwin10.6.0-cxx... no
checking for i386-apple-darwin10.6.0-cc++... no
checking for i386-apple-darwin10.6.0-cl.exe... no
checking for i386-apple-darwin10.6.0-FCC... no
checking for i386-apple-darwin10.6.0-KCC... no
checking for i386-apple-darwin10.6.0-RCC... no
checking for i386-apple-darwin10.6.0-xlC_r... no
checking for i386-apple-darwin10.6.0-xlC... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C preprocessor... /lib/cpp
configure: error: in `/Users/MYNAME/.rvm/src/ruby-1.9.2-p136':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
[2011-02-13 11:58:36] ./configure --prefix=/Users/MYNAME/.rvm/rubies/ruby-1.9.2-p136 --enable-shared
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/MYNAME/.rvm/src/ruby-1.9.2-p136':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
#eggie5 said:
I would put in your os x cd and install xcode again.
Do NOT install XCode from the DVD. The version that came on the 10.6 (Snow Leopard) disk is known to be buggy. Install the latest version from Apple's XCode site. You have to be registered to download, but it's a free registration.
I suspect you upgraded to 10.6, rather than it being installed by default when you bought your machine. 10.6 is 64-bit as is its related XCode version, so everything should have been 64-bit clean. Since it isn't it smells like regular Leopard or a pre-10.6 OS. That means all RVM hosted Rubies are suspicious and need to be cleaned up, along with any gems that were compiled prior to the upgrade and update of XCode.
After installing the XCode distribution, you'll need to uninstall, then install your RVM hosted Rubies. First, update RVM to the latest rev: Type rvm -v and note the revision number. Type rvm get head to load the latest version. When it has finished loading you should see a new revision number. RVM changes fast so you want to update to the latest pretty regularly.
This is from the RVM FAQ which is very good information for working with RVM, especially the comments about using sudo with gems:
My ruby is compiling as 32 bit but I am on Mac OS X Snow Leopard which has heavy advertisement that it is 64 bit!!!
RVM compiles to your current running kernel's architecture. This means that if your kernel is running as a 32 bit kernel (uname -m) it will compile 32 bit. You can override this behavior by placing the following in your ~/.rvmrc before installing the ruby interpreter:
rvm_archflags="-arch x86_64"
I think it's a good idea to set that rather than rely on defaults, since you're probably going to be on 64-bit from now on.
Type rvm reload or close your terminal window and reopen a session.
Type rvm notes and read it. This gives you a list of prerequisites you need for a smooth install of Ruby, based on your operating system. Failure to install those means various features might not work in Ruby, which will result in random, weird failures.
Type rvm list and make note of your installed Ruby versions. Pretend your first one is ruby-1.8.7-p330. Type:
rvm uninstall ruby-1.8.7-p330
rvm install ruby-1.8.7-p330
Repeat for each one you have installed. When you are done type rvm info and see if what it says passes sanity checks.
If everything looks good, it's time to rebuild the native drivers for your gems.
Both of these steps are optional, but are part of a good periodic house-keeping:
You might want to give your gems an update if you haven't run gem update for a while. rvm ruby 'gem update' will walk through the installed Rubies, updating them.
People accumulate old gems but often don't clean them up, so, to speed up rebuilding your gems you probably should clean out your old ones. You'll have to pay attention to what its telling you as it processes, because it will let you know about dependencies that will not be met. rvm ruby 'gem clean' will walk through the installed Rubies, and clean out the old stuff.
To rebuild the native drivers type rvm ruby 'gem pristine --all', which will reinstall all your gems.
Afterward, run rvm info and make sure it's returning sane information again.
Also, as an emergency escape hatch, it's entirely safe to blow away your ~/.rvm directory, either by typing rm -f ~/.rvm or using rvm implode, then starting over. Reinstalling a Ruby is the longest part of the process, and RVM makes it pretty painless once the supporting libraries are there.
I would put in your os x cd and install xcode again.

Error when updating my Ruby version using RVM on Mac OS X 10.6.6

I tried to update Ruby in my Mac OS X 10.6.6 system. Now I have 1.8.7, and I want to update to 1.9.2.
When I typed rvm install 1.9.2 I got:
gal-harths-iMac:~ galharth$ rvm install 1.9.2
/Users/galharth/.rvm/rubies/ruby-1.9.2-p136, this may take a while depending on your cpu(s)...
ruby-1.9.2-p136 - #fetching
ruby-1.9.2-p136 - #extracted to /Users/galharth/.rvm/src/ruby-1.9.2-p136 (already extracted)
ruby-1.9.2-p136 - #configuring
Error running ' ./configure --prefix=/Users/galharth/.rvm/rubies/ruby-1.9.2-p136 --enable-shared ', please read /Users/galharth/.rvm/log/ruby-1.9.2-p136/configure.log
There has been an error while running configure. Halting the installation.
I installed XCode and it still doesn't work.
This is the configure.log file:
[2011-02-08 17:10:04] ./configure --prefix=/Users/galharth/.rvm/rubies/ruby-1.9.2-p136 --enable-shared
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/galharth/.rvm/src/ruby-1.9.2-p136':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[2011-02-08 17:23:19] ./configure --prefix=/Users/galharth/.rvm/rubies/ruby-1.9.2-p136 --enable-shared
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/galharth/.rvm/src/ruby-1.9.2-p136':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[2011-02-08 20:44:14] ./configure --prefix=/Users/galharth/.rvm/rubies/ruby-1.9.2-p136 --enable-shared
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/galharth/.rvm/src/ruby-1.9.2-p136':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[2011-02-08 21:02:55] ./configure --prefix=/Users/galharth/.rvm/rubies/ruby-1.9.2-p136 --enable-shared
checking build system type... i386-apple-darwin10.6.0
checking host system type... i386-apple-darwin10.6.0
checking target system type... i386-apple-darwin10.6.0
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/galharth/.rvm/src/ruby-1.9.2-p136':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
There are some oddities in your log file output. Your question shows you have Mac OS 10.6.6, but the log shows the OS is i386. Mac OS 10.6.6 should be x86_64. This means for some reason your system thinks it's 32-bit when it should be 64bit. Your version of XCode needs to be current, so if you didn't just download it and install it, then do so. The version of XCode on the Snow Leopard disk was buggy, and the version for Mac OS prior to Snow Leopard is out of date once you install 10.6 on your machine.
Here's some things to try. If one works you're done, otherwise try the next one.
Do rvm -v and note the version number, then rvm get head followed by rvm reload if the version number displayed after updating has changed. Try running rvm install 1.9.2-p136.
Delete the files in your ~/.rvm/src/ruby-1.9.2-p136 directory using rm ~/.rvm/src/ruby-1.9.2-p136, then try installing using the install command in #1.
Manually download a copy of Ruby 1.9.2-p136 into your ~/.rvm/archives directory and extract it into your ~/.rvm/src/ruby-1.9.2-p136 directory. You can cd ~/.rvm/archives, delete any existing old version of the archive, then use curl -O ftp://ftp.ruby-lang.org:21//pub/ruby/1.9/ruby-1.9.2-p136.tar.gz or wget ftp://ftp.ruby-lang.org:21//pub/ruby/1.9/ruby-1.9.2-p136.tar.gz to pull in a new version. Then cd ~/.rvm/src then the rm command from #2 above followed by tar zxvf ../archives/ruby-1.9.2-p136.tar.gz to extract the files, then try running the RVM install command in #1.
I have a machine that's behind a proxy that won't allow RVM to get to the Ruby repositories, causing the archive to actually be the proxy's failure notice. When RVM tried burst the tar file, it would fail, but not catch the problem, then would try to configure and fail. The fix was to manually download the archive and burst it into the src directory.
Using the command rvm install 1.9.3 --with-gcc=clang worked for me.
When this happened to me, I inserted the Snow Leopard disk, selected Optional Installs and installed the Xcode package. That solved the missing C compiler problem as described here. Thanks to this blog: http://www.brianp.net/2009/09/05/snow-leopards-ate-my-c-compiler/
In my case, once I solved the compiler problem I got a permissions error. Running as root in bash gave rvm the appropriate permissions.
If you are running Lion check to make sure you have the Command Line Tools installed. They separated them from XCode so they are a separate download now. You can find them here:
https://developer.apple.com/downloads/index.action

Resources