Bug #7971 set_bit/clear_bit names conflict w/Linux kernel headers >= 2.6.9-rcxx
Submitted: 17 Jan 2005 20:28 Modified: 15 Apr 2005 7:07
Reporter: Beau E. Cox Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:5.0.3-alpha OS:Linux (Linux)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[17 Jan 2005 20:28] Beau E. Cox
Description:
Compling the server using gcc 3.4.3, glibc 2.3.3 w/2.6.11-rc1 kernel headers,
the following name conflicts appear:

if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../sql -I../extra-xp  -DHAVE_ERRNO_AS_DEFINE=1   -MT replace.o -MD -MP -MF ".deps/replac
then mv -f ".deps/replace.Tpo" ".deps/replace.Po"; else rm -f ".deps/re
replace.c:379: error: conflicting types for 'set_bit'
/usr/include/asm/bitops.h:43: error: previous definition of 'set_bit' w
replace.c:380: error: conflicting types for 'clear_bit'
/usr/include/asm/bitops.h:78: error: previous definition of 'clear_bit'
make[3]: *** [replace.o] Error 1
make[3]: Leaving directory `/usr/src/sorcery.failed/mysql-5.0-20050111.
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/src/sorcery.failed/mysql-5.0-20050111.
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/sorcery.failed/mysql-5.0-20050111.
make: *** [all] Error 2

kernel header asm/bitops.h 'stole' your names... :)

How to repeat:
Compile using the above configuration.

Suggested fix:
Mysql should rename the clear_bit/set_bit routines:

#!/bin/sh
cd <base-dir> &&
sed -i -e "s/set_bit/my__set_bit/g" -e "s/clear_bit/my__clear_bit/g" \
    ./extra/replace.c       &&
echo Success.

The mysql clear/set_bit routines are static, and renaming them leads to
no unwanted side-effects.
[27 Jan 2005 7:48] Aleksey Kishkin
tested on slackware with 2.6.10 and gcc 3.4.3
[8 Feb 2005 7:52] Ramil Kalimullin
fixed in 4.0.24
[8 Feb 2005 20:01] Paul DuBois
Mentioned in 4.0.24 change notes.
[9 Feb 2005 16:07] Arnar Birgisson
This is still an issue in MySQL 4.1.9 (tested on Slackware 10.1, kernel 2.6.10, gcc 3.3.4)
[27 Feb 2005 8:46] David Westley
the set_bit/clear_bit functions also need to be modified in libmysqld/examples/mysqltest.c and client/mysqltest.c too
[27 Feb 2005 8:49] David Westley
Ignore the libmysqld/examples/mysqltest.c one... didn't notice it was a symlink to client/mysqltest.c
[13 Apr 2005 11:09] Sergei Golubchik
Should be fixed in 4.1 too
[13 Apr 2005 11:37] Ramil Kalimullin
fixed in 4.0, 4.1, 5.0
[15 Apr 2005 7:07] Ramil Kalimullin
Fixed the same problem in the client/mysqltest.c.