4

When trying to install Ruby 1.9.3 using RVM (rvm install ruby 1.9.3) I get the following error:

Searching for binary rubies, this might take some time.

No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p362.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.

Fetching yaml-0.1.4.tar.gz to /Users/christiaan/.rvm/archives
Extracting yaml to /Users/christiaan/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/christiaan/.rvm/src/yaml-0.1.4.

Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/christiaan/.rvm/usr', please read /Users/christiaan/.rvm/log/ruby-1.9.3-p362/yaml/configure.log

Compiling yaml in /Users/christiaan/.rvm/src/yaml-0.1.4.

Error running 'make', please read /Users/christiaan/.rvm/log/ruby-1.9.3-p362/yaml/make.log
Installing Ruby from source to: /Users/christiaan/.rvm/rubies/ruby-1.9.3-p362, this may take a while depending on your cpu(s)...
ruby-1.9.3-p362 - #downloading ruby-1.9.3-p362, this may take a while depending on your connection...
ruby-1.9.3-p362 - #extracted to /Users/christiaan/.rvm/src/ruby-1.9.3-p362 (already extracted)
ruby-1.9.3-p362 - #configuring
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/christiaan/.rvm/rubies/ruby-1.9.3-p362 --with-opt-dir=/Users/christiaan/.rvm/usr', please read /Users/christiaan/.rvm/log/ruby-1.9.3-p362/configure.log

There has been an error while running configure. Halting the installation.

I've tried all the tips from similar questions, but can't seem to fix this.

YAML Log (first error log produced):

[2012-12-28 16:18:06] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/christiaan/.rvm/usr
current path: /Users/christiaan/.rvm/src/yaml-0.1.4
command(4): env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/christiaan/.rvm/usr
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for gcc... /usr/local/bin/gcc-4.2
checking whether the C compiler works... no
configure: error: in `/Users/christiaan/.rvm/src/yaml-0.1.4':
configure: error: C compiler cannot create executables
See `config.log' for more details

RVM Log (second error log produced):

[2012-12-28 16:18:08] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/christiaan/.rvm/rubies/ruby-1.9.3-p362 --with-opt-dir=/Users/christiaan/.rvm/usr
current path: /Users/christiaan/.rvm/src/ruby-1.9.3-p362
command(7): env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --enable-shared --disable-install-doc --prefix=/Users/christiaan/.rvm/rubies/ruby-1.9.3-p362 --with-opt-dir=/Users/christiaan/.rvm/usr
checking build system type... x86_64-apple-darwin12.2.0
checking host system type... x86_64-apple-darwin12.2.0
checking target system type... x86_64-apple-darwin12.2.0
checking for C compiler default output file name... 
configure: error: C compiler cannot create executables
See `config.log' for more details.
chendriksen
  • 1,026
  • 6
  • 16
  • 30

3 Answers3

11

Your main issue is:

configure: error: C compiler cannot create executables

So search for solutions to that problem. Like:

rvm install 1.9.3 --with-gcc=clang

Other examples:

Community
  • 1
  • 1
Casper
  • 33,403
  • 4
  • 84
  • 79
  • I would recommend against compiling Ruby with clang. It's still not completely compatible and your mileage will vary. Stick with gcc. ```rvm requirements``` tells you the easiest way to set up your environment with gcc. – Remear Dec 28 '12 at 17:01
  • @Remear Ok..thanks. I still find it strange how people seem to stumble upon this same problem over and over again. Do they not read instructions or are `rvm requirements` not working properly. Strange..in any case this particular problem seems to be a gcc (Xcode?) installation issue. – Casper Dec 28 '12 at 17:07
  • One of the largest issues RVM development faces is the lack of following directions. rvm requirements has been the de-facto standard for system-specific information on what you need to do to install most rubies. You can only do so much to get the info out there but you can't make people actually read it. Unfortunately a lot of blogs out there is where people go to find solutions and there's a lot of misinformation in them. This particular problem seems to be a lack of a suitable gcc-based compiler in the user's $PATH. – Remear Dec 28 '12 at 17:26
  • As evidenced by http://stackoverflow.com/questions/14073489/rvm-ruby-install-issue/14074319#14074319 – Remear Dec 28 '12 at 18:57
  • I did follow all the instructions in `rvm equirements`, as I mentioned above, and I've still been facing this issue. I've installed gcc4.2 but I'm still getting the same error. – chendriksen Jan 10 '13 at 22:56
3

It is a duplicate, there are already few answers for this but I have made the fix also into RVM, make sure to run rvm get head first and read the output - the fix is displayed there.

This problem is also reported back to RailsInstaller: https://github.com/railsinstaller/railsinstaller-nix/issues/10

mpapis
  • 52,729
  • 14
  • 121
  • 158
3

Xcode->Preferences

Check "Command line tools"

sparkle
  • 7,530
  • 22
  • 69
  • 131