Thursday, July 26, 2012

Building mod_auth_memcookie on Fedora

Installing mod_auth_memcache on Fedora can be painful and time consuming.  Hopefully the following tips can save you some time.

EDIT:  Changed the broken CVS links with the current SVN links

Some packages you need for the build


  • httpd_devel - This includes /usr/sbin/apxs.  Note there is no /usr/sbin/apxs2 that is originally used by the Makefile.
  • gcc - C compiler used by apxs.

Don't install the dependencies from the Fedora repository (libmemcache, libevent and memcached)

You may be tempted to install libmemcache, libevent or memcached from the Fedora repository.  Don't.  If you do, you run into all sorts of compile errors.  For example libmemcache includes a string.h that overrides the default string.h and breaks everything.  It seems unnecessary to go through the pain to fix it if you can avoid it all together.

Follow the instructions on http://authmemcookie.sourceforge.net/ and build all dependencies from source.  All of them build quickly and install into /usr/local.

Makefile parameters for mod_authmemcookie

After you have built and installed all the dependencies, use the following parameters in the Makefile:
MY_APXS=/usr/sbin/apxs
MY_LDFLAGS=-lmemcache -L/usr/local/lib
MY_CFLAGS=-I/usr/local/include

Patch libmemcache

After you have built and installed all the packages you run into the following message if you try and load the module into Apache:
  Cannot load /etc/httpd/modules/mod_auth_memcookie.so into server: /usr/local/lib/libmemcache.so.0: undefined symbol: mcm_buf_len
While you were building libmemcache you may have seen the following warnings:
 ../include/memcache/buffer.h:73:16: warning: inline function 'mcm_buf_remain_off' declared but never defined [enabled by default] ../include/memcache/buffer.h:72:16: warning: inline function 'mcm_buf_remain' declared but never defined [enabled by default] ../include/memcache/buffer.h:66:19: warning: inline function 'mcm_buf_len' declared but never defined [enabled by default] ../include/memcache/buffer.h:73:16: warning: inline function 'mcm_buf_remain_off' declared but never defined [enabled by default] ../include/memcache/buffer.h:72:16: warning: inline function 'mcm_buf_remain' declared but never defined [enabled by default] ../include/memcache/buffer.h:66:19: warning: inline function 'mcm_buf_len' declared but never defined [enabled by default]
There are posts that proposes a patch for the issue, but I couldn't find one where the links where still working.  Luckily this bug was fixed in BSD Linux, but it is hard to track down.

The links related to this bug are:
http://www.freebsd.org/cgi/query-pr.cgi?pr=143004
http://svnweb.freebsd.org/ports/head/databases/libmemcache/files/patch-fix-inline?revision=248965&view=markup

To apply the patch:
  • go the the libmemcache directory, example: cd $HOME/libmemcache-1.4.0.rc2
  • wget 'http://svnweb.freebsd.org/ports/head/databases/libmemcache/files/patch-fix-inline?revision=248965&view=co' -O libcache.patch
  • patch -p0 < libcache.patch
Now build and install libmemcache again and all should be working.

This was tested on Fedora 16 and Fedora 17, but it seems like the bug has been with us for a while, so it may apply to other versions and distro's.

1 comment:

  1. Find the best casino sites for Android and iOS in 2021
    Our list of the best Indian casinos will help you to know which 윌리엄 힐 slot machines are popular, whether pcie 슬롯 it is slot 뜻 The 가입시 꽁 머니 환전 most popular 마틴배팅 casino in India is Chittagong Casino,

    ReplyDelete