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

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.

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.

I have reinstalled everything on my OSX Lion. I upgraded to Server to get past some postgres issues. Note when I installed rvm, one of the steps is to run;
$ rvm requirements
which returns, among other things:
Xcode 4.2: * is only supported by ruby 1.9.3+ using command line
flag: --with-gcc=clang * it breaks gems with native extensions,
especially DB drivers.
Xcode 4.2.1+ users - please be warned - in case of any compilation
issues * downgrade to Xcode 4.1 * uninstall Xcode and install
osx-gcc-installer and reinstall your rubies.
Note: if you uninstall Xcode, you lose the standard MacPort Xcode setup.
Note you can build MacPorts from source using gcc - not tried (at least yet).

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

I had built my ruby-1.9.3 with clang so when installing the nokogiri gem I used CC=clang gem install nokogiri -v '1.5.5' which worked for me.

Related

having issues with installing perl modules :: Make had returned bad status, install seems impossible

good day - i am still having issues with installing perl modules
there seems to be issues with the make-file. i am trying to figure out what goes wrong here on my notebook.
cpan[1]> install Data::Dumper
Running install for module 'Data::Dumper'
Running make for S/SM/SMUELLER/Data-Dumper-2.161.tar.gz
Fetching with LWP:
http://mirrors.hostingromania.ro/cpan.org/authors/id/S/SM/SMUELLER/Data-Dumper-2.161.tar.gz
Fetching with LWP:
http://mirrors.hostingromania.ro/cpan.org/authors/id/S/SM/SMUELLER/CHECKSUMS
Checksum for /home/martin/.cpan/sources/authors/id/S/SM/SMUELLER/Data-Dumper-2.161.tar.gz ok
CPAN.pm: Building S/SM/SMUELLER/Data-Dumper-2.161.tar.gz
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Data::Dumper
Writing MYMETA.yml and MYMETA.json
cp Dumper.pm blib/lib/Data/Dumper.pm
Running Mkbootstrap for Dumper ()
chmod 644 "Dumper.bs"
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Dumper.bs blib/arch/auto/Data/Dumper/Dumper.bs 644
"/usr/bin/perl" "/usr/lib/perl5/5.18.2/ExtUtils/xsubpp" -typemap '/usr/lib/perl5/5.18.2/ExtUtils/typemap' Dumper.xs > Dumper.xsc
mv Dumper.xsc Dumper.c
cc -c -D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe -DVERSION=\"2.161\" -DXS_VERSION=\"2.161\" -fPIC "-I/usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/CORE" -DUSE_PPPORT_H Dumper.c
/bin/sh: cc: Kommando nicht gefunden.
Makefile:332: recipe for target 'Dumper.o' failed
make: *** [Dumper.o] Error 127
SMUELLER/Data-Dumper-2.161.tar.gz
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Failed during this command:
SMUELLER/Data-Dumper-2.161.tar.gz : make NO
cpan[2]>
well - i need to make sure that the make is set propperly ..good day - i am still having issues with installing perl modules
there seems to be issues with the make-file. i am trying to figure out what goes wrong here on my notebook.
A C compiler is required to build that module, but the C compiler which perl was built with, 'cc' isn''t available. You will need to install that first.
But Data::Dumper is part of the standard perl distribution, so you shouldn't need to install it anyway. If you're using a Linux distribution where the perl installation has been split into multiple packages, then you may just need to do something like
yum install perl-Data-Dumper

Building Debian/Ubuntu packages with old gcc: CFLAG adjustment?

I need to short circuit some security features in the Debian packaging process. I explain why here, knowing that your first reactions might be "don't disable security features" and "update your program to compile with new gcc."
I have to use gcc-4.6 to compile some libraries (http://pj.freefaculty.org/Swarm) because that is the last version of gcc that provided the traditional Objective-C API. After that, gcc removed the traditional headers. Hence, "upgrade your gcc" is not acceptable because we have a very large code base using the traditional Objective-C.
In Ubuntu 17.04, gcc-4.6 is no longer available, but I've found I can install it by pulling an old version from Ubuntu "trusty". It runs fine. I can compile programs and install them the old fashioned make install way.
However, I run into a problem when building Debian packages. When I run dpkg-buildpackage -rfakeroot, as I usually do to build a package, I hit a failure because the Debian packaging system has inserted CFLAGS that are not legal in gcc-4.6. In particular, the command line includes -Wdate-time and -fstack-protector-strong, both of which are not compatible with gcc-4.6.
Here's a piece of the config.log.
configure:3878: checking whether the C compiler works
configure:3900: gcc -g -O2 -fdebug-prefix-map=/home/pauljohn/LinuxDownloads/Debian/sources/amd64/swarm-Ubuntu17.04/swarm-2.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro conftest.c >&5
cc1: error: unrecognized command line option '-Wdate-time'
cc1: error: unrecognized command line option '-fstack-protector-strong
I've inspected the debian directory with the package and I see that those flags are not manually inserted there. From what I can tell, they come along with dpkg-buildpackage.
This library I'm trying to compile is, well, an old program. Its one on which we worked, in affiliation with the Santa Fe Institute, about 15-20 years ago. It is not reasonable to rewrite this old code to use the new Objective-C interface, so it is important to live within the restriction of gcc-4.6.
So far, the most useful suggestion I've received is to drop the Debian/Ubuntu architecture and shift to a RedHat based one, where older gcc is more easily tolerated. In fact, on RedHat 6, gcc-4.6 would be somewhat ahead of the usual, while I can still install gcc-4.6 on RedHat 7, so far as I can tell. I'd rather not exclude the Ubuntu users, however, by doing that.
Any other ideas about how to navigate this would be appreciated.
The relevant documentation is man 1 dpkg-buildflags
You basically have two options:
override specific build features of the dpkg buildprocess, hoping to remove the right flags
export DEB_BUILD_OPTIONS="hardening=-stackprotectorstrong reproducible=-timeless"
dpkg-buildpackage -rfakeroot
strip specific build flags from specific build variables
export DEB_CPPFLAGS_STRIP="-Wdate-time"
export DEB_CFLAGS_STRIP="-fstack-protector-string"
export DEB_CXXFLAGS_STRIP="-fstack-protector-string"
dpkg-buildpackage -rfakeroot
You can also make both ways persistent via configuration files.

Building Apache on Mountain Lion libtool problems

I'm trying to install apache from source on my mac. But keep running into problems. I've tried a ton of different things and just can't get this to build.
First, I couldn't configure without errors so I reinstalled apache apr. Now, I can configure but when I run make, I get this error:
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
I tried this to add in the libtool tag:
./configure LIBTOOL='/usr/local/bin/glibtool --tag=CC'
And this still gave the same error. I read that mountain lions glibtool is the unix-like libtool so that's why I tried this here. Still to no avail. I also tried symlinking the libtool that make uses to other versions on my machine, still to no avail, as I got the same error.
Here's what the make command runs, I tried symlinking /usr/share/apr-1/build-1/libtool
/usr/share/apr-1/build-1/libtool --silent --mode=compile /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 -std=gnu99 -O2 -arch x86_64 -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/opt/local/include -I/opt/X11/include -I. -I/usr/local/src/httpd-2.4.3/os/unix -I/usr/local/src/httpd-2.4.3/include -I/usr/include/apr-1 -I/usr/local/include -I/usr/local/src/httpd-2.4.3/modules/aaa -I/usr/local/src/httpd-2.4.3/modules/cache -I/usr/local/src/httpd-2.4.3/modules/core -I/usr/local/src/httpd-2.4.3/modules/database -I/usr/local/src/httpd-2.4.3/modules/filters -I/usr/local/src/httpd-2.4.3/modules/ldap -I/usr/local/src/httpd-2.4.3/modules/loggers -I/usr/local/src/httpd-2.4.3/modules/lua -I/usr/local/src/httpd-2.4.3/modules/proxy -I/usr/local/src/httpd-2.4.3/modules/session -I/usr/local/src/httpd-2.4.3/modules/ssl -I/usr/local/src/httpd-2.4.3/modules/test -I/usr/local/src/httpd-2.4.3/server -I/usr/local/src/httpd-2.4.3/modules/arch/unix -I/usr/local/src/httpd-2.4.3/modules/dav/main -I/usr/local/src/httpd-2.4.3/modules/generators -I/usr/local/src/httpd-2.4.3/modules/mappers -prefer-non-pic -static -c exports.c && touch exports.lo
This still didn't work.
Finally, I got further if I ran configure like this, ./configure --with-apr='/usr/local/src/apr/apr-config (where I installed the system, but this is still broken.) This got me further but it still wouldn't finish make, and gave me a ton of errors like this.
exports.c:1809: error: redefinition of 'ap_hack_apr_version_string'
exports.c:1141: error: previous definition of 'ap_hack_apr_version_string' was here
I finally figured it out ...
For anyone having trouble installing apache on Mountain Lion, it looks like the default LIBTOOLS in the source's build/config_vars.mk file is the wrong location.
I reinstalled LIBTOOLS with homebrew (which put it at /usr/local/bin/glibtool) and set this as the variable and all worked fine.

Missing linux/types.h failing to install gem

I'm getting an error trying to install eventmachine on my ubuntu 12.04 server. Any ideas?
bundle exec gem install eventmachine
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
/opt/ruby-enterprise-1.8.7-2012.02/bin/ruby extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for inotify_init() in sys/inotify.h... yes
checking for writev() in sys/uio.h... yes
checking for rb_thread_check_ints()... no
checking for rb_time_new()... yes
checking for sys/event.h... no
checking for epoll_create() in sys/epoll.h... yes
creating Makefile
make
g++ -I. -I/opt/local/include -I. -I/opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/1.8/i686-linux -I. -DWITH_SSL -DBUILD_FOR_RUBY -DHAVE_INOTIFY_INIT -DHAVE_INOTIFY -DHAVE_WRITEV -DHAVE_WRITEV -DHAVE_RB_TIME_NEW -DOS_UNIX -DHAVE_EPOLL_CREATE -DHAVE_EPOLL -D_FILE_OFFSET_BITS=64 -fPIC -g -O2 -c binder.cpp
In file included from /usr/include/i386-linux-gnu/bits/sigcontext.h:28:0,
from /usr/include/signal.h:339,
from project.h:40,
from binder.cpp:20:
/usr/include/i386-linux-gnu/asm/sigcontext.h:5:25: fatal error: linux/types.h: No such file or directory
compilation terminated.
make: *** [binder.o] Error 1
I've just run into the same problem. Either the path for types.h is different on your distribution, or it does not exist at all. Try to manually include it.
http://linux.die.net/include/sys/types.h
Your program is going to give you a file, and line number error where it is trying to "include" types.h. What I did to solve the problem, was add types.h into the same folder as the file requesting it. Then you go into the file, on the line that the include error is, and replace the path of (for example) "/linux/types.h", with "types.h" since you have it in the same directory. Now, make, make install. If you receive another include issue, you might want to consider either changing flavors, or if you feel up to it, keep adding includes. Welcome to the wonderful world of hacking. :)

Error installing mod_wsgi 3.2

I am trying to install mod_wsgi 3.2 on Mac OSX 10.6.6 and am getting this error when I attempt to make
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
lipo: can't open input file: /var/folders/XW/XWYalsEzG3Gkn+PhoNKF0k+++TI/-Tmp-//ccsEgbTa.out (No such file or directory)
apxs:Error: Command failed with rc=65536
.
make: * [mod_wsgi.la] Error 1
This is a late answer, but I found a solution in my searching and wanted to include it here for others. This error typically occurs because you are trying to build libraries for ppc architecture which won't work as xcode4 doesn't no longer includes support for ppc. You can get around this by setting the following in your environment before running your build (I put this in my .bash_profile so I don't beat my head against the wall later):
export ARCHFLAGS="-arch i386 -arch x86_64"
The latest mod_wsgi version is 3.3 for a start, why are you using 3.2? Second, there is a precompiled mod_wsgi.so binary for MacOS X which can be used for Apple supplied Python and Apache, so you do not need to compile it from source code and so avoid need to have installed XCode development tools. The precompile mod_wsgi.so is available from mod_wsgi download page.
As to the errors, it would appear to be a permissions problem for user that you are compiling as. That or you aren't using standard Apple supplied software and have somehow mixed up your PATH so it is grabbing disparate tools from different package distributions. Are you using just Apple tools or have you installed any of MacPorts, fink or HomeBrew?
Edit the Make file like:
CPPFLAGS = -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DNDEBUG
CFLAGS = -Wc,"-arch i386" -Wc,"-arch x86_64" -Wc
LDFLAGS = -arch i386 -arch x86_64 -F/Library/Frameworks -framework Python -u _PyMac_Error
LDLIBS = -ldl -framework CoreFoundation
I had the same question
In the end,I found I don't have write permission of '/usr/libexec/apache2/'
then I add chmod +w to the folder,,
then install success !!
Hope my answer can be a refer for some others
Good Luck!