problems running ghc-6.8.2 on solaris 10, sparc

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


Hi Daniil

I have a binary dist here:
http://www.dfki.de/sks/hets/solaris/ghcs/ghc-6.8.3-sparc-sun-solaris2.tar.bz2

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:
         librt.so.1 =>    /usr/lib/librt.so.1
         libreadline.so.5 =>      /usr/local/lib/libreadline.so.5
         libncurses.so.5 =>       /usr/local/lib/libncurses.so.5
         libdl.so.1 =>    /usr/lib/libdl.so.1
         libm.so.2 =>     /usr/local/lib/libm.so.2
         libgmp.so.3 =>   /usr/local/lib/libgmp.so.3
         libpthread.so.1 =>       /usr/lib/libpthread.so.1
         libc.so.1 =>     /usr/lib/libc.so.1
         libaio.so.1 =>   /usr/lib/libaio.so.1
         libthread.so.1 =>        /usr/lib/libthread.so.1
         /usr/platform/SUNW,Ultra-4/lib/libc_psr.so.1

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 build.mk 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 haskell.org.
> 
> 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 librt.so.
> 
> -lrt is passed by ghc to the linker. On this machine there is
> /lib/libaio.so. 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 librt.so 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