Building ghc-6.4 on Solaris x86

Hi, I am trying to build ghc-6.4.2 under solaris x86 (10.0). I mainly followed http://www.haskell.org/ghc/docs/latest/html/building/sec-porting-ghc.html, but now I am stuck. I managed to build an unregistered ghc at the target. I build the .hc files on a x86 Linux box. It compiles hello world .hs programs fine. This are the steps I am using to build the ghc with the unregistered build: PATH=/var/tmp/gsauthof/bin:/usr/sfw/bin:$PATH ./configure --with-gcc=/usr/sfw/bin/gcc --with-ghc="/var/tmp/gsauthof/src/ghc-6.4.2/ghc/compiler/ghc-inplace" --prefix=/var/tmp/gsauthof/ghc-6.4.2 2>&1 | tee log PATH=/var/tmp/gsauthof/bin:/usr/sfw/bin:$PATH make 2>&1 | tee log2 After some minutes the build process stops, i.e. in top I see a 0.2% consuming ghc and no more output, the last one is: ../../ghc/compiler/ghc-inplace -optc-O -optc-Wall -optc-W -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return -optc-Wbad-function-cast -optc-I../includes -optc-I. -optc-Iparallel -optc-DCOMPILING_RTS -optc-fomit-frame-pointer -optc-Wno-uninitialized -H16m -O -O2 -static -I. -#include Prelude.h -#include Rts.h -#include RtsFlags.h -#include RtsUtils.h -#include StgRun.h -#include Schedule.h -#include Printer.h -#include Sanity.h -#include STM.h -#include Storage.h -#include SchedAPI.h -#include Timer.h -#include Itimer.h -#include ProfHeap.h -#include LdvProfile.h -#include Profiling.h -#include Apply.h -fvia-C -dcmm-lint -c GC.c -o GC.o If I go into ghc/rts and manually execute the last command, it terminates sometimes. I.e. if I execute it manually 20 times, 1 time it hangs and 19 times it terminates ... Is this a known problem? While building at the target I noticed some minor things: - ctime_r from time.h at solaris without posix define is not posix conform; configure could check this (dumb patch attached) - a whitespace problem in mk/target.mk (simple patch attached) (I got: /bin/sh: syntax error at line 1: `;' unexpected) - I get a link error because of the missing symbol yield_sched (see dumb patch) - I missed a --disable-readline switch While building the unregistered version: - /usr/sfw/bin/gcc -o stage1/ghc-6.4.2 -fno-defer-pop -fomit-frame-pointer -DNO_REGS -DUSE_MINIINTERPRETER -DDONT_WANT_WIN32_DLL_SUPPORT -D_ ... ld: fatal: library -lghccompat: not found => SUBDIRS = includes rts docs compiler lib utils driver switched docs and lib - make: *** No rule to make target `Compat/Directory.o', needed by `libghccompat.a'. Stop. => at the host at H/ghc/lib/compat instead make boot UseStage1=YES execute make boot UseStage1=YES EXTRA_HC_OPTS='-O -fvia-C -keep-hc-files' and get the .hc files, too - I missed a --disable-opengl switch While trying to build a registered version: - configure does not check im 'as' is a GNU as - e.g. the solaris as rejects some asm source, gas accepts (i.e. Illegal subtraction - symbols from different sections); configure could check this and provide a --with-as switch Regards Georg Sauthoff

Hi,
I forgot one thing:
at the solaris x86 system is a ghc-6.2 already installed.
Via start script it uses -fvia-C.
So building 6.4.2 with it give me a different error:
# PATH=/var/tmp/gsauthof/bin:/usr/sfw/bin:$PATH ./configure --with-gcc=/usr/sfw/bin/gcc --with-ghc="/vol/ghc-6.2/bin/ghc" --prefix=/var/tmp/gsauthof/ghc-6.4.2 2>&1 | tee log
mk/config.mk GhcWithInterpreter=YES => NO
apply the three patches from last mail
#PATH=/var/tmp/gsauthof/bin:/usr/sfw/bin:$PATH make 2>&1 | tee log2
/vol/ghc-6.2/bin/ghc -H16m -O -I. -Iinclude -Rghc-timing -I../../../libraries -
fglasgow-exts -no-recomp -c System/Directory/Internals.hs -o System/Directory
/Internals.o -ohi System/Directory/Internals.hi
Prologue junk?: .globl __stginit_SystemziDirectoryziInternals
.type __stginit_SystemziDirectoryziInternals, @function
__stginit_SystemziDirectoryziInternals:
pushl %ebp
movl %esp, %ebp
<

On 29.04 17:47, Georg Sauthoff wrote:
Hi,
I am trying to build ghc-6.4.2 under solaris x86 (10.0).
Hello A few months ago physrules ported GHC 6.4.1 to solaris x86. There were a few problems (and the tarball does not have the install target fixed), but the binary should work. Hopefully this can help you further. No guarantees. http://www.cs.helsinki.fi/u/ekarttun/physrules/ghc-6.4.1-i386-unknown-solari... - Einar Karttunen

On Sat, Apr 29, 2006 at 09:36:53PM +0300, Einar Karttunen wrote: Hello,
A few months ago physrules ported GHC 6.4.1 to solaris x86.
who/what is physrules?
There were a few problems (and the tarball does not have the install target fixed), but the binary should work.
Hopefully this can help you further. No guarantees.
Thanks. Yes, the binary works with a hello-world.hs program. But the ghc-asm mangleer complains again: LD_LIBRARY_PATH=/var/tmp/gsauthof/gmp-4.2/lib PATH=/var/tmp/gsauthof/bin:/usr/sfw/bin:$PATH ./configure --with-ghc=/var/tmp/gsauthof/src/ghc-6.4.1-solaris-x86/bin/ghc --with-gcc=/usr/sfw/bin/gcc --prefix=/var/tmp/gsauthof/ghc-6.4.2 LD_LIBRARY_PATH=/var/tmp/gsauthof/gmp-4.2/lib PATH=/var/tmp/gsauthof/bin:/usr/sfw/bin:$PATH make /var/tmp/gsauthof/src/ghc-6.4.1-solaris-x86/bin/ghc -H16m -O -I. -Iinclude -Rghc-timing -ignore-package Cabal -I../../../libraries -fglasgow-exts -no-recomp -c Compat/Directory.hs -o Compat/Directory.o -ohi Compat/Directory.hi Prologue junk?: .globl CompatziDirectory_a_entry .type CompatziDirectory_a_entry, @function CompatziDirectory_a_entry: pushl %ebp movl %esp, %ebp /var/tmp/gsauthof/src/2/ghc-6.4.2 Regards Georg Sauthoff

On Sat, Apr 29, 2006 at 05:47:29PM +0200, Georg Sauthoff wrote: Hi, [..]
If I go into ghc/rts and manually execute the last command, it terminates sometimes. I.e. if I execute it manually 20 times, 1 time it hangs and 19 times it terminates ... [..]
to give more information: In the log from a truss[1] after hanging this block gets repeated on and on: /1: 88.5631 setcontext(0x08046AD0) /1: 88.5830 Received signal #14, SIGALRM, in lwp_park() [caught] /1: 88.5831 lwp_park(0x00000000, 0) Err#91 ERESTART /1: 88.5831 lwp_sigmask(SIG_SETMASK, 0x00002000, 0x00000000) = 0xFFBFFEFF [0 x0000FFFF] Regards Georg [1] truss -o t.log -a -e -l -d ../../ghc/compiler/ghc-inplace -optc-O -optc-Wall -optc-W -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return -optc-Wbad-function-cast -optc-I../includes -optc-I. -optc-Iparallel -optc-DCOMPILING_RTS -optc-fomit-frame-pointer -optc-Wno-uninitialized -H16m -O -O2 -static -I. -#include Prelude.h -#include Rts.h -#include RtsFlags.h -#include RtsUtils.h -#include StgRun.h -#include Schedule.h -#include Printer.h -#include Sanity.h -#include STM.h -#include Storage.h -#include SchedAPI.h -#include Timer.h -#include Itimer.h -#include ProfHeap.h -#include LdvProfile.h -#include Profiling.h -#include Apply.h -fvia-C -dcmm-lint -c GC.c -o GC.o

Georg Sauthoff wrote:
[..]
If I go into ghc/rts and manually execute the last command, it terminates sometimes. I.e. if I execute it manually 20 times, 1 time it hangs and 19 times it terminates ...
[..]
to give more information:
In the log from a truss[1] after hanging this block gets repeated on and on: /1: 88.5631 setcontext(0x08046AD0) /1: 88.5830 Received signal #14, SIGALRM, in lwp_park() [caught] /1: 88.5831 lwp_park(0x00000000, 0) Err#91 ERESTART /1: 88.5831 lwp_sigmask(SIG_SETMASK, 0x00002000, 0x00000000) = 0xFFBFFEFF [0 x0000FFFF]
There appears to be a problem with the threaded RTS on some platforms: Solaris and possibly FreeBSD. I haven't been able to track down the problem yet - if someone could build GHC with -threaded -debug and send me the output from +RTS -Ds, that might help. You could work around this by removing the -threaded option in ghc/compiler/Makefile. Cheers, Simon

On Tue, May 02, 2006 at 12:16:27PM +0100, Simon Marlow wrote: Hi, [..]
There appears to be a problem with the threaded RTS on some platforms: Solaris and possibly FreeBSD. I haven't been able to track down the problem yet - if someone could build GHC with -threaded -debug and send me the output from +RTS -Ds, that might help.
Wrote private mail.
You could work around this by removing the -threaded option in ghc/compiler/Makefile.
Ok, I tried[1] that and like I guessed, now I get again the infamous 'Prologue junk?' error' again: ../../ghc/compiler/ghc-inplace -H16m -O -O2 -static -I. -#include Prelude.h -#include Rts.h -#include RtsFlags.h -#include RtsUtils.h -#include StgRun.h -#include Schedule.h -#include Printer.h -#include Sanity.h -#include STM.h -#include Storage.h -#include SchedAPI.h -#include Timer.h -#include Itimer.h -#include ProfHeap.h -#include LdvProfile.h -#include Profiling.h -#include Apply.h -fvia-C -dcmm-lint -c Apply.cmm -o Apply.o Prologue junk?: .globl stg_ap_0_ret .type stg_ap_0_ret, @function stg_ap_0_ret: pushl %ebp movl %esp, %ebp make[2]: *** [Apply.o] Error 255 make[1]: *** [all] Error 1 make[1]: Leaving directory `/var/tmp/gsauthof/src/nothread/ghc-6.4.2/ghc' make: *** [build] Error 1 This error I don't understand. Doesn't the mangler expects the pushl/movl instructions? Isn't this a 'normal' sequence if the functions pushes local variables to the stack? Ok, if I diff a raw_s file from linux against one from solaris x86, the pushl/movl sequences are deleted (and the '#NO_APP' command is replaced by '/NO_APP'). Regards Georg Sauthoff [1] PATH=/var/tmp/gsauthof/bin:/usr/sfw/bin:$PATH ./configure --with-gcc=/usr/sfw/bin/gcc --with-ghc="/var/tmp/gsauthof/src/ghc-6.4.2/ghc/compiler/ghc-inplace" --prefix=/var/tmp/gsauthof/ghc-6.4.2-nt 2>&1 | tee log PATH=/var/tmp/gsauthof/bin:/usr/sfw/bin:$PATH make 2>&1 | tee log2

Georg Sauthoff wrote:
Ok, I tried[1] that and like I guessed, now I get again the infamous 'Prologue junk?' error' again:
../../ghc/compiler/ghc-inplace -H16m -O -O2 -static -I. -#include Prelude.h -#include Rts.h -#include RtsFlags.h -#include RtsUtils.h -#include StgRun.h -#include Schedule.h -#include Printer.h -#include Sanity.h -#include STM.h -#include Storage.h -#include SchedAPI.h -#include Timer.h -#include Itimer.h -#include ProfHeap.h -#include LdvProfile.h -#include Profiling.h -#include Apply.h -fvia-C -dcmm-lint -c Apply.cmm -o Apply.o Prologue junk?: .globl stg_ap_0_ret .type stg_ap_0_ret, @function stg_ap_0_ret: pushl %ebp movl %esp, %ebp
make[2]: *** [Apply.o] Error 255 make[1]: *** [all] Error 1 make[1]: Leaving directory `/var/tmp/gsauthof/src/nothread/ghc-6.4.2/ghc' make: *** [build] Error 1
This error I don't understand. Doesn't the mangler expects the pushl/movl instructions? Isn't this a 'normal' sequence if the functions pushes local variables to the stack?
Ok, if I diff a raw_s file from linux against one from solaris x86, the pushl/movl sequences are deleted (and the '#NO_APP' command is replaced by '/NO_APP').
You shouldn't see the %ebp instructions, because gcc should be invoked with -fomit-frame-pointer. Is it possible that somehow part of your build thinks it is unregisterised? Try running GHC with -v, see whether the -fomit-frame-pointer flag is being passed to gcc. If not, try to find out why - it should be added by code in ghc/compiler/main/DriverFlags.hs. Cheers, Simon

On Wed, May 03, 2006 at 11:50:46AM +0100, Simon Marlow wrote: Hi,
You shouldn't see the %ebp instructions, because gcc should be invoked with -fomit-frame-pointer. Is it possible that somehow part of your build thinks it is unregisterised?
I hope not. Started with a fresh tree and configure/make at top (plus trivial whitespace/ctime_r/schield_yield patches from first mail).
Try running GHC with -v, see whether the -fomit-frame-pointer flag is being passed to gcc. If not, try to find out why - it should be added by code in ghc/compiler/main/DriverFlags.hs.
Ok, did that - and gcc gets the -fomit-frame-pointer flag. Log is attached. Regards Georg Sauthoff

On Wed, May 03, 2006 at 05:56:18PM +0200, Georg Sauthoff wrote:
On Wed, May 03, 2006 at 11:50:46AM +0100, Simon Marlow wrote:
Hi, [..]
Try running GHC with -v, see whether the -fomit-frame-pointer flag is being passed to gcc. If not, try to find out why - it should be added by code in ghc/compiler/main/DriverFlags.hs.
Ok, did that - and gcc gets the -fomit-frame-pointer flag. Log is attached.
obviously, this raises suspicion that the Sun gcc[1] ignores the -fomit-frame-pointer flag. A minimal test case on solaris/x86 and linux/x86 confirms this suspicion. I will talk to a local gcc/solaris expert. Regards Georg Sauthoff [1] gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath) which is shipped with Solaris 10 (installed under /usr/sfw (sfw == Sun Freeware))
participants (3)
-
Einar Karttunen
-
Georg Sauthoff
-
Simon Marlow