7
votes

I get the following output when trying to install json gem on lion:

gem install json -v '1.7.3' Building native extensions. This could take a while... ERROR: Error installing json: ERROR: Failed to build gem native extension.

/Users/victorstan/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb creating Makefile

make compiling parser.c make: /usr/bin/gcc-4.2: No such file or directory make: * [parser.o] Error 1

1
Looks like you're on OSX. Did you recently install or upgrade xcode? mkmf generated a Makefile with a bad compiler, so you may have some bad symlinks hanging around still. This is definitely a system-level issue. You can probably resolve it with a symlink, but it's worth your time to investigate just what is going on to cause this issue.x1a4
I wish I knew how to investigate, how do I know what the bad symlinks are?Victor S

1 Answers

20
votes

Use which gcc and create a symlink to it in /usr/bin/gcc-4.2. e.g.

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2