Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C Compiler cannot create Executables on Mac OS Mountain Lion

Tags:

gcc

ruby

rbenv

I've been through almost every page and all the tips don't fix the problem. I'm running Mountain Lion I've got Xcode, all the latest developer tools the latest GCC and everything. I am trying to set up rbenv and ruby-build. Everything seems to work but when I go to install a version of ruby it says that the c compiler doesn't work and that it can't create executables. The exact last lines of the log:

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/bin/gcc-4.2
checking whether the C compiler works... no
configure: error: in `/var/folders/zr/gv4jcc_122sfrtpfj5g9prc00000gn/T/ruby-build.20130106144331.1477/yaml-0.1.4':
configure: error: C compiler cannot create executables

I'm stumped. The log contains:

configure:3265: /usr/bin/gcc-4.2  -I'/Volumes/Macintosh HD 2/Users/jmart/.rbenv/versions/1.9.3-p327/include'  -L'/Volumes/Macintosh HD 2/Users/jmart/.rbenv/versions/1.9.3-p327/lib'  conftest.c  >&5
i686-apple-darwin11-gcc-4.2.1: HD: No such file or directory
i686-apple-darwin11-gcc-4.2.1: 2/Users/jmart/.rbenv/versions/1.9.3-p327/include': No such file or directory
i686-apple-darwin11-gcc-4.2.1: HD: No such file or directory
i686-apple-darwin11-gcc-4.2.1: 2/Users/jmart/.rbenv/versions/1.9.3-p327/lib': No such file or directory
configure:3269: $? = 1
configure:3307: result: no

UPDATE:: Noticing the "HD: No such..." & "2" No Such... I do have two two Drives installed in my mac - one for user files and one for sys files. Is that what's throwing the error here?

like image 950
motleydev Avatar asked Mar 08 '26 09:03

motleydev


1 Answers

It looks like a bug in the configure script, but there is no need to rename the volume; just make a symbolic link. I don't have a Mac, but something like this should do it (as root):

cd /Volumes
ln -s 'Macintosh HD2' MacHD2

Then:

./configure --prefix=/Volumes/MacHD2/Users/jmart/.rbenv/versions/1.9.3-p327
like image 173
Casper Avatar answered Mar 10 '26 02:03

Casper