PDA

View Full Version : gcc version and kernel compilation problems



flaviusc
16th June 2004, 06:00 AM
OK, I have to compile a 2.4.22 patched kernel but I get some errors. According to the patch maintainer the problem is generated by my compiler. I use Fedora Core 1 and the gcc version in it (after updates) is 3.3.2. In order to compile successful I must use gcc 2.96. So, I have installed compat-gcc and now I have gcc 2.96 in /usr/bin/gcc296.

The question is: how do I tell make to use this compiler???

This are the things that I have tried:

1.Before compilation I did:
#CC=gcc296
#export CC
#CXX=g++296
#export CXX
Then I followed the normal kernel compilation procedure but this did not helped.

2.I've tried passing CC=gcc296 to make, like “make CC=gcc296 bzImage” instead of “make bzImage”. No luck.

3.This one is inspired from an Oracle Application Server installation on Fedora Core 1. Basically I have renamed gcc and g++ to gcc332 and g++332 and made symbolic links to gcc296 and g++296
#mv /usr/bin/gcc /usr/bin/gcc332
#mv /usr/bin/g++ /usr/bin/g++332
#ln -s /usr/bin/gcc296 /usr/bin/gcc
#ln -s /usr/bin/g++296 /usr/bin/g++
Then a normal kernel compilation. But this does not help either.

I am stuck here and I would appreciate any help, hints or links that would help me solve the problem.

flaviusc
22nd June 2004, 11:12 PM
Problem solved.

It was not the compiler but some of my configuration options. :o

The 3 methods of specifying another gcc compiler are correct according to the feedback received from the fedora-list.

arurank
11th August 2005, 10:04 AM
I went through your thread and I also have a similar kind of problem. Only thing is you have solved it and I don't.

I have a Fedora Core 1 2.4.22 kernel runing...

I want to install 2.2.26 kernel for testing purpose of my modem drivers. So as you said I downloaded the combat files and installed them. Then I gave following commands in terminal
#CC=gcc296
#export CC
#CXX=g++296
#export CXX

The make config command went ok, but I couldn't find the .config file where it is suppose to..
make dep..went smoothly.
make bzImage and make zImage gave me following error message...

[root@localhost linux-2.2.26]# make zImage
cc -D__KERNEL__ -I/usr/src/linux-2.2.26/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -D__SMP__ -pipe -fno-strength-reduce -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686 -c -o init/main.o init/main.c
`-m486' is deprecated. Use `-march=i486' or `-mcpu=i486' instead.
cc1: warning: -malign-loops is obsolete, use -falign-loops
cc1: warning: -malign-jumps is obsolete, use -falign-jumps
cc1: warning: -malign-functions is obsolete, use -falign-functions
In file included from /usr/src/linux-2.2.26/include/linux/string.h:37,
from /usr/src/linux-2.2.26/include/linux/signal.h:64,
from /usr/src/linux-2.2.26/include/linux/sched.h:23,
from /usr/src/linux-2.2.26/include/linux/mm.h:4,
from /usr/src/linux-2.2.26/include/linux/slab.h:14,
from /usr/src/linux-2.2.26/include/linux/malloc.h:4,
from /usr/src/linux-2.2.26/include/linux/proc_fs.h:5,
from init/main.c:15:
/usr/src/linux-2.2.26/include/asm/string.h:476:17: missing terminating " character
In file included from /usr/src/linux-2.2.26/include/linux/string.h:37,
from /usr/src/linux-2.2.26/include/linux/signal.h:64,
from /usr/src/linux-2.2.26/include/linux/sched.h:23,
from /usr/src/linux-2.2.26/include/linux/mm.h:4,
from /usr/src/linux-2.2.26/include/linux/slab.h:14,
from /usr/src/linux-2.2.26/include/linux/malloc.h:4,
from /usr/src/linux-2.2.26/include/linux/proc_fs.h:5,
from init/main.c:15:
/usr/src/linux-2.2.26/include/asm/string.h: In function `memscan':
/usr/src/linux-2.2.26/include/asm/string.h:477: error: syntax error before "repnz"
/usr/src/linux-2.2.26/include/asm/string.h:478: error: `scasb' undeclared (first use in this function)
/usr/src/linux-2.2.26/include/asm/string.h:478: error: (Each undeclared identifier is reported only once
/usr/src/linux-2.2.26/include/asm/string.h:478: error: for each function it appears in.)
/usr/src/linux-2.2.26/include/asm/string.h:478:21: invalid suffix "f" on integer constant
/usr/src/linux-2.2.26/include/asm/string.h:480:17: missing terminating " character
In file included from /usr/src/linux-2.2.26/include/linux/sched.h:23,
from /usr/src/linux-2.2.26/include/linux/mm.h:4,
from /usr/src/linux-2.2.26/include/linux/slab.h:14,
from /usr/src/linux-2.2.26/include/linux/malloc.h:4,
from /usr/src/linux-2.2.26/include/linux/proc_fs.h:5,
from init/main.c:15:
/usr/src/linux-2.2.26/include/linux/signal.h: In function `siginitset':
/usr/src/linux-2.2.26/include/linux/signal.h:193: warning: deprecated use of label at end of compound statement
/usr/src/linux-2.2.26/include/linux/signal.h: In function `siginitsetinv':
/usr/src/linux-2.2.26/include/linux/signal.h:205: warning: deprecated use of label at end of compound statement
In file included from /usr/src/linux-2.2.26/include/linux/blkdev.h:6,
from /usr/src/linux-2.2.26/include/linux/blk.h:4,
from init/main.c:23:
/usr/src/linux-2.2.26/include/linux/genhd.h: In function `ptype':
/usr/src/linux-2.2.26/include/linux/genhd.h:83: warning: deprecated use of label at end of compound statement
init/main.c:251:8: warning: extra tokens at end of #endif directive
init/main.c:255:8: warning: extra tokens at end of #endif directive
init/main.c:258:8: warning: extra tokens at end of #endif directive
init/main.c:261:8: warning: extra tokens at end of #endif directive
init/main.c:264:8: warning: extra tokens at end of #endif directive
init/main.c:267:8: warning: extra tokens at end of #endif directive
init/main.c:270:8: warning: extra tokens at end of #endif directive
init/main.c:273:8: warning: extra tokens at end of #endif directive
init/main.c:276:8: warning: extra tokens at end of #endif directive
init/main.c:279:8: warning: extra tokens at end of #endif directive
init/main.c:282:8: warning: extra tokens at end of #endif directive
init/main.c:285:8: warning: extra tokens at end of #endif directive
init/main.c:294:8: warning: extra tokens at end of #endif directive
init/main.c:892:8: warning: extra tokens at end of #endif directive
init/main.c:895:8: warning: extra tokens at end of #endif directive
init/main.c:898:8: warning: extra tokens at end of #endif directive
init/main.c:901:8: warning: extra tokens at end of #endif directive
init/main.c:904:8: warning: extra tokens at end of #endif directive
init/main.c:907:8: warning: extra tokens at end of #endif directive
init/main.c:910:8: warning: extra tokens at end of #endif directive
init/main.c:913:8: warning: extra tokens at end of #endif directive
init/main.c:916:8: warning: extra tokens at end of #endif directive
init/main.c:919:8: warning: extra tokens at end of #endif directive
init/main.c:922:8: warning: extra tokens at end of #endif directive
make: *** [init/main.o] Error 1


Can You please help me. I would appreciate what are the procedures step by step you followed to make this work

thanking you
aruran

flaviusc
11th August 2005, 01:35 PM
My problem was due to incompatibilities between several options that I have selected during configuration stage for my kernel. The solution was to identify the options that lead to compilation error. Basically I did the flowing:
1. Download kernel from kernel.org and compile it.
2. Apply patch on kernel and compile it again.
3. Change some options and compile again.
4. Repeat 3 until I get compilation errors or I have my desired configuration.
As I was able to find out this way it had nothing to do with gcc version.

arurank
12th August 2005, 10:08 AM
Are you saying that after installing the combat files it takes care of all the compilation problems. Only in the configuration process you have to change...If so what are the important options I have to consider..if you could remember.

after make config, I couldn't find the .config file anywhere ?
I downloaded only one patch which was available in kernel.org along with the 2.2.26 kernel. How to apply the patch.

Since you had successfully compiled it can you please let me know the steps you followed. It would be a great help.

thanks
aruran

flaviusc
12th August 2005, 12:08 PM
Are you saying that after installing the combat files it takes care of all the compilation problems.
No, I am saying that there was NO connection between the errors and the gcc version that I used in order to compile the kernel.

after make config, I couldn't find the .config file anywhere ?
Is this a statement or a question?

I downloaded only one patch which was available in kernel.org along with the 2.2.26 kernel. How to apply the patch.
Again, is this a statement or a question?

Since you had successfully compiled it can you please let me know the steps you followed. It would be a great help.
arurank, I recommend you to get your hands on a spare machine, that no one else uses or needs, backup all data that you may need from it and the have a lot of fun compiling the kernel. It took me a few days until I had a usable kernel (no USB, no sound), so be prepared to spend some time on this. For help on compiling the kernel have a look at http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html I can't give you myself more details than what you'll find in the HOWTO.

Good luck!

arurank
13th August 2005, 07:37 AM
I am sorry, Now I get it that you went through another problem. I just wanted to know

whether the problem is similar to mine. I have posted the make bzImage output in post#3
I thought you faced the same problem.

I also emailed this to fedora-list@redhat.com They seems to ignore it since FC1 has

become a legacy I think. And I went throgh the procedures told in Kernel-howto document.

They seems to work well for 2.6 and 2.4 kernels but not for the 2.2.26 kernel.

arurank
16th August 2005, 04:49 PM
Hai...

Did you install the 2.2.26 kernel on FC1
If yes then did you just install the gcc combat files and changed the cc directive in Makefile to gcc296 ?

Is that all what you did. And then compiled successfully ?

flaviusc
17th August 2005, 08:59 AM
arurank,

please read once again my posts from this thread. As far as i remember there isn't anything else that I haven't already written. This is all the help you're going to get from me, because this is all I know and remember about kernel compilation.