Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

upgrade to osx lion, bundler gets native extension errors - no such file or directory

I am having a problem that has had me stuck for a day and a half, and I would like some assistance.

I have been moving my latest rails 3 app between my iMac and my macbook pro, with a simple copy, and up till now, I have had no problems.

fyi, I use rvm to manage my project versions.

I got a new iMac, with lion installed, and everything seemed to be good until I ran the bundle update on it. Since then I have not been able to get the bundler to work. The problems crop up when building a gem native extension.

Once I run the bundle update, nothing works on my iMac (osx lion) machine. I can continue to run bundle update on my laptop (Snow Leopard).

So I would like to be able to continue to develop on my Lion machine. Here is what I have done so far:

Initially, I got some errors about my compilers, but since I have reinstalled xcode and run the installer, I no longer those errors.

I still continued to get errors on my nokogiri build. At one point I followed some blog instructions ( and did:

sudo port upgrade --enforce-variants libxml2 +universal

but it seemed to make no difference to building nokogiri.

Now when I do the bundle update, I am getting:

Installing nokogiri (1.5.0) with native extensions /Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        /Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb 
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
checking for xmlHasFeature()... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile

make
gcc-4.2 -I. -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/x86_64-darwin10.6.0 -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/ruby/backward -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1 -I. -DHAVE_XMLHASFEATURE -DHAVE_XMLFIRSTELEMENTCHILD -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETPARSERSTRUCTUREDERRORS -I/opt/local/include/libxml2 -I/usr/local/include/libxml2 -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/libxml2 -I/opt/local/include -I/usr/local/include -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include -I/usr/include -I/usr/include/libxml2 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -fno-common -pipe  -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline  -o html_document.o -c html_document.c
make: gcc-4.2: No such file or directory
make: *** [html_document.o] Error 1


Gem files will remain installed in /Users/tayloredwebsites/.rvm/gems/ruby-1.9.2-p136@current/gems/nokogiri-1.5.0 for inspection.

After doing this waaaay too many times, I decided to remove capybara and lanuchy from my Gemfile, so that I would get past this error. Lo and behold, bundle update gives me another failure to build a native extension:

Installing sqlite3 (1.3.5) with native extensions /Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        /Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb 
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
creating Makefile

make
gcc-4.2 -I. -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/x86_64-darwin10.6.0 -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/ruby/backward -I/Users/tayloredwebsites/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1 -I. -DHAVE_RB_PROC_ARITY -DHAVE_SQLITE3_INITIALIZE -DHAVE_SQLITE3_BACKUP_INIT -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -fno-common -pipe  -o backup.o -c backup.c
make: gcc-4.2: No such file or directory
make: *** [backup.o] Error 1

So it appears that I am getting a no such file error on my builds, for the same set of code, with the basic difference that one machine is on Lion, and the other is on Snow Leopard.

So maybe someone can help me with these questions:

In my investigations, I noticed that in the nokogiri build, libxml2 is being asked for in 3 places (two of which do not exist!!!!). Anyone know how to control how to control these arguments, so that I can remove the ones that do not exist?

When I looked at the sqlite3 build, I did not notice any missing files, yet I seem to be still getting them. Could this be hung over from the nokogiri problem? If so, does anyone know how I clear these out?

I would like to know what file is missing, and I cant seem to find it in the error message. Is there any way to get debugger detail from the bundle update?

also I noticed that in the make, the include directory contains a directory named with an older version of ruby. This has been this way for quite a while, without any problems, so I suspect this will not be the problem here, but just wanted to point it out.

like image 1000
Taylored Web Sites Avatar asked Dec 06 '11 21:12

Taylored Web Sites


1 Answers

There is literally no such file or directory gcc-4.2 on Lion. I got stuck on this when trying to "rvm install ruby-1.9.3" which failed similar to what you report. A fix was to specify the CC command like this "CC=gcc rvm install ruby-1.9.3". If the CC=gcc option cannot be passed through to bundler, it might be simpler to "sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2" and just create the symlink it is looking for.

like image 188
mobileAgent Avatar answered Nov 15 '22 05:11

mobileAgent