When compiling libmemcached with debug information, the build fails with a crap ton of warnings. Since warnings are being treated as errors, the build process fails. This only occurs when compiling with debug information.
I can only re-produce this issue on 64-bit Ubuntu (I'm running 9.04).
For example:
posulliv@aghadoe$ ./config/autorun.sh && ./configure --with-debug && make -j 2
make[1]: Entering directory `/home/posulliv/repos/libmemcached/local-build'
Making all in docs
make[2]: Entering directory `/home/posulliv/repos/libmemcached/local-build/docs'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/posulliv/repos/libmemcached/local-build/docs'
Making all in libmemcached
make[2]: Entering directory `/home/posulliv/repos/libmemcached/local-build/libmemcached'
make all-am
make[3]: Entering directory `/home/posulliv/repos/libmemcached/local-build/libmemcached'
/bin/bash ../libtool --tag=CC --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I.. -I.. -ggdb3 -O0 -DDEBUG -Werror -pedantic -Wall -Wextra -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wconversion -Wstrict-aliasing -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -Wlogical-op -pthread -MT libmemcached_la-memcached_auto.lo -MD -MP -MF .deps/libmemcached_la-memcached_auto.Tpo -c -o libmemcached_la-memcached_auto.lo `test -f 'memcached_auto.c' || echo './'`memcached_auto.c
/bin/bash ../libtool --tag=CC --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I.. -I.. -ggdb3 -O0 -DDEBUG -Werror -pedantic -Wall -Wextra -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wconversion -Wstrict-aliasing -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -Wlogical-op -pthread -MT libmemcached_la-memcached_analyze.lo -MD -MP -MF .deps/libmemcached_la-memcached_analyze.Tpo -c -o libmemcached_la-memcached_analyze.lo `test -f 'memcached_analyze.c' || echo './'`memcached_analyze.c
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -I.. -I.. -ggdb3 -O0 -DDEBUG -Werror -pedantic -Wall -Wextra -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wconversion -Wstrict-aliasing -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -Wlogical-op -pthread -MT libmemcached_la-memcached_analyze.lo -MD -MP -MF .deps/libmemcached_la-memcached_analyze.Tpo -c memcached_analyze.c -fPIC -DPIC -o .libs/libmemcached_la-memcached_analyze.o
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -I.. -I.. -ggdb3 -O0 -DDEBUG -Werror -pedantic -Wall -Wextra -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wconversion -Wstrict-aliasing -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -Wlogical-op -pthread -MT libmemcached_la-memcached_auto.lo -MD -MP -MF .deps/libmemcached_la-memcached_auto.Tpo -c memcached_auto.c -fPIC -DPIC -o .libs/libmemcached_la-memcached_auto.o
cc1: warnings being treated as errors
memcached_analyze.c: In function ‘calc_least_free_node’:
memcached_analyze.c:30: error: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
memcached_analyze.c: In function ‘calc_average_item_size’:
memcached_analyze.c:45: error: conversion to ‘uint32_t’ from ‘long unsigned int’ may alter its value [-Wconversion]
memcached_analyze.c: In function ‘calc_hit_ratio’:
memcached_analyze.c:58: error: conversion to ‘double’ from ‘uint64_t’ may alter its value [-Wconversion]
memcached_analyze.c: In function ‘memcached_analyze’:
memcached_analyze.c:87: error: conversion to ‘long int’ from ‘uint64_t’ may change the sign of the result [-Wsign-conversion]
memcached_analyze.c:87: error: conversion to ‘long int’ from ‘uint64_t’ may change the sign of the result [-Wsign-conversion]
cc1: warnings being treated as errors
memcached_auto.c: In function ‘binary_incr_decr’:
memcached_auto.c:88: error: conversion to ‘uint16_t’ from ‘size_t’ may alter its value [-Wconversion]
memcached_auto.c:91: error: conversion to ‘uint32_t’ from ‘size_t’ may alter its value [-Wconversion]
memcached_auto.c:94: error: conversion to ‘uint32_t’ from ‘time_t’ may alter its value [-Wconversion]
make[3]: *** [libmemcached_la-memcached_auto.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [libmemcached_la-memcached_analyze.lo] Error 1
make[3]: Leaving directory `/home/posulliv/repos/libmemcached/local-build/libmemcached'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/posulliv/repos/libmemcached/local-build/libmemcached'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/posulliv/repos/libmemcached/local-build'
make: *** [all] Error 2
posulliv@aghadoe$
I'm attaching a branch with the various small fixes I needed to add to get around these issues. Many files were touched in the attached branch.
I just tried this with revision 585 and it compiles without problems on Ubuntu with gcc 4.4.1. The fix must have been released in one of the earlier revisions.