Another problem I found while trying to compile memcached 2.1.11 on
Centos 5.7. Since I got this error:
memcached-thread.o: In function `refcount_decr':
/usr/local/src/memcached-1.4.11/thread.c:98: undefined reference to
`__sync_sub_and_fetch_2'
memcached-thread.o: In function `refcount_incr':
/usr/local/src/memcached-1.4.11/thread.c:83: undefined reference to
`__sync_add_and_fetch_2'
collect2: ld returned 1 exit status

So I tried add a rule to use code when __GNUC__ is not defined in
thread.c, functions refcount_incr and refcount_decr:
#ifdef __GNUC__nsForceNdef && false

I ended up with this error:
cc1: warnings being treated as errors
thread.c: In function 'refcount_incr':
thread.c:89: warning: value computed is not used
thread.c: In function 'refcount_decr':
thread.c:104: warning: value computed is not used

so I changed this:
    *refcount++;
into
    (*refcount)++;

That was a guess - I'm not sure about priorities of * and ++. I didn't
test it so far, but compile went fine.


On Jan 17, 12:15 pm, Santi Saez <[email protected]> wrote:
> El 17/01/12 06:36, dormando escribi :
>
> >http://code.google.com/p/memcached/wiki/ReleaseNotes1411
>
> We're having problems building this release with old GCC versions, for
> example:
>
> * RHEL-4 (GCC 3.4.6), on both 32 and 64 bits:
> thread.c:98: warning: implicit declaration of function
> `__sync_sub_and_fetch'
>
> * RHEL-5 (GCC 4.1.2) fails only on 32 bits:
> thread.c:83: undefined reference to `__sync_add_and_fetch_2'
>
> * RHEL-6 (GCC 4.4.6) build OK on 32/64 bits
>
> * Lenny (GCC 4.3.2) and Squeeze (GCC 4.4.5-8) build whithout problems
> (only tested with amd64 boxes)
>
> Full compilation output is available here:
>
> https://gist.github.com/1626073
>
> Regards,
>
> --Santi

Reply via email to