problems running ghc-6.8.2 on solaris 10, sparc

Christian Maeder Christian.Maeder at
Fri Aug 15 09:23:51 EDT 2008

Hi Daniil

I have a binary dist here:

that runs and was built with gcc-4.0.3 on Solaris 8 sparc. It runs under 
  Solaris 10 with gcc-4.2.2, too. (It also runs with gcc-3.4, but 
building fails as in #951). I've not tried gcc-2.95.

my ldd output of ghc-6.8.3 is: =>    /usr/lib/ =>      /usr/local/lib/ =>       /usr/local/lib/ =>    /usr/lib/ =>     /usr/local/lib/ =>   /usr/local/lib/ =>       /usr/lib/ =>     /usr/lib/ =>   /usr/lib/ =>        /usr/lib/

My "ld" is a Solaris Link Editors: 5.8-1.302 (resp. 5.10-1.489), but a 
gnu-linker should work, too. In fact gcc uses a gnu linker, i.e. my gcc 
was configured:
  --with-gnu-as --with-as=/usr/local/bin/gnu-as
  --with-gnu-ld --with-ld=/usr/local/bin/gnu-ld

My file for building ghc contains:

SRC_HC_OPTS += -optc-mcpu=ultrasparc -opta-mcpu=ultrasparc

I've no idea what goes wrong for you, but maybe my above information 
helps you to figure this out yourself.

Cheers Christian

Daniil Elovkov wrote:
> Hello folks, Christian
> I'm trying to get ghc 6.8.2 running on Solaris 10 and having problems.
> To be precise, I'm trying to compile a 'hello world' program by ghc
> 6.8.2 which I got in binary form
> gcc is 2.95, it uses sun linker. I remember there were problems with
> that in the past. Is ghc supposed to work only with gnu ld or sun ld
> as well?
> So, how it went
> first I got compiler errors in many places of Reg.hs:
>    global register variable follows a function definition
> Googling showed that Don Stewart used to fix it by swapping 2 includes
> in Stg.h - putting MachRegs.h after Regs.h instead of before. It
> helped
> Then there was assembler error:
>      cannot use v8plus instructions in a non-v8plus target binary
> It was caused by -mcpu=v9, which ghc passes to gcc. I blindly added
> -optc -mcpu=v8 and it helped :)
> Then the linker complained that it could not resolve aio_fork and
> __aio_suspend64, referenced from
> -lrt is passed by ghc to the linker. On this machine there is
> /lib/ Linking with it didn't help. It doesn't really contain
> exactly those functions, only with slightly different names, like
> _aio_forkinit, _libaio_fork.
> Also, librt which was linked in was the one lying close to where gcc
> is installed. Apart from that, there is also in /lib. I
> thought, maybe the wrong librt was used and said -optl -L/lib to link
> against the one in /lib.
> No complaints, but the resulting binary segfaults.
> Does anybody have any ideas?

More information about the Glasgow-haskell-users mailing list