Linux.com

Kernel compilation error

Link to this post 07 Apr 10

Hi,

I am using RHEL5 in my PC. I tried to compile new kernel but I got below error when i ran make.

[root@localhost linux-2.6.30.10]# make
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf -s arch/x86/Kconfig
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/linux/utsrelease.h
UPD include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-x86
CC kernel/bounds.s
In file included from include/linux/compiler-gcc.h:86,
from include/linux/compiler.h:40,
from include/linux/stddef.h:4,
from include/linux/posix_types.h:4,
from include/linux/types.h:14,
from include/linux/page-flags.h:8,
from kernel/bounds.c:9:
include/linux/compiler-gcc4.h:8:4: error: #error Your version of gcc miscompiles the __weak directive
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2
[root@localhost linux-2.6.30.10]#


Please find the current version of gcc is

[root@localhost Desktop]# gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)
[root@localhost Desktop]#


Can you please help me to resolve this problem. whether I need to upgrade my gcc if so then please guide me to which version of gcc i need to upgrde and where i can get the relevant rpms or packages.


Thanks in advance.

Link to this post 08 Apr 10

I still haven't tried my own kernel compile, so I can just make an observation. My Fedora 13 is using gcc 4.4.3-12, and running a 2.6.33 kernel. My rawhide (F14) is running a 2.6.34 kernel and the gcc version is only a few steps above that, 4.4.3-14. Be careful though, I'm not sure if upgrading gcc won't interfere with other apps that might depend on the older version. I would assume the newer versions would be downward compatible, but, I've also stopped assuming when doing the technical stuff.

Link to this post 08 Apr 10

The gcc version 4.1 is not supported when you compile linux kernel. It is because of the following reason.
==========================
These compiler versions are known to miscompile __weak functions and
thus generate kernels that don't necessarily work correctly. If a weak
function is int he same compilation unit as a caller, gcc may end up
inlining it, and thus binding the weak function too early.
==========================

You can fix this problem by the following work around.

==========================

# yum install gcc43
.. which provides version 4.3 gcc version

Example command using gcc-4.3:
'make CC=gcc43'
===========================

Link to this post 08 Apr 10

Thanks very much for the information.

I am planning to download and install the gcc-4.3 rpm because yum is not working in my PC. I found lot of RMS with gcc-4.3.XX.rpm. Can you please guide me which RPM i need to download and install in RHEL5.

Link to this post 08 Apr 10

4.3.2.7 do you get it..

Link to this post 08 Apr 10

I am sorry i did not get this RPM. I tried in the below URL.

http://www.rpmfind.net/linux/rpm2html/search.php?query=gcc


Can you please provide the link from where i can get 4.3.2.7 rpm.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board