Opened 15 years ago

Closed 15 years ago

#20132 closed defect (fixed)

ghc missing variable definitions in 10.6

Reported by: nerdling (Jeremy Lavergne) Owned by: gwright@…
Priority: Normal Milestone:
Component: ports Version: 1.8.0
Keywords: snowleopard Cc: dsturnbull@…, macports.org@…, brianm@…, me@…, kevin.way@…, macports@…, bts@…, hong.rich@…, david.darais@…, skluft@…, psarge@…, jdfrens@…, smanek@…, marco.comini@…, pedronbvasconcelos@…, lambda@…, marcin.zalewski@…, nchaimov@…, rdreyer@…, league@…, kowey@…, ryandesign (Ryan Carsten Schmidt), hvitved@…, dpkatz@…, tumdum@…, brecht.hoflack@…, mfisher@…, j.e.miyake@…, takaaki.kato@…, alex@…, cryptix@…, a.sewall.ford@…, jowens (John Owens), t.kunishi@…, fm2209@…, tobi_m@…, adrian@…, larsko@…, mdippery@…, arto.bendiken@…, akborder@…, torsneyt@…, anonymous.lion@…, MartinBuchmann (Martin Buchmann), drkp (Dan Ports), Jens_Abraham@…, email@…, erik@…, mike@…, macports@…, rs573@…, larryv (Lawrence Velázquez), khalsah@…, tomas.znamenacek@…, roland@…, sonicth, easye, thomas.hutchinson@…
Port: ghc

Description

The portfile only defines variables in the post-patch for various versions of the OS. However, 10.6 (darwin 10) isn't defined yet, so building of this port cannot occur yet.

--->  Applying patches to ghc
Error: Target org.macports.patch returned: can't read "ghc_bootversion": no such variable
Error: The following dependencies failed to build: ghc
Error: Status 1 encountered during processing.

Attachments (4)

usr-bin-ghc.patch (498 bytes) - added by ecronin (Eric Cronin) 15 years ago.
patch for binary GHC 6.10.4 install (ghc)
usr-bin-ghci.patch (344 bytes) - added by ecronin (Eric Cronin) 15 years ago.
patch for binary GHC 6.10.4 install (ghci)
usr-bin-hsc2hs.patch (404 bytes) - added by ecronin (Eric Cronin) 15 years ago.
patch for binary GHC 6.10.4 install (hsc2hs)
lang-ghc.diff (5.6 KB) - added by ecronin (Eric Cronin) 15 years ago.
partial update to fix Snow Leopard compat

Download all attachments as: .zip

Change History (116)

comment:1 Changed 15 years ago by nerdling (Jeremy Lavergne)

Priority: NormalLow

Lowering priority since 10.6 is not yet out.

comment:2 Changed 15 years ago by gwright@…

Status: newassigned

GHC is unlikely to work out of the box when SnowLeopard arrives because of the need for a compatible bootstrap compiler. This is a known issue, and I hope to resolve it as soon as possible.

comment:3 Changed 15 years ago by nerdling (Jeremy Lavergne)

Version: 1.7.11.8.0

comment:4 Changed 15 years ago by nerdling (Jeremy Lavergne)

Keywords: snowleopard added

comment:5 Changed 15 years ago by dsturnbull@…

Cc: dsturnbull@… added

Cc Me!

comment:6 Changed 15 years ago by macports.org@…

Cc: macports.org@… added

Cc Me!

comment:7 Changed 15 years ago by brianm@…

Cc: brianm@… added

Cc Me!

comment:8 Changed 15 years ago by me@…

Cc: me@… added

Cc Me!

comment:9 Changed 15 years ago by kevin.way@…

Cc Me!

comment:10 Changed 15 years ago by kevin.way@…

Cc: kevin.way@… added

Cc Me!

comment:11 Changed 15 years ago by macports@…

Cc: macports@… added

Cc Me!

comment:12 Changed 15 years ago by bts@…

Cc: bts@… added

Cc Me!

comment:13 Changed 15 years ago by hong.rich@…

Cc: hong.rich@… added

Cc Me!

comment:14 Changed 15 years ago by david.darais@…

Cc: david.darais@… added

Cc Me!

comment:15 Changed 15 years ago by skluft@…

Cc: skluft@… added

Cc Me!

comment:16 Changed 15 years ago by psarge@…

Cc: psarge@… added

Cc Me!

comment:17 Changed 15 years ago by jdfrens@…

Cc: jdfrens@… added

Cc Me!

comment:18 Changed 15 years ago by nerdling (Jeremy Lavergne)

Priority: LowNormal

comment:19 Changed 15 years ago by mietek+macports@…

Until this is fixed, you can install the official GHC 6.10.4 binary, and apply a small workaround.

The binary can be found on the official download page.

The only problem is that GHC generates 32-bit code, and the GCC toolchain on 10.6 defaults to 64-bit, as detailed in a Haskell Cafe thread.

The thread describes a workaround to get the official 6.10.4 binary working. Simply add the following flags to /usr/bin/ghc and /usr/bin/ghci:

-optc-m32 -opta-m32 -optl-m32

According to GHC ticket #3400 this fix is already applied to the HEAD, so hopefully we can expect an updated port soon.

comment:20 Changed 15 years ago by mietek@…

Cc: mietek@… added

Cc Me!

comment:21 Changed 15 years ago by smanek@…

Cc: smanek@… added

Cc Me!

comment:22 Changed 15 years ago by mellon85@…

Cc: mellon85@… added

Cc Me!

comment:23 Changed 15 years ago by marco.comini@…

Cc: marco.comini@… added

Cc Me!

comment:24 Changed 15 years ago by maik@…

Cc: maik@… added

Cc Me!

comment:25 Changed 15 years ago by pedronbvasconcelos@…

Cc: pedronbvasconcelos@… added

Cc Me!

comment:26 Changed 15 years ago by lambda@…

Cc: lambda@… added

Cc Me!

comment:27 Changed 15 years ago by marcin.zalewski@…

Cc: marcin.zalewski@… added

Cc Me!

comment:28 Changed 15 years ago by mike@…

Cc: mike@… added

Cc Me!

comment:29 Changed 15 years ago by mike@…

Cc: mike@… removed

Cc Me!

comment:30 Changed 15 years ago by nchaimov@…

Cc: nchaimov@… added

Cc Me!

comment:31 Changed 15 years ago by rdreyer@…

Cc: rdreyer@… added

Cc Me!

comment:32 Changed 15 years ago by league@…

Cc: league@… added

Cc Me!

comment:33 Changed 15 years ago by kowey@…

Cc: kowey@… added

Cc Me!

comment:34 Changed 15 years ago by gwright@…

It seems as if I can run Snow Leopard under VMWare Fusion, so I should be able to test this out this week. For work reasons I need to keep my current machine running Leopard for the moment. How long it takes mostly depends on whether it's easy to get a reliable bootstrap compiler running quickly.

I'll have access to an additional Leopard machine soon, so the VMWare kludge ought not to be required for long.

Thanks to all for your patience.

comment:35 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added

comment:36 Changed 15 years ago by hvitved@…

Cc: hvitved@… added

Cc Me!

comment:37 Changed 15 years ago by dpkatz@…

Cc: dpkatz@… added

Cc Me!

comment:38 Changed 15 years ago by tumdum@…

Cc: tumdum@… added

Cc Me!

comment:39 Changed 15 years ago by brecht.hoflack@…

Cc: brecht.hoflack@… added

Cc Me!

comment:40 Changed 15 years ago by alex@…

While I appreciate the efforts being made to ensure that GHC works with 64-bit capability, is it not possible to edit this 'work-around' in the meantime?

I might be wrong, but my Mac doesn't support 64-bit, so if I could get past this informative message, I expect GHC would run fine. Even for those with 64-bit capable Macs, I expect most have abandoned this portfile and used the work-around described in Comment 19, so why not implement the work-around in the portfile until it can be fixed properly?

I don't know how to edit portfiles, otherwise I'd be happy to suggest the changes that need including to do this. However, I'd really appreciate any assistance in getting this portfile installed, if only to test my theory.

comment:41 Changed 15 years ago by mfisher@…

Cc: mfisher@… added

Cc Me!

comment:42 Changed 15 years ago by j.e.miyake@…

Cc: j.e.miyake@… added

Cc Me!

comment:43 Changed 15 years ago by takaaki.kato@…

Cc: takaaki.kato@… added

Cc Me!

comment:44 Changed 15 years ago by alex@…

Cc: alex@… added

Cc Me!

comment:45 Changed 15 years ago by jbolden1517@…

Cc Me!

comment:46 Changed 15 years ago by cryptix@…

Cc: cryptix@… added

Cc Me!

comment:47 Changed 15 years ago by a.sewall.ford@…

Cc: a.sewall.ford@… added

Cc Me!

comment:48 Changed 15 years ago by jowens (John Owens)

Cc: john_owens@… added

Cc Me!

comment:49 in reply to:  48 Changed 15 years ago by rvr@…

CC Me!

comment:50 Changed 15 years ago by marco.comini@…

I personally agree with the request of Alex. It seems, at least to me, a quite reasonable request. If it is not, one of the maintainers could have simply said so! It takes just a minute to say something like "Sorry, it's not that simple, it takes almost the same time as resolving the issue properly".

Now, 3 weeks had already passed and (at least in this Ticket) Alex has been completely ignored... quite sad.

I'm also looking forward to have a running GHC (64 or only 32 is not that problem) in order to *use* it and have back Darcs, Alex, Happy & BNFC (just to mention some).

I was not considering installing the binaries as an option, but also staying months without GHC is not an option :(

Could somebody say us if the discussion has moved somewere?

Thanks folks

comment:51 Changed 15 years ago by h8spawn@…

Cc: h8spawn@… added

Cc Me!

comment:52 Changed 15 years ago by t.kunishi@…

Cc: t.kunishi@… added

Cc Me!

comment:53 Changed 15 years ago by fm2209@…

I badly need this one too, also considering the fact that hugs doesn't work too...

comment:54 Changed 15 years ago by fm2209@…

Cc: fm2209@… added

Cc Me!

comment:55 Changed 15 years ago by tobi_m@…

Cc: tobi_m@… added

Cc Me!

comment:56 Changed 15 years ago by adrian@…

Cc: adrian@… added

Cc Me!

comment:57 Changed 15 years ago by larsko@…

Cc: larsko@… added

Cc Me!

comment:58 Changed 15 years ago by mdippery@…

Cc: mdippery@… added

Cc Me!

comment:59 Changed 15 years ago by arto.bendiken@…

Cc: arto.bendiken@… added

Cc Me!

comment:60 Changed 15 years ago by akborder@…

Cc: akborder@… added

Cc Me!

comment:61 Changed 15 years ago by jowens (John Owens)

GHC 6.12.1 released 2 weeks ago, "GHC now works (as a 32bit application) on OS X Snow Leopard" [per release notes].

comment:62 Changed 15 years ago by torsneyt@…

Cc: torsneyt@… added

Cc Me!

comment:63 Changed 15 years ago by anonymous.lion@…

Cc: anonymous.lion@… added

Cc Me!

comment:64 Changed 15 years ago by MartinBuchmann (Martin Buchmann)

Cc: Martin.Buchmann@… added

Cc Me!

comment:65 Changed 15 years ago by drkp (Dan Ports)

Cc: dports@… added

Cc Me!

comment:66 Changed 15 years ago by Jens_Abraham@…

Cc: Jens_Abraham@… added

Cc Me!

comment:67 Changed 15 years ago by email@…

Cc: email@… added

Cc Me!

comment:68 Changed 15 years ago by sanssecours@…

Cc: sanssecours@… added

Cc Me!

comment:69 Changed 15 years ago by sanssecours@…

Cc: sanssecours@… removed

Cc Me!

comment:70 Changed 15 years ago by sanssecours@…

Cc: sanssecours@… added

Cc Me!

comment:71 Changed 15 years ago by erik@…

Cc: erik@… added

Cc Me!

comment:72 Changed 15 years ago by ecronin (Eric Cronin)

  • Some help for ghc users:

The latest 6.12.1 binary package (http://www.haskell.org/ghc/dist/6.12.1/) is fixed for snow leopard, but introduces some incompatibilities in the base libraries that make e.g. macports darcs not build.

The previous 6.10.4 binary package (http://www.haskell.org/ghc/dist/6.10.4/) doesn't work out of the .pkg on 10.6 because of the gcc architecture issue (see http://hackage.haskell.org/trac/ghc/ticket/3400). If you apply the 3 patches I'm attaching after you've installed the ghc 6.10.4 package it will work correctly on snow leopard. cd to /usr/bin first.

HACK TIME Because the binary package installs ghc in /usr/bin, macports can find it in its path. Therefore any port that has a build depend on ghc can be built using /usr/bin/ghc by replacing the dependency port:ghc with bin:ghc:ghc. assuming you know your way around $EDITOR, sudo port edit portname will open up the Portfile, where you can search for port:ghc and replace it. Because ghc has a runtime with it this is fragile and not the MacPorts way. As soon as the ghc port is fixed I strongly suggest anyone going down this route de-install the binary ghc package (sudo /Library/Frameworks/GHC.framework/Tools/Uninstaller) and rebuild any ports that depend on ghc.

  • some help for the maintainer:

modifying the leopard bootstrap ghc/hsc2hs the same way allows them to work fine on snowleopard. Copying the darwin 9 i386 block to darwin 10 i386 works fine.

The dependent libraries (gmp,ncurses,iconv) need to be installed +universal, there's no good way to enforce this though

ghc itself needs at least build_arch=i386 passed in, e.g. sudo port install ghc build_arch=i386, but there are some places in ./configure it's still using x64 gcc... I ran out of time to follow this path any further.

Changed 15 years ago by ecronin (Eric Cronin)

Attachment: usr-bin-ghc.patch added

patch for binary GHC 6.10.4 install (ghc)

Changed 15 years ago by ecronin (Eric Cronin)

Attachment: usr-bin-ghci.patch added

patch for binary GHC 6.10.4 install (ghci)

Changed 15 years ago by ecronin (Eric Cronin)

Attachment: usr-bin-hsc2hs.patch added

patch for binary GHC 6.10.4 install (hsc2hs)

comment:73 in reply to:  72 ; Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ecronin@…:

The dependent libraries (gmp,ncurses,iconv) need to be installed +universal, there's no good way to enforce this though

There's the archcheck portgroup. See how the wine-devel port does it.

comment:74 in reply to:  73 Changed 15 years ago by ecronin (Eric Cronin)

Replying to ryandesign@…:

There's the archcheck portgroup. See how the wine-devel port does it.

aha! I was trying to remember what port it was I'd recently installed that had similar i386-only requirements. I would definitely suggest using wine-devel as a template, since ghc will be 32-bit only for a while still it seems...

comment:75 Changed 15 years ago by mietek@…

Cc: mietek@… removed

Cc Me!

Changed 15 years ago by ecronin (Eric Cronin)

Attachment: lang-ghc.diff added

partial update to fix Snow Leopard compat

comment:76 Changed 15 years ago by ecronin (Eric Cronin)

I cleaned up my attempts at making the build from bootstrap work. It compiles the stage-1 ghc successfully, but then when it goes to build ghc using the stage-1 compiler instead of the bootstrap compiler it fails...

comment:77 Changed 15 years ago by mike@…

Cc: mike@… added

Cc Me!

comment:78 Changed 15 years ago by easye

Cc: easieste@… added

Cc Me!

comment:79 Changed 15 years ago by easye

Cc: easieste@… removed

Cc Me!

comment:80 Changed 15 years ago by macports@…

Cc: macports@… added

Cc Me!

comment:81 Changed 15 years ago by rs573@…

Cc: rs573@… added

Cc Me!

comment:82 Changed 15 years ago by larryv (Lawrence Velázquez)

Cc: larry.velazquez@… added

Cc Me!

comment:83 Changed 15 years ago by khalsah@…

Cc: khalsah@… added

Cc Me!

comment:84 Changed 15 years ago by h8spawn@…

Cc: h8spawn@… removed

Cc Me!

comment:85 Changed 15 years ago by tomas.znamenacek@…

Cc: tomas.znamenacek@… added

Cc Me!

comment:86 Changed 15 years ago by roland@…

Cc: roland@… added

Cc Me!

comment:87 Changed 15 years ago by sonicth

Cc: mike.vasiljevs@… added

Cc Me!

comment:88 Changed 15 years ago by gwright@…

OK, I seem to have 6.10.4 building completely on Snow Leopard now. However, there have been some odd crashes during the build. I've been building on Snow Leopard server running virtualized under VMware Fusion (for business reasons I can't yet switch my main machine to Snow Leopard). Nothing seems to stress Snow Leopard Server/VMWare liking building ghc --- sometimes the whole virtual machine will lock up.

So I am asking for help from someone who is running Snow Leopard natively and would like to try the port. Just leave a message on the bug report. Note that you should have some experience messing with Portfiles; this will require adding two additional ports required to get the bootstrap compiler running on Snow Leopard. It will also take three to six hours of build time, depending on the speed of your machine. If someone is interested, let me know.

comment:89 Changed 15 years ago by sanssecours@…

Cc: sanssecours@… removed

Cc Me!

comment:90 Changed 15 years ago by easye

Cc: easieste@… added

Cc Me!

comment:91 in reply to:  88 Changed 15 years ago by easye

Replying to gwright@…: ]

So I am asking for help from someone who is running Snow Leopard natively and would like to try the port. Just leave a message on the bug report. Note that you should have some experience messing with Portfiles; this will require adding two additional ports required to get the bootstrap compiler running on Snow Leopard. It will also take three to six hours of build time, depending on the speed of your machine. If someone is interested, let me know.

I have a MacBook Pro running Snow Leopard natively. GHC used to take a long time to build, so this might not be the fastest machine to help ou with. Where should I start? What are the two additional ports?

comment:92 Changed 15 years ago by mellon85@…

Cc: mellon85@… removed

Cc Me!

comment:93 in reply to:  88 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to gwright@…:

So I am asking for help from someone who is running Snow Leopard natively and would like to try the port. Just leave a message on the bug report.

I can give it a try.

comment:94 in reply to:  88 Changed 15 years ago by marco.comini@…

Replying to gwright@…:

So I am asking for help from someone who is running Snow Leopard natively and would like to try the port. Just leave a message on the bug report. Note that you should have some experience messing with Portfiles; this will require adding two additional ports required to get the bootstrap compiler running on Snow Leopard. It will also take three to six hours of build time, depending on the speed of your machine. If someone is interested, let me know.

I absolutely volunteer!

I have a (minimal) experience with portfiles (I wrote a couple for my personal use), could it suffice?

I have a Mac Pro 8/2.8. On leopard it took less than an hour with a make -j10 so I could do several tryouts, just let me know.

comment:95 Changed 15 years ago by gwright@…

OK, I will send tarballs with instructions to Ryan and Marco. I will have to upload the bootstrap compiler to the haskell.org web site. This might take a while. I should be able to email Ryan and Macro this evening with everything needed. Thanks.

comment:96 Changed 15 years ago by gwright@…

An update: there appears to still be a real bug in the code produced by the stage2 compiler (the haddock built by the stage2 compiler crashes with an abort trap).

The situation right now is the compiler build finishes, but some of the utilities built by the generated compiler crash. Some of the utilities seem to work, which suggests that the underlying problem is limited.

Thanks to Ryan Schmidt and Marco Comini for volunteering to test.

comment:97 Changed 15 years ago by gwright@…

Further update: ghc built to completion last night and seems to work. Today I will run the testsuite and it should be uploaded in the next day or two if everything tests OK.

There was in fact just one serious problem. I had made an error backporting the Makefile for the run time system from 6.12.1 to 6.10.4, which caused stack protection to be included. GHC does not use C style stack layout, and checking the stack canary caused a crash. Cleaning up a number of other warning messages over the weekend revealed this.

The snow leopard port uses a 6.10.4 bootstrap compiler built on Leopard. The portfile includes changes suggested by Ryan Schmidt who tested the earlier (buggy) version.

comment:98 Changed 15 years ago by nerdling (Jeremy Lavergne)

I can test your next round of changes: i've got intel 10.5 10.6 and ppc 10.5 platforms.

comment:99 Changed 15 years ago by jsg8pitt@…

Cc: jsg8pitt@… added

Cc Me!

comment:100 Changed 15 years ago by gwright@…

Cc: jsg8pitt@… removed

Further update: here's my plan. I've built the 32 bit version three times successfully now. I have also verified that I can build a 32 bit compiler with the 64 bit patches in place. Today I will test building the 64 bit version. I'd like to have the 64 bit version as the default. For users that need a 32 bit compiler (for example, to make binaries that will run both on Leopard and Snow Leopard) I will make a new port, ghc-sl32. You will be able to install both ports simultaneously. (My original idea of making a 32 bit compiler on Snow Leopard a variant made it impossible to have both compilers at the same time.)

As soon as I get access to the haskell ftp site I'll start having people test. The write permissions got changed on some of the directories and I can't upload the bootstrap compiler yet.

If anyone has a strong opinion about how to handle the 32/64 bit issue on SL, please attach a comment.

comment:101 Changed 15 years ago by sonicth

its good idea to have 64bit default - and perhaps its possible to have 32bit as a variant (selected automatically in 10.5?) I dont think anyone minds any more the overhead in size of the universal binaries, the only downside is waiting twice as much for compilation.

comment:102 Changed 15 years ago by gwright@…

You'll only get 64 bits on Snow Leopard; Leopard will only be 32 bits. So the default will be a compiler that builds the preferred native executable. The reason for having a 32 bit compiler on Snow Leopard is to generate binaries that will run on Leopard. If you generate a 64 bit executable, you'll only be able to run it on Snow Leopard.

Unfortunately, ghc's build system is fragile and can't handle things like a 64 bit compiler executable building 32 bit executable. At the moment, the only practical option is a 32 bit ghc executable that makes 32 bit binaries, or a 64 bit ghc executable that makes 64 bit binaries. My plan is to make the 64 bit ghc the default on Snow Leopard. I'll make a separate port for a 32 bit ghc generating 32 bit executables that is only for Snow Leopard. GHC by itself can not produce universal binaries.

comment:103 Changed 15 years ago by thomas.hutchinson@…

Cc: thomas.hutchinson@… added

Cc Me!

comment:104 in reply to:  102 Changed 15 years ago by macports.org@…

Replying to gwright@…:

You'll only get 64 bits on Snow Leopard; Leopard will only be 32 bits. So the default will be a compiler that builds the preferred native executable. The reason for having a 32 bit compiler on Snow Leopard is to generate binaries that will run on Leopard. If you generate a 64 bit executable, you'll only be able to run it on Snow Leopard.

That simply isn't true. OSX has been able to run CLI 64b processes since OSX 10.4 "Tiger" (by layering a 64b UNIX subsystem allowing 64b processes and servers on top of a 32b kernel), so unless you have a GUI (or are using new APIs), 64b processes will run without any issue on any Intel Mac running Tiger.

Leopard added support for 64b GUI software as long as it's Cocoa-based, and 10.6 moved the system, kernel, drivers and kernel extensions to 64b as well (optionally), and removed support for PPC machines.

comment:105 in reply to:  100 ; Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to mike.vasiljevs@…:

its good idea to have 64bit default - and perhaps its possible to have 32bit as a variant (selected automatically in 10.5?) I dont think anyone minds any more the overhead in size of the universal binaries, the only downside is waiting twice as much for compilation.

Variants are not the way we handle building for different architectures in MacPorts. We have the build_arch and universal_archs variables in macports.conf for that.

Replying to gwright@…:

I'd like to have the 64 bit version as the default. For users that need a 32 bit compiler (for example, to make binaries that will run both on Leopard and Snow Leopard) I will make a new port, ghc-sl32. You will be able to install both ports simultaneously. (My original idea of making a 32 bit compiler on Snow Leopard a variant made it impossible to have both compilers at the same time.)

Instead of making a separate ghc-sl32 port, can't you make the ghc port respect the build_arch and universal_archs variables and do it the way every other port in MacPorts does it?

comment:106 in reply to:  105 ; Changed 15 years ago by gwright@…

Replying to gwright@…:

I'd like to have the 64 bit version as the default. For users that need a 32 bit compiler (for example, to make binaries that will run both on Leopard and Snow Leopard) I will make a new port, ghc-sl32. You will be able to install both ports simultaneously. (My original idea of making a 32 bit compiler on Snow Leopard a variant made it impossible to have both compilers at the same time.)

Instead of making a separate ghc-sl32 port, can't you make the ghc port respect the build_arch and universal_archs variables and do it the way every other port in MacPorts does it?

No, it is unfortunately not yet possible to make ghc do this. The underlying problem is that ghc cooks its host platform into the code generator. You can't, for example, output 64 bit code using a ghc that was built as a 32 bit binary (and vice versa).

This is a known problem. An old cross-compilation system that never worked and has been ripped out. Parts of a new one are in 6.12.x, but are not working yet.

At the moment, the only way to generate binaries for both 32 and 64 bit platforms is to have two compilers.

I have mentioned these problems to the upstream maintainers and they have given it somewhat more attention of late. But most of their efforts are going to parallelism and type hackery.

comment:107 in reply to:  106 ; Changed 15 years ago by thomas.hutchinson@…

Replying to gwright@…:

Replying to gwright@…:

I'd like to have the 64 bit version as the default. For users that need a 32 bit compiler (for example, to make binaries that will run both on Leopard and Snow Leopard) I will make a new port, ghc-sl32. You will be able to install both ports simultaneously. (My original idea of making a 32 bit compiler on Snow Leopard a variant made it impossible to have both compilers at the same time.)

Instead of making a separate ghc-sl32 port, can't you make the ghc port respect the build_arch and universal_archs variables and do it the way every other port in MacPorts does it?

No, it is unfortunately not yet possible to make ghc do this. The underlying problem is that ghc cooks its host platform into the code generator. You can't, for example, output 64 bit code using a ghc that was built as a 32 bit binary (and vice versa).

This is a known problem. An old cross-compilation system that never worked and has been ripped out. Parts of a new one are in 6.12.x, but are not working yet.

At the moment, the only way to generate binaries for both 32 and 64 bit platforms is to have two compilers.

I have mentioned these problems to the upstream maintainers and they have given it somewhat more attention of late. But most of their efforts are going to parallelism and type hackery.

I think there is a miscommunication going on.

The idea is to have 32 bit functionality be in the main ghc port. It would be an exclusive choice. Either ghc is 32 bit or it's 64 bit. The ghc port would read the build_arch variable and act accordingly. The resulting compiler would (only) produce 32 bit or 64 bit binaries.

Maybe there is a detail of the ghc bootstrapping that I'm not understanding (or I simply misread the comments on this ticket). Still, a user should not have to install a different port.

Please note: there are many of us who use Snow Leopard on 32-bit architectures. For instance, I have a MacBook Pro with a Core Duo processor. It would be nice to be able to simply "sudo port install ghc".

I see that you are trying to be able to have both 32 and 64 bit versions be installed at the same time. Do any haskell ports need this? Are there ports of other compilers that have a similar layout?

It sounds like you are trying to solve a harder problem than necessary. Getting the ghc port working at all looks like difficult task. I think installing one "flavor" of ghc is sufficient. Maybe that's naïve of me.

comment:108 Changed 15 years ago by maik@…

Cc: maik@… removed

Cc Me!

comment:109 in reply to:  107 Changed 15 years ago by gwright@…

I think there is a miscommunication going on.

The idea is to have 32 bit functionality be in the main ghc port. It would be an exclusive choice. Either ghc is 32 bit or it's 64 bit. The ghc port would read the build_arch variable and act accordingly. The resulting compiler would (only) produce 32 bit or 64 bit binaries.

Maybe there is a detail of the ghc bootstrapping that I'm not understanding (or I simply misread the comments on this ticket). Still, a user should not have to install a different port.

Please note: there are many of us who use Snow Leopard on 32-bit architectures. For instance, I have a MacBook Pro with a Core Duo processor. It would be nice to be able to simply "sudo port install ghc".

The user will get a ghc the runs natively on his or her machine. What I'm wrestling with is how to provide a mechanism to produce universal binaries. Since the ghc compiler itself can only produce one kind binary, we need two compilers to do this (and you need to be running 64 bit Snow Leopard). As mentioned one of the previous comments, if you avoid GUI libraries and bundle up an app with the appropriate 64 bit libraries, you can run 64 bit code on a 32 bit platform. But this constraint is too stringent for general use.

With two compilers, at least it will be possible to build a universal binary. This is just the bare mechanism; the haskell ports in MacPorts won't be able to be built universal for a while.

It sounds like you are trying to solve a harder problem than necessary. Getting the ghc port working at all looks like difficult task. I think installing one "flavor" of ghc is sufficient. Maybe that's naïve of me.

As of this morning, I can build both 32 and 64 bit versions on Snow Leopard. The average user will get the correct ghc automatically. The hard part has always been making everything "just work" and hide the infelicities of the ghc build system.

comment:110 Changed 15 years ago by gwright@…

r64764 should make ghc on Snow Leopard. I'll leave the ticket open for a few days in case there are problems.

comment:111 in reply to:  110 Changed 15 years ago by rs573@…

Replying to gwright@…:

r64764 should make ghc on Snow Leopard. I'll leave the ticket open for a few days in case there are problems.

As of Wed 17 Mar 2010, I can confirm that ghc can be built on Snow Leopard.

Thanks.

comment:112 Changed 15 years ago by gwright@…

Resolution: fixed
Status: assignedclosed

I've reports of success on both 32 and 64 bit Snow Leopard, so I am closing this ticket. Thanks to all those who helped test, and to everyone for their patience.

Note: See TracTickets for help on using tickets.