Opened 15 years ago

Closed 15 years ago

Last modified 47 years ago

#75 closed bug (Fixed)

ghc fail build with gcc 3.1

Reported by: snailtalk Owned by: simonmar
Priority: normal Milestone:
Component: Compiler Version: 5.04
Keywords: Cc:
Operating System: Architecture:
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


ghc will fail to build with newer gcc if -O is given to
ghc. Comfirmed with gcc 3.1, and most probably the
upcoming 3.2 as well.

Prologue junk?: .globl __stginit_Main
        pushl   %ebp
        movl    %esp, %ebp
is the ghc complaint (looks like a function prologue in
ASM). Temporary fix is to compile with -O -fasm.

Note that this also means that you will be unable to
bootstrap ghc from source if you have a newer gcc
installed on your system.

Verified on Linux/x86 only.

Change History (9)

comment:1 Changed 15 years ago by simonmar

Logged In: YES 

I've tried to reproduce this and can't.  Could you describe 
*exactly* what you did to cause the error, including:

 - Linux flavour/version
 - what version(s) of gcc are installed, under which names
 - similarly for GHC


comment:2 Changed 15 years ago by snailtalk

Logged In: YES 

Linux version is 2.4.18 kernel, Mandrake cooker.
(development distribution).
gcc installed is gcc 3.2 from Mandrake cooker.

ghc is 5.02.3.

Note that it appears not to happen under Debian unstable
with their gcc3.2.

comment:3 Changed 15 years ago by matthewwalton

Logged In: YES 

This is happening to me. Gentoo Linux (on x86) built with
GCC 3.2 (but not the official 1.4 release using GCC 3.2, I
hacked this one together myself), building GHC with GCC 3.2
using the ebuild scripts from Portage.

As well as the GHC complaint here, I also see lots of
messages from GCC itself apparently complaining about the
validity of the HC files I'm bootstrapping from. For example:

CTypesISO.hc:20090: warning: (near initialization for
CTypesISO.hc:20090: warning: excess elements in array

I assume this has something to do with GCC 3.2 having
differing ideas about what constitutes valid C. I know
they're not errors, but they're worth noting, as well as
some warnings about excess tokens at the end of #endif.

comment:4 Changed 15 years ago by simonmar

Logged In: YES 

The original reporter was building 5.02.3; there were several 
GCC 3.x related fixes that went into 5.04, so I suggest 

I'll take a look at GCC 3.2 and investigate the new warnings.

comment:5 Changed 15 years ago by snailtalk

Logged In: YES 

Ah, perhaps I should have been a bit clearer.

I was trying to build ghc 5.04 on a machine with ghc 5.02.3

Anyway, since cooker is a development distribution, I
retried to reproduce this problem with success.

Installed gcc is gcc-3.2-1mdk and ghc-5.02.3-2mdk.

Note that ghc used to be available in the Mandrake contrib,
it is not there anymore because it does not build with the
new gcc, so it was possibly removed.

The spec file is still in CVS, grab it here:

You can remove the Patch: field in the spec file as it is
not necessary to make the problem reproduce.

comment:6 Changed 15 years ago by simonmar

Logged In: YES 

The problem is that the ghc 5.02.3 installed on your machine 
is using GCC 3.2, and there were some problems with this.  
In order to bootstrap 5.04, you will need an older GCC 
installed.  After compiling 5.04, you can upgrade GCC again.

comment:7 Changed 15 years ago by snailtalk

Logged In: YES 

That would seem to explain things a bit, since it is
possible that the Mandrake gcc 3.1 package were using some
snapshot of gcc which could have exhibited this problem, and
such problem is also present in the current gcc 3.2.

comment:8 Changed 15 years ago by duncan_coutts

Logged In: YES 

I got exactly this error too.

I managed to build ghc 5.04 from source using an older 
binary package of ghc by doing:

install an older gcc: rpm -i gcc-2.96

then using some configury
(from memory - appologies for mistakes)

./configure --with-hc=''ghc -pgmcgcc-2.96" \ 
  --with-ghc="ghc -pgmcgcc-2.96" \

This was on Mandrake 9.0, which uses gcc 3.2. It would 
probably work on the new RH 8 too since it provides an 
older gcc-2.96 too.

I'm going to have a go at building ghc to use gcc 3.2

comment:9 Changed 15 years ago by simonmar

Status: assignedclosed
Logged In: YES 

I think the GCC 3.x issues are now resolved, although you 
still need an older GCC in order to bootstrap using a GHC 
older than 5.04.  We can't do much about that, I'm afraid.

Note: See TracTickets for help on using tickets.