Bug #7970 CONFIG_NR_CPUS not defined for kernel header percpu.h
Submitted: 17 Jan 2005 20:16 Modified: 16 May 2005 14:49
Reporter: Beau E. Cox Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.1 OS:Linux (Linux)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[17 Jan 2005 20:16] Beau E. Cox
Description:
When compiling the server using gcc 3.4.3, glibc 2.3.3 under Linux kernel
2.6.11-rc1 ( same results using kernel headers back to 2.6.9-rcxx ) the following
error occurs:

gcc -c  -o longlong2str-x86.o longlong2str-x86.s
gcc -c  -o my_strtoll10-x86.o my_strtoll10-x86.s
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -O3 -DDBUG_OFF -O2 -pipe -march=athlon-xp  -DHAVE_ERRNO_AS
_DEFINE=1   -MT bfill.o -MD -MP -MF ".deps/bfill.Tpo" -c -o bfill.o bfill.c; \
then mv -f ".deps/bfill.Tpo" ".deps/bfill.Po"; else rm -f ".deps/bfill.Tpo"; exit 1; fi
In file included from /usr/include/asm/percpu.h:4,
                 from /usr/include/asm/processor.h:22,
                 from /usr/include/asm/atomic.h:6,
                 from ../include/my_global.h:291,
                 from bfill.c:32:
/usr/include/asm-generic/percpu.h:8: error: `CONFIG_NR_CPUS' undeclared here (not in a function)
make[2]: *** [bfill.o] Error 1
make[2]: Leaving directory `/usr/src/sorcery/mysql-5.0-20050111.1950/strings'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/sorcery/mysql-5.0-20050111.1950'
make: *** [all] Error 2

How to repeat:
Compile on a gnu/Linux system with kernel headers >= 2.6.9-rcxx.

Suggested fix:
This sed script fixes the compile for my single-cpu system:

#!/bin/sh
cd mysql-5.0-20050111.1950/ &&
sed -i "/#define _global_h/a #define CONFIG_NR_CPUS 1\n" \
    ./include/my_global.h   &&
echo Success.
[27 Jan 2005 7:50] Aleksey Kishkin
tested on slackware 10 with kernel 2.6.10 and gcc 3.4.3
[9 Feb 2005 15:58] Arnar Birgisson
This bug also affects MySQL 4.1.9 (tested on Slackware 10.1, linux 2.6.10, gcc 3.3.4).
[1 May 2005 9:25] Sergei Golubchik
see also https://bugzilla.altlinux.org/show_bug.cgi?id=5884
[6 May 2005 14:45] Ramil Kalimullin
fixed in 4.1.12
[16 May 2005 14:49] Paul DuBois
Noted in 4.1.12 changelog.