-1

Have tried to reinstall ruby using rvm and ran into this error:

rvm reinstall all --force
Removing /usr/local/rvm/src/ruby-1.9.3-p194...
Removing /usr/local/rvm/rubies/ruby-1.9.3-p194...
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p194.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p194, this may take a while depending on your cpu(s)...
ruby-1.9.3-p194 - #downloading ruby-1.9.3-p194, this may take a while depending on your connection...
ruby-1.9.3-p194 - #extracting ruby-1.9.3-p194 to /usr/local/rvm/src/ruby-1.9.3-p194
ruby-1.9.3-p194 - #extracted to /usr/local/rvm/src/ruby-1.9.3-p194
ruby-1.9.3-p194 - #configuring
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/usr/local/rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p194', please read /usr/local/rvm/log/ruby-1.9.3-p194/configure.log
There has been an error while running configure. Halting the installation.

What can I do to fix this problem? Thanks in advance.

Error message:

cat /usr/local/rvm/log/ruby-1.9.3-p194/configure.log
[2012-11-22 09:39:59] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/usr/local/rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p194
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 whether the C compiler works... no
configure: error: in `/usr/local/rvm/src/ruby-1.9.3-p194':
configure: error: C compiler cannot create executables
See `config.log' for more details
unknown7cd1c3e98b07:~ pdenlinger$ cat config.log
cat: config.log: No such file or directory
unknown7cd1c3e98b07:~ pdenlinger$

GCC message:

gcc --version

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

'brew doctor' message

brew doctor
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/fuse.pc
Warning: You have a non-Homebrew 'pkg-config' in your PATH:
  /opt/sm/pkg/active/bin/pkg-config

`./configure` may have problems finding brew-installed packages using
this other pkg-config.

Config scripts outside Homebrew:

sudo mkdir /usr/local/Cellar
Password:
unknown7cd1c3e98b07:local pdenlinger$ sudo chown -R `whoami` /usr/local
unknown7cd1c3e98b07:local pdenlinger$ man chown
unknown7cd1c3e98b07:local pdenlinger$ brew doctor
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:

    /opt/sm/pkg/active/bin/curl-config
    /opt/sm/pkg/active/bin/ncurses5-config
    /opt/sm/pkg/active/bin/ncursesw5-config
    /opt/sm/pkg/active/bin/pkg-config
    /opt/sm/pkg/active/bin/xml2-config
    /opt/sm/pkg/active/bin/xslt-config
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/fuse.pc
Warning: You have a non-Homebrew 'pkg-config' in your PATH:
  /opt/sm/pkg/active/bin/pkg-config

`./configure` may have problems finding brew-installed packages using
this other pkg-config.
pdenlinger
  • 3,897
  • 10
  • 60
  • 92
  • If you "read /usr/local/rvm/log/ruby-1.9.3-p194/configure.log" as rvm asks, does that provide any useful info? – Dmitri Nov 22 '12 at 17:50
  • OK, next clue: "configure: error: C compiler cannot create executables" is gcc installed on your system---it is bundled with X code? Is it working? Or are you using an alternative to Xcode such as this: http://stackoverflow.com/questions/11436674/how-can-i-install-ruby-1-9-3-in-mac-os-x-mountain-lion-without-xcode – Dmitri Nov 22 '12 at 17:55
  • Yes, GCC is installed. Message added to body above. – pdenlinger Nov 22 '12 at 17:59
  • The other thing that I can think of off hand is that your gcc is not the gcc that Ruby is looking for. Could you also run `which gcc` ? – Dmitri Nov 22 '12 at 18:05

1 Answers1

0

OK, since your rvm is running with CFLAGS and PATH:

CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include

your gcc must have come from Home Brew, not Xcode, and this is no longer necessary.

My advice would be to re-install gcc as in the link above, and try to re-install ruby again.

This question may also help: RVM ruby installation errors - Mac

Community
  • 1
  • 1
Dmitri
  • 2,658
  • 2
  • 25
  • 41
  • Hmmm. I did install Homebrew and RVM earlier on, but today I just came on Moncef Belyamani's instruction on how to install Ruby 1.9.3 on Mountain Lion so am trying to do it again. Just downloaded Apple's Command Line Tools this morning. Do I need to do a clean uninstall of Homebrew and RVM and then reinstall all over? What are the commands for that? – pdenlinger Nov 22 '12 at 18:54
  • @pdenlinger I don't know if you need to do a clean uninstall, but I have found that this step usually saves more headaches than it causes--for one it saves the headaches of locating various configure files and modifying the paths they contain. Here are instructions to uninstall Homebrew: http://superuser.com/questions/203707/how-to-uninstall-homebrew-osx-package-manager. Rvm is even easier to uninstall. Use either `rvm implode` or `rm -rf ~/.rvm` – Dmitri Nov 22 '12 at 19:01
  • Just uninstalled Homebrew and RVM, and did a new install, and got a message when I ran 'brew doctor'. Message added above. – pdenlinger Nov 22 '12 at 19:13
  • Looks like Homebrew did not cleanly uninstall, but that shouldn't matter since if you installed GCC as per the link, when you re-install rvm, it should look for and find your new GCC binaries. – Dmitri Nov 22 '12 at 19:25
  • Just changed some additional settings and Homebrew listed additional config scripts which may cause trouble. Listed above. Do I need to delete them? – pdenlinger Nov 22 '12 at 19:45
  • You should not need Homebrew at all to run rvm. If you use it for something else, then it would not be a bad idea to look at those config scripts before deleting them. – Dmitri Nov 22 '12 at 21:24
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/19961/discussion-between-dmitri-and-pdenlinger) – Dmitri Nov 22 '12 at 22:11
  • OK, will ping you in a few hours as I need to go to Thanksgiving dinner. – pdenlinger Nov 22 '12 at 22:17