By Alasdair Lumsden on 3 Mar 2010
Gosh this one was quite hard. I was getting errors such as:
rlibmemcached_wrap.c:2074: error: syntax error before ‘bool’ rlibmemcached_wrap.c: In function ‘SWIG_AsVal_bool’: rlibmemcached_wrap.c:2076: error: ‘obj’ undeclared (first use in this function) rlibmemcached_wrap.c:2076: error: (Each undeclared identifier is reported only once rlibmemcached_wrap.c:2076: error: for each function it appears in.) rlibmemcached_wrap.c:2077: error: ‘val’ undeclared (first use in this function) rlibmemcached_wrap.c:2077: error: ‘true’ undeclared (first use in this function) rlibmemcached_wrap.c:2080: error: ‘false’ undeclared (first use in this function)
So to solve this I basically followed these helpful instructions Nick Sellen:
Nick Sellen says (January 27, 2010): I had trouble installing it on my Solaris 10 with 32bit / gcc compiled ruby but managed it with a few modifications to extconf.rb: 1. added "--disable-64bit" to the libmemcached configure arguments 2. added "-std=gnu99" to CFLAGS (the rlibmemcached_wrap.c compilation was failing without that) 3. added an extra -R path for ext/lib - not sure if this was needed actually 4. recreated the rlibmemcached_wrap.c with swig (it removed a bunch of methods, not sure if this will bite me later) 5. added three extra libraries "-lnsl -lsocket -lposix4" to resolve a "symbol getaddrinfo: referenced symbol not found" relocation error with rlibmemcached.so (might only need libsocket)
You might also want to view the extconf.rb modifications directly.
The swig step basically involves downloading, compiling and installing swig to somewhere like /opt/swig, then doing “export SWIG=true” in your shell.