3

I understand a number of people have had a similar problem and I have tried many of the suggestions posted on stackoverflow and elsewhere (including: Can't install Ruby under Lion with RVM – GCC issues). Been at it for a long time (I am a novice).

I have gcc-4.2. I used osx-gcc-installer to get 4.2.

zach$ find /usr/bin -name "*gcc *"  
/usr/bin/gcc  
/usr/bin/gcc-4.2  
/usr/bin/i686-apple-darwin11-gcc-4.2.1  
/usr/bin/i686-apple-darwin11-llvm-gcc-4.2  
/usr/bin/llvm-gcc  
/usr/bin/llvm-gcc-4.2  

I have tried: CC=/usr/local/bin/gcc-4.2 rvm install 1.9.3 --enable-shared and rvm install 1.9.3 --with-gcc=clang.

Terminal Error Message:

No binary rubies available for: downloads/ruby-1.9.3-p327.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to /Users/zach/.rvm/archives
Extracting yaml to /Users/zach/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/zach/.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/zach/.rvm/usr', please read /Users/zach/.rvm/log/ruby-1.9.3-p327/yaml/configure.log
Compiling yaml in /Users/zach/.rvm/src/yaml-0.1.4.
Error running 'make', please read /Users/zach/.rvm/log/ruby-1.9.3-p327/yaml/make.log
Installing Ruby from source to: /Users/zach/.rvm/rubies/ruby-1.9.3-p327, this may take a     while depending on your cpu(s)...
ruby-1.9.3-p327 - #downloading ruby-1.9.3-p327, this may take a while depending on your     connection...
ruby-1.9.3-p327 - #extracted to /Users/zach/.rvm/src/ruby-1.9.3-p327 (already extracted)
ruby-1.9.3-p327 - #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/zach/.rvm/rubies/ruby-1.9.3-p327 --with-opt-dir=/Users/zach/.rvm/usr', please     read /Users/zach/.rvm/log/ruby-1.9.3-p327/configure.log
There has been an error while running configure. Halting the installation.

configure.log:

[2012-12-05 16:13:05] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --    prefix=/Users/zach/.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... gcc-4.2
checking whether the C compiler works... no
configure: error: in `/Users/zach/.rvm/src/yaml-0.1.4':
configure: error: C compiler cannot create executables

See `config.log' for more details

From config.log:

configure:2947: checking for gcc
configure:2974: result: gcc-4.2
configure:3203: checking for C compiler version
configure:3212: gcc-4.2 --version >&5
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)

To check links:

zach$ ls -la /usr/bin | grep gcc
lrwxr-xr-x     1 root        wheel         7 Dec  5 14:24 cc -> gcc-4.2
lrwxr-xr-x     1 root        wheel         7 Dec  5 14:15 gcc -> gcc-4.2
-rwxr-xr-x     1 root        wheel    113024 May 15  2011 gcc-4.2
-rwxr-xr-x     1 root        wheel    562992 May 15  2011 i686-apple-darwin11-gcc-4.2.1
lrwxr-xr-x     1 taylozac85  admin        52 Dec  3 21:44 i686-apple-darwin11-llvm-g++-4.2 
-> ../llvm-gcc-4.2/bin/i686-apple-darwin11-llvm-g++-4.2
lrwxr-xr-x     1 taylozac85  admin        52 Dec  3 21:44 i686-apple-darwin11-llvm-gcc-4.2
 -> ../llvm-gcc-4.2/bin/i686-apple-darwin11-llvm-gcc-4.2
lrwxr-xr-x     1 taylozac85  admin        32 Dec  3 21:44 llvm-cpp-4.2 -> ../llvm-gcc-
4.2/bin/llvm-cpp-4.2
lrwxr-xr-x     1 taylozac85  admin        32 Dec  3 21:44 llvm-g++ -> ../llvm-gcc-
4.2/bin/llvm-g++-4.2
lrwxr-xr-x     1 taylozac85  admin        32 Dec  3 21:44 llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
lrwxr-xr-x     1 taylozac85  admin        32 Dec  3 21:44 llvm-gcc -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
lrwxr-xr-x     1 taylozac85  admin        32 Dec  3 21:44 llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2

Any suggestions much appreciated. Thanks.

Community
  • 1
  • 1
zach
  • 167
  • 1
  • 2
  • 11
  • http://stackoverflow.com/questions/10357804/configure-error-c-compiler-cannot-create-executables – Casper Dec 06 '12 at 03:12

2 Answers2

3

looks like https://github.com/railsinstaller/railsinstaller-nix/issues/10

easiest way is to edit /etc/rvmrc and replace the rvm_configure_env=... line with:

rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib' 'CFLAGS=-I/opt/sm/pkg/active/include' 'CPATH=/opt/sm/pkg/active/include')
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • Wow, this fixed it. After everything I tried, can't believe it came down to quotes! Thanks! – zach Dec 06 '12 at 04:34
0

did u install command line tools in your Xcode, use ls -la /usr/bin | grep gcc to check whether your gcc is linked to your llvm-gcc

Richie Min
  • 654
  • 5
  • 15
  • Added the results of `ls -la /usr/bin | grep gcc` above. I changed the symlinks for cc and gcc to gcc-4.2 from llvm version. Is there a way to check if I have installed the appropriate command line tools in my Xcode? – zach Dec 06 '12 at 03:38