RedHat C compiler does not compile? - ruby

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.

Related

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

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?

How to accurately make configure script use the updated gcc version on CentOS?

I have followed instructions provided in other articles to fix the below issue but still doesn't appear to work for my system. I am trying to upgrade glibc to v2.27 on my CentOS 7.3 machine. I downloaded the package and running into the below compiler dependency during the configure script execution:
../configure --prefix=/opt/glibc-2.27
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
...
...
checking if gcc is sufficient to build libc... no
checking for nm... nm
checking for python3... no
checking for python... python
configure: error:
*** These critical programs are missing or too old: compiler
*** Check the INSTALL file for required versions.
So I upgraded my gcc and verified the upgraded version:
gcc --version
gcc (GCC) 8.2.0
I also have the following environment variable set in my bashrc:
export CC=/usr/local/bin/gcc
For some reason, the configure script still throws the same error based on which it appears that the upgraded gcc version isn't being used.
What am I missing?

Issue with installing Ruby 2.0.0 with rvm on Fedora linux

Hi I started my adventure with RVM and tried to install Ruby 2.0.0
I run CS50-19 Appliance virtual machine on my Win7 PC
I have got this:
Error running './configure --prefix=/home/jharvard/.rvm/rubies/ruby-2.0.0-p451 --disable-install-doc --enable-shared',
showing last 15 lines of /home/jharvard/.rvm/log/1395728421_ruby-2.0.0-p451/configure.log
[2014-03-25 02:20:46] ./configure
current path: /home/jharvard/.rvm/src/ruby-2.0.0-p451
PATH=/etc/log50.d:/usr/lib/qt-3.3/bin:/etc/log50.d:/usr/libexec/lightdm:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/jharvard/.local/bin:/home/jharvard/bin:/home/jharvard/.local/bin:/home/jharvard/bin:/home/jharvard/.rvm/bin
command(4): ./configure --prefix=/home/jharvard/.rvm/rubies/ruby-2.0.0-p451 --disable-install-doc --enable-shared
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking whether the C compiler works... no
configure: error: in `/home/jharvard/.rvm/src/ruby-2.0.0-p451':
configure: error: C compiler cannot create executables
See `config.log' for more details
And since I am with linux since 4 days I dont understand much of this please help :)
You need to install the compiler and supported dependencies and then go for the rvm setup instructions. You might also want to look into rbenv as an alternative to rvm.

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.

Resources