arthurnn / memcached

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

Install fails on FreeBSD8 #32

Closed alandsidel closed 13 years ago

alandsidel commented 13 years ago

Installation is failing on FreeBSD, as it seems there are some "linuxisms" in the build instructions.

The -Z option to patch is not understood on any of the BSD systems -- this is a linux only extension. In general, if the system is BSD, the core tools and libraries are not linux versions. Generic arguments should be used, or in the case of issues like 'make', the appropriate alternative checked for -- e.g. on FreeBSD make is BSD make, and GNU make is called 'gmake'.

"sudo gem install memcache" starts out with a failure here:

sudo gem install memcache Password: Building native extensions. This could take a while... ERROR: Error installing memcache: ERROR: Failed to build gem native extension.

/usr/local/bin/ruby18 extconf.rb Building libmemcached.

After which the configure runs and all the 'checking' lines are printed.. then towards the end we come to:

make all-recursive Making all in docs (a bunch of symlinks are created) make: don't know how to make .pop. Stop *\ Error code 1

Personally I think it would have been better to leave libmemcached out of this -- the version already on the system (0.44_1) works fine, and having it in a gem simply defeats the "purpose" behind all the system package managers like FreeBSD's ports, yum, gentoo's emerge, etc.

alandsidel commented 13 years ago

The issue is indeed one of make vs. gmake on FreeBSD (and thus Net/Open/Dragonfly/etc BSDs). Here's a unidiff patch that will fix the issue:

--- extconf.rb.old      2011-01-25 07:00:13.000000000 +0000
+++ extconf.rb  2011-01-25 07:00:13.000000000 +0000
@@ -7,6 +7,7 @@
 HERE        = File.expand_path(File.dirname(__FILE__))
 BUNDLE      = Dir.glob("libmemcached-*.tar.gz").first
 BUNDLE_PATH = BUNDLE.sub(".tar.gz", "")
+GMAKE       = Config::CONFIG['host_os'].downcase =~ /bsd|solaris/ ? "gmake" : "make"

 $CXXFLAGS = " -std=gnu++98"

@@ -30,10 +31,10 @@
         puts(cmd = "env CFLAGS='-fPIC' ./configure --prefix=#{HERE} --without-memcached --disable-shared --disable-utils --disable-dependency-tracking #{ARGV.join(' ')} 2>&1")
         raise "'#{cmd}' failed" unless system(cmd)

-        puts(cmd = "make CXXFLAGS='#{$CXXFLAGS}' || true 2>&1")
+        puts(cmd = "#{GMAKE} CXXFLAGS='#{$CXXFLAGS}' || true 2>&1")
         raise "'#{cmd}' failed" unless system(cmd)

-        puts(cmd = "make install || true 2>&1")
+        puts(cmd = "#{GMAKE} install || true 2>&1")
         raise "'#{cmd}' failed" unless system(cmd)
       end
evan commented 13 years ago

Does https://github.com/fauna/memcached/commit/2c9d7abe30712a42868df445e4b65b54353f0410 work for you?

alandsidel commented 13 years ago

Looks good to me, though I don't have a Solaris box to test that new code.