arthurnn / memcached

A Ruby interface to the libmemcached C client
Academic Free License v3.0
432 stars 127 forks source link

Invalid arch flags on Snow Leopard cause compilation issues #9

Closed dbussink closed 14 years ago

dbussink commented 14 years ago

This line: "#{RbConfig::CONFIG['CFLAGS']} #{$CFLAGS}".split(" ").uniq.join(" ").gsub("$(cflags)", "").gsub("ppc", "")

results in the following line for Snow Leopard: gcc -arch i386 x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE

This is not valid, because it has to be -arch i386 -arch x86_64 in order to compile it for both architectures. With these flags, the compilations fails with the following error:

i686-apple-darwin10-gcc-4.2.1: x86_64: No such file or directory

evan commented 14 years ago

Try the latest master.

dbussink commented 14 years ago

Cool, this fixes it :)

dbackeus commented 14 years ago

I'm having problems compiling on the old Leopard myself;

libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -I.. -I.. -ggdb3 -O3 -pedantic -Wall -Wextra -Wundef -Wshadow -fvisibility=hidden -Wformat=2 -Wstrict-aliasing -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -D_THREAD_SAFE -fPIC -I/Library/Ruby/Gems/1.8/gems/memcached-0.17.6/ext/include -L/Library/Ruby/Gems/1.8/gems/memcached-0.17.6/ext/lib -arch ppc -arch i386 -Os -pipe -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -MT libmemcached_la-crc.lo -MD -MP -MF .deps/libmemcached_la-crc.Tpo -c crc.c -o libmemcached_la-crc.o gcc-4.0: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags make[2]: * [libmemcached_la-crc.lo] Error 1 make[1]: * [install] Error 2 make: * [install-recursive] Error 1 * extconf.rb failed ***

evan commented 14 years ago

What a mess. The arch flags are taken from your Ruby build...how did it get compiled? Can you figure out how to disable -save-temps and -M options (or what they do?)

morten commented 14 years ago

It fails on Leopard for me too - 0.17.5 works nicely. The full output: http://gist.github.com/245153 - looks like make is choking early on?

evan commented 14 years ago

Try v. 0.17.7.

spovich commented 14 years ago

Using macports ruby 1.8.7, I tried this last night on my Snow Leopard machine and it installed perfectly, but install fails on Leopard (10.5) using macports ruby 1.8.7

...snip... Making install in libmemcached make install-am /bin/sh ../libtool --tag=CC --mode=link /usr/bin/gcc-4.2 -std=gnu99 -O3 -pedantic -Wall -Wextra -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wstrict-aliasing -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -fno-strict-aliasing -Wno-strict-aliasing -D_THREAD_SAFE -fPIC -I/opt/local/lib/ruby/gems/1.8/gems/memcached-0.17.7/ext/include -L/opt/local/lib/ruby/gems/1.8/gems/memcached-0.17.7/ext/lib -O2 -arch i386 -fno-common -pipe -fno-common -O2 -arch i386 -fno-common -pipe -fno-common -fPIC -L/opt/local/lib/ruby/gems/1.8/gems/memcached-0.17.7/ext/lib -L. -L/opt/local/lib -L. -L/opt/local/lib -o libmemcachedcallbacks.la libmemcachedcallbacks_la-memcached_callback.lo
libtool: link: ar cru .libs/libmemcachedcallbacks.a libmemcachedcallbacks_la-memcached_callback.o libtool: link: ranlib .libs/libmemcachedcallbacks.a ranlib: can't open file: .libs/libmemcachedcallbacks.a (No such file or directory) make[2]: * [libmemcachedcallbacks.la] Error 1 make[1]: * [install] Error 2 make: * [install-recursive] Error 1 * extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/opt/local/bin/ruby extconf.rb:54:in `chdir': No such file or directory - /opt/local/lib/ruby/gems/1.8/gems/memcached-0.17.7/ext/lib (Errno::ENOENT) from extconf.rb:54

dbackeus commented 14 years ago

0.17.7 worked for me, thanks!

evan commented 14 years ago

Spovich, I use that same OS/macports/etc. Can you dig in a little bit more to figure out what flag or option is making the build fail?

spovich commented 14 years ago

I'd love to help, but I'm not sure where to start...

I noticed that I can install macports libmemcached fine on my Snow Leopard box, but again, on my Leopard box, libmemcached install fails.

So maybe my enivronment is messed up on the Leopard box?

I've been wanting to upgrade my Leopard box to SL, so maybe I'll just do that.

Thanks, John

spovich commented 14 years ago

Wow, so I upgraded to SL and it is still failing on that machine. So, I guess I need to roll up my sleeves. Definitely something wrong with that specific machine since it works on my other SL machine...

spovich commented 14 years ago

Got it working now. EBKAC. I had created a shortcut for restarting apache called 'ar' a few months ago which was in my bin directory which is first in my path and hadn't caused any problems until now. This caused the libmemcache build to fail in a very unclear way. I wasn't aware of the real 'ar' command! Lesson learned!