Re: [Haskell-cafe] Porting GHC to OSX86?

2006-05-10 Thread Scott Weeks
Thanks for your response, I'll follow your saga and hopefully learn a  
bit more about GHC's guts in the process.



On 07/05/2006, at 4:05 AM, Reilly Hayes wrote:



You'll get a better response to this on the glasgow-haskell-users  
list.  I'm cross-posting my reply.


I'm brand new to hacking on GHC, but I've been working on this in  
my pitifully meagre spare time.  The actual expert is Wolfgang  
Thaller, but he doesn't seem to be around the lists lately.  I was  
able to generate hc files on a 386 linux box (actually on a  
Parallels virtual machine on my mac, as my linux boxen all run 64  
bit linuces).I'll share my findings so far:



1) STABLE does not have the appropriate code in the Mangler to deal  
with Darwin/86.  I've been playing with various versions of HEAD.


2) HEAD has gone through a major revision to the directory  
structure.  The documentation and some of the build processes have  
not caught up.  Simon Marlow sent a helpful e-mail to the ghc users  
list a few days ago that you should look at.


3) Building the .hc files mostly requires the appropriate settings  
in mk/build.mk on the Host (linux) machine.  I'll include my  
build.mk below.  There is a target in the top level makefile called  
hc-file-bundle (which needs to be invoked with the parameter  
ProjectNameShort=ghc in HEAD and Project=ghc in STABLE).  This  
target packages up the .hc files, but does not build them.  Some of  
the .hc files in utils (genapply, genprimopcode,  ghc-pkg) don't  
get built.  I just cd to the directories and make them by hand (be  
sure to use the in-place compiler).  A GhcUtilsHcOpts variable in  
the make structure would be nice (in order to pass -keep-hc-files  
to ghc when building these on the host).


4) I have been working with Registerised hc files.  This may have  
been a mistake, as registerised code seems to present some unique  
challenges on Darwin/86.  See the items below for a discussion.


5) If I understand correctly (somebody with better knowledge please  
correct me), there is a register allocation conflict between ghc  
and relocatable code generated by gcc on the 386 (gcc flag -fPIC).   
This limits ghc to producing static binaries.  The gcc in Xcode  
builds relocatable code by default and requires -static to build  
static binaries.


I think this conflict is limited to code that goes through the  
Mangler (registerized code).


6) If I understand correctly, there is code in the RTS that cannot  
be built using the native code generator.  Which suggests that  
we're stuck with static binaries.  There is a ticket to fix this in  
HEAD.


7) Mac OS X really doesn't like static binaries.  In fact, in order  
to link a static binary, you have to go to opendarwin and download  
the Csu package to build crt0.o.  It's not included in any of the  
development tools.  Apple warns that static binaries are likely to  
fail to operate in O/S version changes.


Curently I'm fighting with the Makefiles to figure out how to get  
the -static flag stuffed into all of the invocations of gcc.  Some  
of the invocations in rts components don't seem to obey the normal  
variables used in the makefile structure.  I haven't had time to  
puzzle this out and won't for a few days.



mk/build.mk used to generate hc files:


GhcLibHcOpts = -O -fasm -keep-hc-files
GhcRtsHcOpts = -fasm -keep-hc-files
GhcWithInterpreter = NO
GhcStage1HcOpts = -O
GhcStage2HcOpts = -O -fasm -keep-hc-files
SRC_HC_OPTS += -H32m



-reilly hayes

On May 5, 2006, at 7:34 PM, Scott Weeks wrote:


Hi All,

Does anyone know if there's been any headway on this? If there's not
a port available, where do I go about finding the hc files? Could I
compile on a windows or linux x86 box and use the generated hc files
to bootstrap?

Cheers,
Scott

On 22/03/2006, at 7:09 AM, Deling Ren wrote:


Hi there,

Has anyone made any attempt to port GHC to Mac OS X on x86?
Wolfgang Thaller’s binary package runs over Rosetta but slow (not
surprising). It can not be used to compile a native version either
(I got some errors related to machine registers).

I tried to do a bootstrap but can't find the .HC files mentioned
in the manual. They don't seem to be on the download page of GHC.
Any ideas?

Thanks.

Deling___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Reilly Hayes
[EMAIL PROTECTED]







___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Porting GHC to OSX86?

2006-05-06 Thread Reilly Hayes


You'll get a better response to this on the glasgow-haskell-users  
list.  I'm cross-posting my reply.


I'm brand new to hacking on GHC, but I've been working on this in my  
pitifully meagre spare time.  The actual expert is Wolfgang Thaller,  
but he doesn't seem to be around the lists lately.  I was able to  
generate hc files on a 386 linux box (actually on a Parallels virtual  
machine on my mac, as my linux boxen all run 64 bit linuces).I'll  
share my findings so far:



1) STABLE does not have the appropriate code in the Mangler to deal  
with Darwin/86.  I've been playing with various versions of HEAD.


2) HEAD has gone through a major revision to the directory  
structure.  The documentation and some of the build processes have  
not caught up.  Simon Marlow sent a helpful e-mail to the ghc users  
list a few days ago that you should look at.


3) Building the .hc files mostly requires the appropriate settings in  
mk/build.mk on the Host (linux) machine.  I'll include my build.mk  
below.  There is a target in the top level makefile called hc-file- 
bundle (which needs to be invoked with the parameter  
ProjectNameShort=ghc in HEAD and Project=ghc in STABLE).  This target  
packages up the .hc files, but does not build them.  Some of the .hc  
files in utils (genapply, genprimopcode,  ghc-pkg) don't get built.   
I just cd to the directories and make them by hand (be sure to use  
the in-place compiler).  A GhcUtilsHcOpts variable in the make  
structure would be nice (in order to pass -keep-hc-files to ghc when  
building these on the host).


4) I have been working with Registerised hc files.  This may have  
been a mistake, as registerised code seems to present some unique  
challenges on Darwin/86.  See the items below for a discussion.


5) If I understand correctly (somebody with better knowledge please  
correct me), there is a register allocation conflict between ghc and  
relocatable code generated by gcc on the 386 (gcc flag -fPIC).  This  
limits ghc to producing static binaries.  The gcc in Xcode builds  
relocatable code by default and requires -static to build static  
binaries.


I think this conflict is limited to code that goes through the  
Mangler (registerized code).


6) If I understand correctly, there is code in the RTS that cannot be  
built using the native code generator.  Which suggests that we're  
stuck with static binaries.  There is a ticket to fix this in HEAD.


7) Mac OS X really doesn't like static binaries.  In fact, in order  
to link a static binary, you have to go to opendarwin and download  
the Csu package to build crt0.o.  It's not included in any of the  
development tools.  Apple warns that static binaries are likely to  
fail to operate in O/S version changes.


Curently I'm fighting with the Makefiles to figure out how to get the  
-static flag stuffed into all of the invocations of gcc.  Some of the  
invocations in rts components don't seem to obey the normal variables  
used in the makefile structure.  I haven't had time to puzzle this  
out and won't for a few days.



mk/build.mk used to generate hc files:


GhcLibHcOpts = -O -fasm -keep-hc-files
GhcRtsHcOpts = -fasm -keep-hc-files
GhcWithInterpreter = NO
GhcStage1HcOpts = -O
GhcStage2HcOpts = -O -fasm -keep-hc-files
SRC_HC_OPTS += -H32m



-reilly hayes

On May 5, 2006, at 7:34 PM, Scott Weeks wrote:


Hi All,

Does anyone know if there's been any headway on this? If there's not
a port available, where do I go about finding the hc files? Could I
compile on a windows or linux x86 box and use the generated hc files
to bootstrap?

Cheers,
Scott

On 22/03/2006, at 7:09 AM, Deling Ren wrote:


Hi there,

Has anyone made any attempt to port GHC to Mac OS X on x86?
Wolfgang Thaller’s binary package runs over Rosetta but slow (not
surprising). It can not be used to compile a native version either
(I got some errors related to machine registers).

I tried to do a bootstrap but can't find the .HC files mentioned
in the manual. They don't seem to be on the download page of GHC.
Any ideas?

Thanks.

Deling___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Reilly Hayes
[EMAIL PROTECTED]




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Porting GHC to OSX86?

2006-05-05 Thread Scott Weeks

Hi All,

Does anyone know if there's been any headway on this? If there's not  
a port available, where do I go about finding the hc files? Could I  
compile on a windows or linux x86 box and use the generated hc files  
to bootstrap?


Cheers,
Scott

On 22/03/2006, at 7:09 AM, Deling Ren wrote:


Hi there,

Has anyone made any attempt to port GHC to Mac OS X on x86?  
Wolfgang Thaller’s binary package runs over Rosetta but slow (not  
surprising). It can not be used to compile a native version either  
(I got some errors related to machine registers).


I tried to do a bootstrap but can't find the .HC files mentioned  
in the manual. They don't seem to be on the download page of GHC.  
Any ideas?


Thanks.

Deling___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Porting GHC to OSX86?

2006-03-22 Thread Thomas Davie


On Mar 21, 2006, at 8:09 PM, Deling Ren wrote:


Hi there,

Has anyone made any attempt to port GHC to Mac OS X on x86?  
Wolfgang Thaller’s binary package runs over Rosetta but slow (not  
surprising). It can not be used to compile a native version either  
(I got some errors related to machine registers).


I tried to do a bootstrap but can't find the .HC files mentioned  
in the manual. They don't seem to be on the download page of GHC.  
Any ideas?


Why not use darwin ports to build it?

Bob
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Porting GHC to OSX86?

2006-03-22 Thread Deling Ren

It's not supported on i386 platform yet :(

On Mar 22, 2006, at 12:34 AM, Thomas Davie wrote:



On Mar 21, 2006, at 8:09 PM, Deling Ren wrote:


Hi there,

Has anyone made any attempt to port GHC to Mac OS X on x86?  
Wolfgang Thaller’s binary package runs over Rosetta but slow (not  
surprising). It can not be used to compile a native version either  
(I got some errors related to machine registers).


I tried to do a bootstrap but can't find the .HC files mentioned  
in the manual. They don't seem to be on the download page of GHC.  
Any ideas?


Why not use darwin ports to build it?

Bob


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Porting GHC to OSX86?

2006-03-22 Thread Gregory Wright


Hi,

DP will support the i386 build as soon as Wolfgang makes his
changes available.  As I understand, from earlier messages on one
of the ghc* lists, this is almost done for the pre-6.6 branch, but not
yet backported to the 6.4.x branch.

Also, DP uses a binary bootstrap compiler to build ghc, rather than
starting from the .hc files.  I've been meaning to try it, but I can't
promise any schedule as work and life have distracted me from
code recently.

Best Wishes,
Greg

(darwinports ghc maintainer)


On Mar 22, 2006, at 6:16 AM, Deling Ren wrote:


It's not supported on i386 platform yet :(

On Mar 22, 2006, at 12:34 AM, Thomas Davie wrote:



On Mar 21, 2006, at 8:09 PM, Deling Ren wrote:


Hi there,

Has anyone made any attempt to port GHC to Mac OS X on x86?  
Wolfgang Thaller’s binary package runs over Rosetta but slow (not  
surprising). It can not be used to compile a native version  
either (I got some errors related to machine registers).


I tried to do a bootstrap but can't find the .HC files  
mentioned in the manual. They don't seem to be on the download  
page of GHC. Any ideas?


Why not use darwin ports to build it?

Bob


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Porting GHC to OSX86?

2006-03-21 Thread Deling Ren

Hi there,

Has anyone made any attempt to port GHC to Mac OS X on x86? Wolfgang  
Thaller’s binary package runs over Rosetta but slow (not surprising).  
It can not be used to compile a native version either (I got some  
errors related to machine registers).


I tried to do a bootstrap but can't find the .HC files mentioned in  
the manual. They don't seem to be on the download page of GHC. Any  
ideas?


Thanks.

Deling___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe