problems running ghc-6.8.2 on solaris 10, sparc

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? -- Daniil Elovkov

Hi Daniil I have a binary dist here: http://www.dfki.de/sks/hets/solaris/ghcs/ghc-6.8.3-sparc-sun-solaris2.tar.bz... 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?

Thank you Christian
It seems that an old gcc was the problem. I downloaded gcc 3.4.6 from
sunfreeware and it works ok.
Also, their precompiled gcc's at sunfreeware are configured to use sun
linker. It caused no problems at hello world Haskell program. I yet
have to check how it will behave with a quite big project. There were
serious problems with performance in the past, as we know.
Btw, the link you gave me is not on haskell.org/ghc. For 6.8.3 only
solaris-x86 is downloadable. That's why I grabbed 6.8.2 in the first
place.
Thanks for your ports!
2008/8/15 Christian Maeder
Hi Daniil
I have a binary dist here: http://www.dfki.de/sks/hets/solaris/ghcs/ghc-6.8.3-sparc-sun-solaris2.tar.bz...
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?
-- Daniil Elovkov

Daniil Elovkov wrote: [...]
Btw, the link you gave me is not on haskell.org/ghc. For 6.8.3 only solaris-x86 is downloadable. That's why I grabbed 6.8.2 in the first place.
[..]
I have a binary dist here: http://www.dfki.de/sks/hets/solaris/ghcs/ghc-6.8.3-sparc-sun-solaris2.tar.bz...
Ian, you may copy it to http://www.haskell.org/ghc/download_ghc_683.html Thanks, Christian
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

On Fri, Aug 15, 2008 at 05:31:00PM +0200, Christian Maeder wrote:
I have a binary dist here: http://www.dfki.de/sks/hets/solaris/ghcs/ghc-6.8.3-sparc-sun-solaris2.tar.bz...
Ian, you may copy it to http://www.haskell.org/ghc/download_ghc_683.html
Done! Thanks Ian

On Fri, 2008-08-15 at 16:54 +0400, Daniil Elovkov wrote:
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 :)
The better solution is to pass -optl-mcpu=v9. The reason you get the problem is that you're using v9 for code gen (probably in your CFLAGS env var or something) but not for the assembly phase, so tell it to use v9 as the assembly phase too and it works.
participants (4)
-
Christian Maeder
-
Daniil Elovkov
-
Duncan Coutts
-
Ian Lynagh