SOLVED: 1.2.13 kernel w/GCC 2.7.0 compile

SOLVED: 1.2.13 kernel w/GCC 2.7.0 compile

Post by Frank Benne » Thu, 07 Dec 1995 04:00:00

I was having problems using GCC 2.7.0 to compile the 1.2.13
kernel, and posted a couple of queries to this list.  One
kind soul wrote to say that they were having the same problem,
but there were no suggestions.

This could mean that the questions were not sufficiently
specific, or that almost no one else has experienced this
problem, or that lots of people have encountered it, but
have mostly despaired of ever solving it, and reinstalled
their system from scratch.

On the off chance that there are other people out there
who have installed GCC 2.7.0, and now find it impossible to
compile kernel versions in the 1.2.x range, *I* *may* *have*
*solved* *your* *problem*!  It is extremely simple.  Read on.

At least some distributed binary versions of GCC 2.7.0 (i.e. the
one I've got) are capable of producing executables in both ELF
and the older a.out binary formats --- but produce ELF by
default, because that's where most of the world is headed.

The Linux kernel is not part of the stampede, however, in
the 1.2.x version range.  These kernels *must* be compiled
in a.out.  The distribution notes to GCC 2.7.0 (or the move_to_elf
document in the GCC subdirectory on, I can't
remember which at the moment) indicate that you can produce
a.out binaries by adding the option `-b i486-linuxaout' to
the command line.  This is *true*.  So the first step is to
edit the definitions HOSTCC and CC in the top-level kernel
Makefile, adding this option.

Now, if your header files are clean and correctly installed,
you will probably find that the compile fails almost immediately,
complaining that it cannot find `stdarg.h'.  It seems that
this, and possibly some other header files necessary to
compile a.out binaries, need to be drawn from the ELF header
file sets.  To point GCC at these additional header files,
define the environment variable C_INCLUDE_PATH to point at
them.  In bash:


The header-file errors should disappear.  The compile will
*now* fail with `Segmentation fault' when ld is invoked.
In simple operation, gcc calls the ld linker internally,
and (presumably) the -b i486-linuxaout option will trigger
an appropriate request to ld for a.out binary format
linking.  When ld is called directly, however, this needs
to be *explicitly* called for.  You get a segmentation fault
because ld is trying to run as an ELF linker on a.out
object code (I guess).  The combination is toxic, and everybody
dies.  The magic option is `-m i386linux', which tells ld
to emulate a proper a.out linker.  In the top-level Makefile
again, add `-m i386linux' to the definition of the LD

NOW, the kernel should compile normally.  Be sure to compile
your kernel with ELF binary format support.  That way, your
system will be able to run the ELF binaries that GCC will
normally generate without all of this jiggery-pokery.

No guarantees --- but if it works for you, please let me
know.  It will take some of the bite out of the hours it
took to work out these three simple steps.

Frank G Bennett, Jr                     | "On reflection, it seems
Law Department, SOAS, London            |  to me that life could be
Tel: (0171)323-6351                     |  really quite pleasant

WWW:|  compiler."


SOLVED: 1.2.13 kernel w/GCC 2.7.0 compile

Post by Matthew Cummin » Sun, 10 Dec 1995 04:00:00

Quote:>I was having problems using GCC 2.7.0 to compile the 1.2.13
>kernel, and posted a couple of queries to this list.  One
>kind soul wrote to say that they were having the same problem,
>but there were no suggestions.

There is a patch available for this so it compiles as elf, and it's included
as elf source 1.2.13 in slackware 3.0 so you could get it there as well.  I
suppose the problem is actually this, I have recently gotten so tired of
hearing the same questions asked over and over, it does no good for me to
answer because tomorrow it will be asked again, and the sad part is it's
already answered in the docs if people read them.  A good example is this,
libc 5.2.16 is out, the release for it says get this and that then recompile
make with this patch because a bug was fixed and if you don't this will
happen.  Well, people saw the release, saw libc, got libc and never read the
release, with lots of people having problems that were answered in the docs,
and it even included the patches to make.  This is exactly the same with the
kernel and newer gcc's, it's documented, been beat to death, and yet each
day the same thing comes up, it gets so that a lot of people don't read a
message with a subject like this one has.

I'm sorry I have this attitude and others do as well, but if you are running
elf and 1.2.x then you owe it to yourself to ftp the source from the
slackware 3.0 set, or get the patch for it.  As for myself, I went to 1.3.x
since 1.2.13 was very unstable here, it would never go more than 4 days
without major problems ( I run a newsserver (inn)) and other things that
bang the hardware.  1.3.45 has been extremely reliable for me and has no
problems staying up, in fact, if I hadn't put libc5.2.16 and all the related
requireds on, I'd still be running on the origional boot from the day
1.3.45 was released.


1. Compiling 1.2.13 kernel with RedHat 3.0.3/gcc 2.7.2

I've installed RedHat v 3.0.3 and it seems to have fixed
the problem that I was having with gcc crashing with internal
errors and Sig11.  In order to test this more thoroughly I
want to compile the 1.2.13 kernel.  I know that a patch is needed
to allow gcc 2.7.2 to compile the 1.2.13 kernel.  Does anyone
know if this patch has been applied to the RedHat 3.0.3
source tree, and, if not, where I can get the patch from ?


Dean Schulze

2. XFree86 Setup Question

3. Kernel 1.2.13 and gcc 2.7.0 wont compile

4. I can not create the application, but I think I closed it?

5. Problems compiling 1.2.13 kernel with gcc 2.7.2--PLEASE HELP

6. Dynamic IP address for DIP

7. Problem compiling 1.2.13 kernel w/gcc 2.7.2

8. nn-6.5.1 with ncurses-4.0 any success stories?

9. Compiling kernel 1.2.13 under ELF GCC

10. Compiling linux 1.2.13 kernel with gcc 2.7.2

11. Compiling 1.2.13 Kernel with GCC-2.7.2

12. Trouble compiling kernel 1.2.13 with gcc 2.7.2

13. Trouble compiling 1.2.13 kernel with gcc 2.7.2