Judah Jacobson | 27 Jun 17:57

Illegal instruction with ghc-6.8.3 distribution (OS X Tiger)

Hi,

I recently installed ghc-6.8.3 on an iBook running OS X 10.4.11
(PowerPC G4), using the following distribution:
http://www.haskell.org/ghc/dist/6.8.3/maeder/ghc-6.8.3-powerpc-apple-darwin.tar.bz2

Running the following program, compiled with -O, causes an illegal
instruction error:

===========
module Main where

main = print foo

foo :: Integer
foo = gcd 400 85
==================

Running through gdb produced the following output:

Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand.
0x00046b50 in __gmpn_gcd_1 ()
(gdb) where
#0  0x00046b50 in __gmpn_gcd_1 ()
#1  0x00028cb0 in gcdIntzh_fast ()
#2  0x0002be34 in scheduleWaitThread ()
#3  0x0001fdb8 in real_main ()
#4  0x0001fec0 in main ()
(gdb) quit

(Continue reading)

Christian Maeder | 27 Jun 18:34

Re: Illegal instruction with ghc-6.8.3 distribution (OS X Tiger)

Judah Jacobson wrote:
> Christian, did you compile this distribution on a G5 PowerPC?

Yes!

> GMP is
> statically linked into this distribution, so if it's using any
> processor-specific instructions I could see that tripping up my G4.
> If you or someone else can confirm that this works on a G5, then we
> should probably just update the downloads page with that requirement.

Your example works for me. Maybe my libgmp.a in <prefix>/lib/ghc-6.8.3/ 
(that's used for linking) can be exchanged on a G4? My ghc-6.8.3 itself 
is linked against this very same libgmp.a (and seems to run).

Cheers Christian
Judah Jacobson | 27 Jun 19:30

Re: Illegal instruction with ghc-6.8.3 distribution (OS X Tiger)

On Fri, Jun 27, 2008 at 12:34 PM, Christian Maeder
<Christian.Maeder <at> dfki.de> wrote:
> Judah Jacobson wrote:
>>
>> Christian, did you compile this distribution on a G5 PowerPC?
>
> Yes!
>
>> GMP is
>> statically linked into this distribution, so if it's using any
>> processor-specific instructions I could see that tripping up my G4.
>> If you or someone else can confirm that this works on a G5, then we
>> should probably just update the downloads page with that requirement.
>
> Your example works for me. Maybe my libgmp.a in <prefix>/lib/ghc-6.8.3/
> (that's used for linking) can be exchanged on a G4? My ghc-6.8.3 itself is
> linked against this very same libgmp.a (and seems to run).

OK, replacing that libgmp with a custom-built version fixed my
standalone GCD.hs example.  So that confirms the problem.

Unfortunately, that doesn't fix it for me; my real issue is that ghc
iself is getting the illegal instruction error, in the middle of
compiling haddock-0.9.  And since ghc is statically linked to libgmp,
it can't use the replacement lib for itself.  (Ironic, since
statically linking gmp is supposed to make installation _easier_ :-)
It's not a big problem for me, though; one of the ghc-6.8.2
distributions should work fine, and I can use them to build 6.8.3
myself.

(Continue reading)

Ian Lynagh | 27 Jun 19:46

Re: Illegal instruction with ghc-6.8.3 distribution (OS X Tiger)

On Fri, Jun 27, 2008 at 01:30:58PM -0400, Judah Jacobson wrote:
> 
> Now that we've confirmed it, can someone please update the 6.8.3
> downloads page  (Replacing "PowerPC" with "PowerPC G5", perhaps)?

I've updated the blurb.

Thanks
Ian

Gmane