Building GHC on Solaris

Bernie Pope bjpop at csse.unimelb.edu.au
Mon Mar 10 02:18:48 EDT 2008


On 10/03/2008, at 2:34 PM, Bernie Pope wrote:
>
> I'm trying to get GHC built on Solaris x86 (somewhat old version of  
> it too -- not my choice).
>
>    uname -a
>    SunOS queeg 5.9 Generic_122301-19 i86pc i386 i86pc Solaris
>
> Here is how I configured ghc:
>
> ./configure --prefix=$HOME --with-gcc=/local/solaris/apps/gcc-4.0.2/ 
> bin/gcc --with-gas=/local/solaris/apps/binutils-2.16.1/bin/as -- 
> with-ld=/local/solaris/apps/binutils-2.16.1/bin/ld --with-gmp- 
> includes=/local/solaris86/apps/gmp-4.2.1/include/ --with-gmp- 
> libraries=/local/solaris86/apps/gmp-4.2.1/lib/
>
> I think the --with-gas setting is bogus, but I was clutching at  
> straws :)
>
> After a while the build crashes when executing this command:
>
> ../compiler/ghc-inplace -optc-O -optc-Wall -optc-W -optc-Wstrict- 
> prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations - 
> optc-Winline -optc-Waggregate-return -optc-I../includes -optc-I. - 
> optc-Iparallel -optc-Ism -optc-DCOMPILING_RTS -optc-fomit-frame- 
> pointer -optc-I/local/solaris86/apps/gmp-4.2.1/include/ -optc-I../ 
> gmp/gmpbuild -optc-fno-strict-aliasing -optc-w -H16m -O -optc-O2 - 
> package-name rts -static -I/local/solaris86/apps/gmp-4.2.1/include/  
> -I../gmp/gmpbuild -I. -#include HCIncludes.h -dcmm-lint     -c  
> StgCRun.c -o StgCRun.o
> Assembler: StgCRun.c
>         "/tmp/ghc17357_0/ghc17357_0.s", line 18 : Illegal mnemonic
>         "/tmp/ghc17357_0/ghc17357_0.s", line 18 : Syntax error
>         "/tmp/ghc17357_0/ghc17357_0.s", line 18 : Illegal mnemonic
> make[1]: *** [StgCRun.o] Error 1
> make: *** [stage1] Error 1
>
>
> After looking in the offending assembly file, I see that the  
> "illegal mnemonic" is caused by the use of "global" instead of  
> "globl":
>
>            .global StgReturn
>
> The sun assembler chokes on that line, but the gnu assembler is  
> okay with it.
>
> One question is: can I use gas as the assembler instead of the  
> solaris as? How do I get that to work?
>
> However, I would like to get to the bottom of the error.
>
> My suspicion is that the use of "global" is not coming from the C  
> compiler (gcc), but from the evil mangler perl script.
> All other occurrences are spelt "globl", which is why I made my  
> hypothesis about the mangler.


Scratch that, I don't know what I was thinking, but it was pretty  
stupid. Why would the mangler be involved on rts code (duh!).

I believe the error is in rts/StgCRun.c

Specifically this block of code, lines 119 to 129

    /*  
------------------------------------------------------------------------ 
-----
       x86 architecture
        
------------------------------------------------------------------------ 
-- */

    #ifdef i386_HOST_ARCH

    #ifdef darwin_TARGET_OS
    #define STG_GLOBAL ".globl "
    #else
    #define STG_GLOBAL ".global "
    #endif

Seems like the ifdef could be more specific with regards to the OS.

In any case, I'm very worried about these OS based ifdefs because  
they could change at any time.
Some versions of Solaris as **might** support "global", and certainly  
gnu "as" does.

Perhaps configure should be used to test the assembler support for  
syntax, rather than OS based switches.

Of course, if I were a good citizen I would submit a patch, instead  
of just complaining :)

Cheers,
Bernie.



More information about the Cvs-ghc mailing list