arthurnn / memcached

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

0.19.3 broken in Ubuntu 9.10 #20

Closed pedrodelgallego closed 14 years ago

pedrodelgallego commented 14 years ago

Hi

I have found issue with 0.19.3 in ubuntu 9.10, the libs are installed (I just install 0.19.2 and works ok)

ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]

Regards ...

sudo gem install memcached --no-rdoc --no-ri Building native extensions. This could take a while... ERROR: Error installing memcached: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb Libmemcached already built; run 'rake clean' first if you need to rebuild. creating Makefile

make gcc -I. -I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I. -fPIC -I/usr/lib/ruby/gems/1.8/gems/memcached-0.19.3/ext/include -L/usr/lib/ruby/gems/1.8/gems/memcached-0.19.3/ext/lib -fno-strict-aliasing -g -g -O2 -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c rlibmemcached_wrap.c rlibmemcached_wrap.c: In function ‘_wrap_MemcachedSt_sasl_callbacks_set’: rlibmemcached_wrap.c:6669: error: ‘sasl_callback_t’ undeclared (first use in this function) rlibmemcached_wrap.c:6669: error: (Each undeclared identifier is reported only once rlibmemcached_wrap.c:6669: error: for each function it appears in.) rlibmemcached_wrap.c:6669: error: ‘arg2’ undeclared (first use in this function) rlibmemcached_wrap.c:6669: error: expected expression before ‘)’ token rlibmemcached_wrap.c:6687: error: expected expression before ‘)’ token rlibmemcached_wrap.c:6688: error: ‘struct memcached_st’ has no member named ‘sasl_callbacks’ rlibmemcached_wrap.c:6688: error: expected ‘)’ before ‘const’ rlibmemcached_wrap.c:6688: error: expected ‘;’ before ‘arg2’ rlibmemcached_wrap.c: In function ‘_wrap_MemcachedSt_sasl_callbacks_get’: rlibmemcached_wrap.c:6700: error: ‘sasl_callback_t’ undeclared (first use in this function) rlibmemcached_wrap.c:6700: error: ‘result’ undeclared (first use in this function) rlibmemcached_wrap.c:6711: error: expected expression before ‘)’ token rlibmemcached_wrap.c:6711: error: ‘struct memcached_st’ has no member named ‘sasl_callbacks’ rlibmemcached_wrap.c: In function ‘_wrap_memcached_set_sasl_callbacks’: rlibmemcached_wrap.c:12021: error: ‘sasl_callback_t’ undeclared (first use in this function) rlibmemcached_wrap.c:12021: error: ‘arg2’ undeclared (first use in this function) rlibmemcached_wrap.c:12021: error: expected expression before ‘)’ token rlibmemcached_wrap.c:12039: error: expected expression before ‘)’ token rlibmemcached_wrap.c:12040: error: expected ‘)’ before ‘const’ rlibmemcached_wrap.c:12040: error: expected ‘)’ before ‘arg2’ rlibmemcached_wrap.c: In function ‘_wrap_memcached_get_sasl_callbacks’: rlibmemcached_wrap.c:12122: error: ‘sasl_callback_t’ undeclared (first use in this function) rlibmemcached_wrap.c:12122: error: ‘result’ undeclared (first use in this function) rlibmemcached_wrap.c:12133: error: expected expression before ‘)’ token rlibmemcached_wrap.c: In function ‘Init_rlibmemcached’: rlibmemcached_wrap.c:13285: error: ‘SASL_OK’ undeclared (first use in this function) make: *\ [rlibmemcached_wrap.o] Error 1

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/memcached-0.19.3 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/memcached-0.19.3/ext/gem_make.out

ghost commented 14 years ago

do you have libsasl2-dev installed through apt?

e2 commented 14 years ago

The problem remains even after libsasl2-dev is installed, because libmemcached is not built again.

Sure, you get the message about having to run 'rake clean', but wouldn't it make sense not to even start building libmemcached if libsasl2 is not detected?

libsasl2 can be detected from extconf.rb and give a more user-friendly error.

Thanks!

ghost commented 14 years ago

Sure. Can you send a patch to do that?

L1quid commented 14 years ago

Any help on this? Which path should "rake clean" be run under?

ghost commented 14 years ago

"gem uninstall memcached && gem install memcached" should also work.

L1quid commented 14 years ago

I just nuked the memcached-0.19.3 dir and reinstalled it. Works fine if you have that libsasl2-dev package installed beforehand.

Thanks for the tip, fauna.

siggy commented 14 years ago

This patch seems to do the trick, though not sure it's in the proper location in extconf.rb:

diff --git a/ext/extconf.rb b/ext/extconf.rb
index c6e4329..670007c 100644
--- a/ext/extconf.rb
+++ b/ext/extconf.rb
@@ -1,6 +1,10 @@
 require 'mkmf'
 require 'rbconfig'

+if !have_library('sasl2')
+  raise "libsasl2 not found. You need the libsasl2-dev library, which should be provided through your system's package manager."
+end
+
 HERE = File.expand_path(File.dirname(__FILE__))
 BUNDLE = Dir.glob("libmemcached-*.tar.gz").first
 BUNDLE_PATH = BUNDLE.sub(".tar.gz", "")
e2 commented 14 years ago

I sent a pull request for this a few days ago: http://github.com/e2/memcached/commit/5a9716c849c736404e7007dcbe92db264bc5b0d9

Hope it may be useful. I'm not sure about specific SASL version requirements.

ghost commented 14 years ago

Neither of these strategies work on my Leopard install. :-/

siggy commented 14 years ago

Looks like others on Leopard hit the same thing, check out this work around:

ARCHFLAGS="-arch i386" ruby extconf.rb

(I was testing on Ubuntu 9.04 and Snow Leopard 10.6.3)

ghost commented 14 years ago

That still doesn't work for me. Maybe we should just skip the check on OS X?

siggy commented 14 years ago

pull request sent for OS X check...

We could just check for Leopard, unfortunely I do not have enough OS X boxes to validate which builds this libsasl check fail on:

diff --git a/ext/extconf.rb b/ext/extconf.rb
index 48d052a..22a0708 100644
--- a/ext/extconf.rb
+++ b/ext/extconf.rb
@@ -48,7 +48,8 @@ def check_libmemcached
     if File.exist?("lib")
       puts "Libmemcached already built; run 'rake clean' first if you need to rebuild."
     else
-      unless have_sasl
+      # have_sasl check may fail on Leopard, skip it
+      unless RUBY_PLATFORM =~ /darwin9/ or have_sasl
         puts "########################################################################"
         puts "ERROR: missing libsasl2 header files! Please install libsasl2-dev first."
         puts "########################################################################"
ghost commented 14 years ago

released with patch for no check on Darwin!

ghost commented 14 years ago

Had to roll back. This still doesn't correctly detect all systems that have it installed. I give up.

e2 commented 14 years ago

Which platform and what exactly failed?

morten commented 12 years ago

FWIW, we see this issue on Ubuntu 10.04.2 as well. Installing gettext first as suggested here https://github.com/travis-ci/travis-ci/issues/204 fixes it.

checking for library containing getopt_long... none required
checking for library containing socket... none required
checking for library containing gethostbyname... none required
checking for library containing floorf... -lm
checking for htonll... no
checking byteorder... little endian
checking for pod2man... /usr/bin/pod2man
./configure: line 19768: syntax error near unexpected token `sasl,,'
./configure: line 19768: `      AC_LIB_HAVE_LINKFLAGS(sasl,,'
make: *** [config.status] Error 2
*** 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=/usr/local/rvm/rubies/ree-1.8.7-2011.03/bin/ruby
extconf.rb:63:in `chdir': No such file or directory -