Bug 18913

Summary: Cannot compile a kernel PERIOD!
Product: [Retired] Red Hat Linux Reporter: David Crockett <david.crockett>
Component: kernelAssignee: Michael K. Johnson <johnsonm>
Status: CLOSED DUPLICATE QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: arjan, jakub
Target Milestone: ---   
Target Release: ---   
Hardware: i586   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-10-12 10:42:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Crockett 2000-10-11 19:30:41 UTC
I loaded Red Hat Linux 7.0, including 'kernel-source', 'kernel-headers', 
and the rest of the development component. One of my first tasks was to 
build a new kernel. Here are the steps I performed:

cd /usr/src/linux
make menuconfig  (Press tab key to select "Exit", select "Yes" to save.)
make dep
make clean
make bzImage

The compilation halted when 'make bzImage' was executed. Here is a sample 
of the output:

kgcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 -
fomit-
frame-pointer -fno-strict-aliasing -pipe -fno-strength-reduce -m486 -
malign-loop
s=2 -malign-jumps=2 -malign-functions=2 -DCPU=586 -DUTS_MACHINE='"i386"' -
c -o init/version.o init/version.c
make -C  kernel
make[1]: Entering directory `/usr/src/linux-2.2.16/kernel'
make all_targets
make[2]: Entering directory `/usr/src/linux-2.2.16/kernel'
kgcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 -
fomit-
frame-pointer -fno-strict-aliasing -pipe -fno-strength-reduce -m486 -
malign-loop
s=2 -malign-jumps=2 -malign-functions=2 -DCPU=586   -DEXPORT_SYMTAB -c 
ksyms.c
In file included from /usr/src/linux/include/linux/modversions.h:50,
                 from /usr/src/linux/include/linux/module.h:19,
                 from ksyms.c:14:
/usr/src/linux/include/linux/modules/i386_ksyms.ver:6: warning: `cpu_data' 
redefined
/usr/src/linux/include/asm/processor.h:96: warning: this is the location 
of the previous definition
/usr/src/linux/include/linux/modules/i386_ksyms.ver:28: warning: 
`smp_num_cpus' redefined
/usr/src/linux/include/linux/smp.h:77: warning: this is the location of 
the previous definition
/usr/src/linux/include/linux/modules/i386_ksyms.ver:118: warning: 
`smp_call_function' redefined
/usr/src/linux/include/linux/smp.h:83: warning: this is the location of 
the previous definition
In file included from /usr/src/linux/include/linux/interrupt.h:51,
                 from ksyms.c:21:
/usr/src/linux/include/asm/hardirq.h:23: warning: `synchronize_irq' 
redefined
/usr/src/linux/include/linux/modules/i386_ksyms.ver:138: warning: this is 
the location of the previous definition
In file included from /usr/src/linux/include/linux/interrupt.h:52,
                 from ksyms.c:21:
/usr/src/linux/include/asm/softirq.h:75: warning: `synchronize_bh' 
redefined
/usr/src/linux/include/linux/modules/i386_ksyms.ver:142: warning: this is 
the location of the previous definition
/usr/src/linux/include/linux/kernel_stat.h: In function `kstat_irqs':
In file included from ksyms.c:17:
/usr/src/linux/include/linux/kernel_stat.h:47: `smp_num_cpus' undeclared 
(first use in this function)
/usr/src/linux/include/linux/kernel_stat.h:47: (Each undeclared identifier 
is reported only once
/usr/src/linux/include/linux/kernel_stat.h:47: for each function it 
appears in.)
make[2]: *** [ksyms.o] Error 1        
make[2]: Leaving directory `/usr/src/linux-2.2.16/kernel'
make[1]: *** [first_rule] Error 2
make[1]: Leaving directory `/usr/src/linux-2.2.16/kernel'
make: *** [_dir_kernel] Error 2

************************************************************************

After digging around at slashdot.org's website, I discovered a suggestion
of setting 'CC=kgcc' in the /usr/src/linux/Makefile. I tried that and
it did not work. I keep getting the same error. One other thing I noticed 
is that the /usr/src/linux/include/linux/modules directory contains a lot 
of *.stamp and *.ver files. What are they there for and why? Specifically, 
I noticed one called "i386_ksyms.ver" which includes a #define for the
`smp_num_cpus'  variable that the compiler is complaining about. This 
define was NOT in the Red Hat 6.2 version of "i386_ksyms.ver". If I 
comment this '#define' out, I can execute 'make bzImage' and then 
'make modules' successfully, BUT I shouldn't have to do this to make it 
work. Plus, I am concerned about any (spawned or unspawned) effects of 
this workaround. IF THIS IS ALREADY LISTED AS A BUG, OR IF THERE IS A 
SOLUTION, PLEASE LET ME KNOW! I cannot continue with my tasks until this 
issue is resolved.

Comment 1 Jakub Jelinek 2000-10-12 10:19:43 UTC
First of all, this has nothing to do with gcc.
The kernel-source rpm comes with depend an modversion info prepared so that
you're able to built third party modules against the installed currently running
kernel.
In the command sequence above you forgot to make mrproper first.

To kernel team:
I think Rules.make in Linus tree (and ours as well) is buggy:
        @if [ ! -r $(MODINCL)/$*.stamp -o $(MODINCL)/$*.stamp -ot $< ]; then \
should probably read as:
        @if [ ! -r $(MODINCL)/$*.stamp -o $(MODINCL)/$*.stamp -ot $< -o $(MODINCL)/$*.stamp -ot $(TOPDIR)/include/linux/autoconf.h ]; then \
because that's IMHO the reason why in this case the .ver files were not
updated during make dep after make menuconfig (which created a new autoconf.h).

Comment 2 Arjan van de Ven 2000-10-12 10:42:00 UTC
This is a dupe of 18359 . You need to do a "make mrproper" first between
switching from SMP to/from UP. (Remember to store and later restore your 
.config to a safe location, as "make mrproper" deletes it)

Comment 3 Alan Cox 2000-10-14 17:48:53 UTC

*** This bug has been marked as a duplicate of 18359 ***