Trouble building nhc98 for AIX

Hello, I have nhc98 1.16 plus the gcc3.3 patch from the website and am trying to build it on AIX 5.1L. First, every test for including inttypes.h instead of stdint.h should include _AIX in the list of systems that use inttypes.h. (Look in mark.h, HsFFI.h). Now then -- I have no existing Haskell support on this machine so I'm bootstrapping from GCC 3.3.2. I am getting this problem: make[1]: Leaving directory `/home/jgoerzen/programs/nhc98-1.16/src/prelude' touch targets/powerpc-AIX-5.1.0.0/prelude-gcc touch targets/powerpc-AIX-5.1.0.0/prelude script/nhc98 -o lib/powerpc-AIX-5.1.0.0/hmake-PRAGMA script/hmake-PRAGMA.hc touch targets/powerpc-AIX-5.1.0.0/pragma-gcc make: *** No rule to make target `src/compiler98/*.hc', needed by `targets/powerpc-AIX-5.1.0.0/compiler-gcc'. Stop. jgoerzen@mfgpro:~/programs/nhc98-1.16$ make make: *** No rule to make target `src/compiler98/*.hc', needed by `targets/powerpc-AIX-5.1.0.0/compiler-gcc'. Stop. So now I am really stuck. Suggestions welcome :-) -- John Goerzen

John Goerzen
First, every test for including inttypes.h instead of stdint.h should include _AIX in the list of systems that use inttypes.h. (Look in mark.h, HsFFI.h).
Thanks, I'll add those tests to CVS.
Now then -- I have no existing Haskell support on this machine so I'm bootstrapping from GCC 3.3.2.
make: *** No rule to make target `src/compiler98/*.hc', needed by `targets/powerpc-AIX-5.1.0.0/compiler-gcc'. Stop.
You have done a 'make clean' at some point, which has removed the .hc bootstrapping files. You'll need to unpack the tarfile again, redo any edits so far, re-configure and re-make. Regards, Malcolm

On Thursday 30 September 2004 09:05 am, Malcolm Wallace wrote:
John Goerzen
writes: First, every test for including inttypes.h instead of stdint.h should include _AIX in the list of systems that use inttypes.h. (Look in mark.h, HsFFI.h).
Thanks, I'll add those tests to CVS.
I've got one other patch I'll send along yet once I've got everything built.
You have done a 'make clean' at some point, which has removed the .hc bootstrapping files. You'll need to unpack the tarfile again, redo any edits so far, re-configure and re-make.
Oops, yes, that was it and now I'm red-faced. Sorry. I got farther now, but: rm -f /home/jgoerzen/programs/nhc98-1.16/targets/powerpc-AIX-5.1.0.0/obj/prelude/DErrNo/*.o *.o rm -f rm -f /home/jgoerzen/programs/nhc98-1.16/script/nhc98 -cpp -c +CTS -lib -redefine -CTS +RTS -H32M -RTS -o /home/jgoerzen/programs/nhc98-1.16/targets/powerpc-AIX-5.1.0.0/obj/prelude/DErrNo/DErrNo.o DErrNo.hs /home/jgoerzen/programs/nhc98-1.16/script/nhc98[467]: 80554 Segmentation fault(coredump) /home/jgoerzen/programs/nhc98-1.16/script/nhc98[477]: 16590 Segmentation fault(coredump) Trying to get tag from unevaluated node in TABLESWITCH at 200c5e8d! Node is: 2007452b at 200e807c If I can help you with debugging, let me know. I'm decent with gdb but I have no idea what to do to debug nhc98. In this case, it was hmake-PRAGMA that died. All I got from the coredump was: goerzen@mfgpro:~/programs/nhc98-1.16/src/prelude/powerpc-AIX-5.1.0.0/NHC$ gdb . ./../../../lib/powerpc-AIX-5.1.0.0/hmake-PRAGMA core GNU gdb 5.0-aix51-020209 Copyright 2000 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "powerpc-ibm-aix5.1.0.0"... Core was generated by `hmake-PRAGMA'. Program terminated with signal 11, Segmentation fault. #0 0x10000920 in run () (gdb) bt #0 0x10000920 in run () #1 0x100006c8 in text () #2 0x100006c8 in text () #3 0x100001cc in __start () I suppose hmake-PRAGMA needs to be built with debugging symbols. I'll see if I can figure out how. Thanks again. -- John
Regards, Malcolm
-- John Goerzen

John Goerzen
Thanks, I'll add those tests to CVS.
I've got one other patch I'll send along yet once I've got everything built.
Please do.
/home/jgoerzen/programs/nhc98-1.16/script/nhc98 .... DErrNo.hs 80554 Segmentation fault(coredump)
If I can help you with debugging, let me know. I'm decent with gdb but I have no idea what to do to debug nhc98.
gdb is next to useless on any program compiled with nhc98, since there are almost no C-like function entries or stacks to look at. Fortunately, I think we tracked down this seg fault a few months back. It is some new kind of interaction with gcc >= 3.3, whereby the latter places data differently in memory to previous versions.
Core was generated by `hmake-PRAGMA'. Program terminated with signal 11, Segmentation fault. (gdb) bt #0 0x10000920 in run () #1 0x100006c8 in text () #2 0x100006c8 in text () #3 0x100001cc in __start ()
This is exactly what I would expect - run() is the entry point to the nhc98 runtime system, and everything else is internal to that.
I suppose hmake-PRAGMA needs to be built with debugging symbols. I'll see if I can figure out how.
For the reason I have just outlines, I don't think it is worth it. There have been a few recent patches, additional to those on the website, for fixing nhc98's interaction with gcc-3.3.x. Rather than try to extract them, I'm going to suggest you collect a snapshot of the current CVS, which has these fixes plus several more improvements. Then, if you still can't get it to build, we will at least be sure that the problem does not lie with inadequate patch management, but with the current codebase. ftp://ftp.cs.york.ac.uk/pub/haskell/nhc98/nhc98src-1.17.tar.gz Regards, Malcolm

On Thursday 30 September 2004 10:20 am, Malcolm Wallace wrote:
John Goerzen
writes: Thanks, I'll add those tests to CVS.
I've got one other patch I'll send along yet once I've got everything built.
Please do.
With the CVS file, the only change I had to make was: --- script/harch~ 2003-02-13 12:08:43.000000000 -0600 +++ script/harch 2004-09-30 10:43:31.000000000 -0500 @@ -85,7 +85,7 @@ then OS=$OS-`oslevel` else OS=$OS-unknown fi - if /etc/lsattr -EHl proc0 | grep -i powerpc >/dev/null 2>&1 + if lsattr -EHl proc0 | grep -i powerpc >/dev/null 2>&1 then PROCESSOR=powerpc else PROCESSOR=power fi ;;
There have been a few recent patches, additional to those on the website, for fixing nhc98's interaction with gcc-3.3.x. Rather than try to extract them, I'm going to suggest you collect a snapshot of the current CVS, which has these fixes plus several more improvements. Then, if you still can't get it to build, we will at least be sure that the problem does not lie with inadequate patch management, but with the current codebase.
ftp://ftp.cs.york.ac.uk/pub/haskell/nhc98/nhc98src-1.17.tar.gz
Got it, but build crashed with the same error: /home/jgoerzen/programs/nhc98-1.17/script/nhc98 -c +CTS -lib -redefine -CTS +RTS -H32M -RTS -o /home/jgoerzen/programs/nhc98-1.17/targets/powerpc-AIX-5.1.0.0/obj/prelude/DErrNo/DErrNo.o DErrNo.hs /home/jgoerzen/programs/nhc98-1.17/script/nhc98[452]: 72104 Segmentation fault(coredump) /home/jgoerzen/programs/nhc98-1.17/script/nhc98[462]: 66656 Segmentation fault(coredump) Trying to get tag from unevaluated node in TABLESWITCH at 200a2d25! Node is: 20052b5f at 200c5cac
Regards, Malcolm
-- John Goerzen

John Goerzen
ftp://ftp.cs.york.ac.uk/pub/haskell/nhc98/nhc98src-1.17.tar.gz
Got it, but build crashed with the same error:
OK, so we are definitely stuck now. Out of interest, does your machine have a 64-bit processor? Currently nhc98 only works for 32-bit machines. Regards, Malcolm

On Thursday 30 September 2004 11:14 am, Malcolm Wallace wrote:
John Goerzen
writes: ftp://ftp.cs.york.ac.uk/pub/haskell/nhc98/nhc98src-1.17.tar.gz
Got it, but build crashed with the same error:
OK, so we are definitely stuck now. Out of interest, does your machine have a 64-bit processor? Currently nhc98 only works for 32-bit machines.
Yes. However, from the gcc docs: `-maix64' `-maix32' Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit `long' type, and the infrastructure needed to support them. Specifying `-maix64' implies `-mpowerpc64' and `-mpowerpc', while `-maix32' disables the 64-bit ABI and implies `-mno-powerpc64'. GCC defaults to `-maix32'. In other words, the system is dual-mode and runs in 32-bit mode by default. -- John Goerzen

On Thu, Sep 30, 2004 at 05:14:00PM +0100, Malcolm Wallace wrote:
John Goerzen
writes: ftp://ftp.cs.york.ac.uk/pub/haskell/nhc98/nhc98src-1.17.tar.gz
Got it, but build crashed with the same error:
OK, so we are definitely stuck now. Out of interest, does your machine have a 64-bit processor? Currently nhc98 only works for 32-bit machines.
BTW, I don't know if I mentioned this or not, but I also got this error after the coredump: Trying to get tag from unevaluated node in TABLESWITCH at 200a32fd! Node is: 20053057 at 200c653c gmake[1]: *** [/home/jgoerzen/programs/nhc98/nhc98-1.17/targets/powerpc-AIX-5.1. Any help would be greatly appreciated. Thanks!
Regards, Malcolm
-- John Goerzen Author, Foundations of Python Network Programming http://www.amazon.com/exec/obidos/tg/detail/-/1590593715

John Goerzen
BTW, I don't know if I mentioned this or not, but I also got this error after the coredump:
Trying to get tag from unevaluated node in TABLESWITCH at 200a32fd! Node is: 20053057 at 200c653c
This just means the runtime bytecode interpreter has fallen over, and is largely equivalent to a seg fault. Now that you have managed to get ghc built on your machine, you may no longer be interested in nhc98, but I wondered if you have yet tried the same hack you needed for ghc:
Oh, BTW, I had to put a script named gcc on my path. It says this: exec /usr/local/bin/gcc -mpowerpc -maix32 -mminimal-toc "$@"
And it might also be interesting to see if you can now build nhc98 with your fresh ghc. A success would mean I didn't need to worry any further. Regards, Malcolm

On Monday 04 October 2004 04:38 am, Malcolm Wallace wrote:
John Goerzen
writes: Now that you have managed to get ghc built on your machine, you may no longer be interested in nhc98, but I wondered if you have yet tried the same hack you needed for ghc:
Oh, BTW, I had to put a script named gcc on my path. It says this: exec /usr/local/bin/gcc -mpowerpc -maix32 -mminimal-toc "$@"
I have tried it, and the same problem occurs with that.
And it might also be interesting to see if you can now build nhc98 with your fresh ghc. A success would mean I didn't need to worry any further.
Now that is quite interesting. It appears to have *worked* being built using ghc, but not being built using gcc. The only change was to harch, changing /etc/lsattr to lsattr. Seems odd to me. Anyway, this is a build of the 1.17 snapshot and it seems to be working OK. (Though some of the features I was used to in System.Posix from ghc are missing, but that seems to be not an AIX-specific issue). I am presently uploading tarballs to my site. When complete, you will be able to download the AIX 5.1L PowerPC binDist or built source tree from: http://quux.org/devel/AIX/nhc98 Wait 1-2 hours before checking. (Sorry, this connection is slow for uploading). Feel free to copy or link to those files anywhere you like. Thank you for all your help. I appreciate it. -- John

John Goerzen
Now that is quite interesting. It appears to have *worked* being built using ghc, but not being built using gcc. Seems odd to me.
Yes, that certainly is interesting. It indicates that the .hc files we bootstrap with are not as portable as they should be. This is very useful information.
Thank you for all your help. I appreciate it.
And thanks for sticking with it till we got a result. Regards, Malcolm
participants (3)
-
John Goerzen
-
John Goerzen
-
Malcolm Wallace