Closed bryanl closed 15 years ago
hmm...what should I do so it works on 10.4-10.6 equally?
when i do a dual build for i386 and x86_64 on snow leopard, i also get problems.
>> require 'memcached' LoadError: dlsym(0x101b2f270, Init_rlibmemcached): symbol not found - /Library/Ruby/Gems/1.8/gems/memcached-0.15.3/lib/rlibmemcached.bundle
$ file /Library/Ruby/Gems/1.8/gems/memcached-0.15b/rlibmemcached.bundle /Library/Ruby/Gems/1.8/gems/memcached-0.15.3/lib/rlibmemcached.bundle: Mach-O universal binary with 2 architectures /Library/Ruby/Gems/1.8/gems/memcached-0.15.3/lib/rlibmemcached.bundle (for architecture i386): Mach-O bundle i386 /Library/Ruby/Gems/1.8/gems/memcached-0.15.3/lib/rlibmemcached.bundle (for architecture x86_64): Mach-O 64-bit bundle x86_64
for some reason you specify arch flags directly in the cflags of the makefile? i believe it should be in ARCHFLAGS, which you then include.
to fix this manually... open up "/Library/Ruby/Gems/1.8/gems/memcached-0.15.3/ext/Makefile" and replace all instances of 'i386' with 'x86_64'. don't try to build a universal bundle with support for both archs, because there will be missing symbols anyways.
ruby will attempt to set ARCHFLAGS to "-arch i386 -arch ppc" on leopard, so i had an alias still active that set ARCHFLAGS to '-arch i386'. i'm not sure what the default on snow leopard is... but for memcached, ARCHFLAGS are not respected anyways.
I'm confused...can you make a patch that will do the right thing? I don't have snow leopard.
I think I have a working universal binary....
[16:19][memcached](master)$ file lib/rlibmemcached.bundle
lib/rlibmemcached.bundle: Mach-O universal binary with 2 architectures
lib/rlibmemcached.bundle (for architecture i386): Mach-O bundle i386
lib/rlibmemcached.bundle (for architecture x86_64): Mach-O 64-bit bundle x86_64
The way I did it in the extconf.rb file, however, is more than a bit ugly to me. Perhaps you can figure out how to clean it up... I </3 mkmf.
There are two problems. First, the right flags aren't passed on to the libmemcached build. Second, the libmemcached build ignores any CXXFLAGS you pass in to configure (even though it will use the CFLAGS, etc)... so you need to pass those into make as well.
diff is here: http://pastie.org/586308
rather, i know it works, but i don't know 100% for sure that the i386 code works. my ruby binary has x86_64, i386, and ppc arch code... but i have no idea how to run the i386 build instead of the x86_64 build.
figured it out, and yes... it works.
$ arch -i386 $(which ruby) $(which irb)
>> require 'memcached'
=> true
>>
ttilley, I'm having the same problem you reported on snow leopard.
I tried your patch and I'm still getting LoadError: dlsym(0x101b2f270, Init_rlibmemcached): symbol not found - /Library/Ruby/Gems/1.8/gems/memcached-0.15.3/lib/rlibmemcached.bundle
after patching the file I ran: rake clean rake compile
is there anything else I should be doing?
huh. i'll do a clean install of seed 10A432 on a play partition tomorrow and see if i missed something. just to make sure:
i just did a clean install, used macports to install git, did a clean git clone, applied patch, installed echoe gem, ran rake install:development. works for me.
yes...works for me too with a clean check out of source from github. Thanks for the solution.
Works for me! Committed.
When 10.6 is released next month, i386 won't work for builds any more. You'll have to use x86_64.