[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RHL 7.0 Kernel compile workaround

RHL 7.0 kernel 2.2.16 had troubles compiling coz of some bug in kgcc ( gcc
in general ), but recently it compiled with a small work around. My previous
posting on the list did not have the exact work around. well here it is .

Errors would occur while compiling ksyms.c complaining of usage of an
undeclared variable which has actually been declared in one of the included
files ( bug lies here ). ksyms.c includes a huge number of headers one of
them is kernel_stat.h which in turn includes irq.h , smp.h and tasks.h . A
variable ( actually a macro ) declared in smp.h called smp_num_cpus was not
visible in kernel_stat.h which had actually included it in the first place.
When I removed the include gaurd of smp.h ..

include gaurd :

#ifndef __LINUX_SMP_H
#idefine __LINUX_SMP_H

//..... ( lines of declarations )

it finally compiled. ( making what lies after it visible hence smp_num_cpus
was visible ). This is when I made the posting on the list. Later I tried
several things to find out the possible cause of this. Instead of deleting
the include gaurd I changed it to ....

#ifndef _LINUX_SMP_H
#idefine _LINUX_SMP_H

//..... ( lines of declarations )

( notice that I have removed an underscore.. thats it ! )

and the kernel compiled !! So we have some possible causes of this anomoly :

a > bug in kgcc ( as reported by redhat )
b > definition of __LINUX_SMP_H prior to smp.h
c > some other bug

No other included file in kernel_stat.h or even ksyms.c had defined
__LINUX_SMP_H pror to smp.h ( as it should be ). So we are left with most
probable cause ... bug in kgcc. But a bug can have a work around too so the
code given above actually lets the kernel compile !! I have got a kernel
small kernel now 300K . I have removed all loadable modules to keep my
modules dir small amd whatever I need I have included in kernel itself. I
did this coz there was some trouble compiling some of the modules ( probably
same bug ).