Snow Leopard 32bit kernel gotcha

David Palm dvdplm at gmail.com
Mon Nov 30 06:41:17 EST 2009


Hi,
just thought I'd signal an issue I had this morning installing unicorn under Ruby 1.9.1.

I'm using the exellent rvm to handle my rubies and made a mistake when I first installed it after passing to Snow Leopard. In order to build libraries with 64bit support you have to stick the following in your ~/.rvmrc:
	rvm_archflags="-arch x86_64"

So my mistake was I built my ruby 1.9 before passing to a 64bit kernel.

I got a pretty weird error from unicorn:

	In file included from unicorn_http.rl:7:
	ext_help.h: In function ‘rb_18_str_set_len’:
	ext_help.h:20: error: ‘struct RString’ has no member named ‘len’
	ext_help.h:21: error: ‘struct RString’ has no member named ‘ptr’
	make: *** [unicorn_http.o] Error 1

That threw me off in the wrong direction, thinking it was yet another extension that didn't get the RSTRING struct changes right. Not so.

Looking more carefully at mkmf.log it all became obvious:

	In file included from /Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby.h:32,
                 from conftest.c:1:
	/Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h: In function ‘INT2NUM’:
	/Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h:464: warning: comparison is always true due to limited 	range of data type
	/Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h:464: warning: comparison is always true due to limited 	range of data type
	/Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h: In function ‘UINT2NUM’:
	/Users/david/.rvm/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/ruby.h:472: warning: comparison is always true due to limited 	range of data type
	ld: warning: in /Users/david/.rvm/ruby-1.9.1-p243/lib/libruby-static.a, file is not of required architecture

Lipo to the rescue:
	lipo -info ~/.rvm/ruby-1.9.1-p243/lib/libruby-static.a
	input file /Users/david/.rvm/ruby-1.9.1-p243/lib/libruby-static.a is not a fat file
	Non-fat file: /Users/david/.rvm/ruby-1.9.1-p243/lib/libruby-static.a is architecture: i386

Solution? Remove old 1.9 install and reinstall everything (at least all C extensions).

:)


More information about the mongrel-unicorn mailing list