GHC on mingw-w64 / gcc 4.8.3 on Windows

The patch to migrate to mingw-w64 / gcc 4.8.3 is finally starting to look reasonable (Phab:D339 https://phabricator.haskell.org/D339). Whew! The part about downloading the tarball was relatively straightforward, but the mingw migration has been really tricky, in part due to the gcc version bump, but mostly, I think, due to use of mingw-w64 on i686 as well (which is a supported configuration). In particular, "#define _MSVCRT_ 1" took ages to figure out after digging through heaps of headers and weird errors. I am not sure I would have signed on if I had an idea of how much effort this needed... Jeez. On the bright side, now that we have standartised on mingw-w64, further gcc version upgrades should be relatively straightforward. Could people with some experience in Windows matters take a look at the patch? In particular, rts/Linker.c has been a problem; my fixes there seem to work but I have no idea if the approach is right (the whole file does seem like a grabbag of ad-hocness though). The patch also could use some more testing (both for x86 and for x86-64). There are still some validate.sh failures (although I am actually seeing fewer than with the legacy setup), some of which could probably be fixed easily. Some additional eyes and fingers on keyboards would be very welcome there. If you want to experiment with the patch, make sure to also patch in the related changes listed in the last comment on the Phab page. -- Gintautas Miliauskas

Ah, Gintautas! Since I don't follow Phabricator I didn't even suspect you are making all this work. I had a patch to migrate to mingw-w64 gcc 4.8.x (and even 4.9.x, which requires extra runtime linker support) both for 64-bit and 32-bit for more than half of the year already. That patch is not such a thorough as yours is (I didn't bother with downloading the tarball and all that stuff), but regarding Linker.c I think it is perhaps more systematic than yours. Why I didn't exposed it to a broad audience was that I believed there was not much interest and also because starting at some moment I didn't bother to maintain several patches per issue and combined them in one big patch (including some nonportable things) and I didn't want to spend a time to break it apart to per-issue parts. During a couple of days I'll extract my patch to Linker.c and put it to Phabricator then, and also I'll comment on Linker.c issues. Btw, I wonder what the problem does "#define _MSVCRT_ 1" solve? I didn't need it at all (I never run validate.sh though). Cheers, Kyra On 10/27/2014 12:54 AM, Gintautas Miliauskas wrote:
The patch to migrate to mingw-w64 / gcc 4.8.3 is finally starting to look reasonable (Phab:D339 https://phabricator.haskell.org/D339). Whew!
The part about downloading the tarball was relatively straightforward, but the mingw migration has been really tricky, in part due to the gcc version bump, but mostly, I think, due to use of mingw-w64 on i686 as well (which is a supported configuration). In particular, "#define _MSVCRT_ 1" took ages to figure out after digging through heaps of headers and weird errors. I am not sure I would have signed on if I had an idea of how much effort this needed... Jeez.
On the bright side, now that we have standartised on mingw-w64, further gcc version upgrades should be relatively straightforward.
Could people with some experience in Windows matters take a look at the patch? In particular, rts/Linker.c has been a problem; my fixes there seem to work but I have no idea if the approach is right (the whole file does seem like a grabbag of ad-hocness though).
The patch also could use some more testing (both for x86 and for x86-64). There are still some validate.sh failures (although I am actually seeing fewer than with the legacy setup), some of which could probably be fixed easily. Some additional eyes and fingers on keyboards would be very welcome there.
If you want to experiment with the patch, make sure to also patch in the related changes listed in the last comment on the Phab page.
-- Gintautas Miliauskas
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

Since I don't follow Phabricator I didn't even suspect you are making all this work.
Yes, looks like I undercommunicated, sorry about that. I started off with the patch to download the tarballs and just went ahead for standartising of mingw-w64 without quite realising how involved that would be (I expected only a few compilation errors...).
I had a patch to migrate to mingw-w64 gcc 4.8.x (and even 4.9.x, which requires extra runtime linker support) both for 64-bit and 32-bit for more than half of the year already. That patch is not such a thorough as yours is (I didn't bother with downloading the tarball and all that stuff), but regarding Linker.c I think it is perhaps more systematic than yours.
Yes, your patch looks much better. I've integrated it and running tests on 64-bit and 32-bit as we speak. Will keep you posted.
Why I didn't exposed it to a broad audience was that I believed there was not much interest and also because starting at some moment I didn't bother to maintain several patches per issue and combined them in one big patch (including some nonportable things) and I didn't want to spend a time to break it apart to per-issue parts.
Most of the prerequisite auxiliary fixes should be in now; the non-backwards compatible ones are part of D339.
During a couple of days I'll extract my patch to Linker.c and put it to Phabricator then, and also I'll comment on Linker.c issues.
Sounds good. By the way, you attached a patch to #9218 https://ghc.haskell.org/trac/ghc/ticket/9218#comment:14; should I consider that an up-to-date version of your proposed change, or should I wait a few days more? Btw, I wonder what the problem does "#define _MSVCRT_ 1" solve? I didn't
need it at all (I never run validate.sh though).
Without it I think I got a bunch of conflicting export definitions from the C library, and removing the ones in Linker.c resulted in runtime crashes. Not quite sure what was going on there. Probably issues due to my patch being rather ad-hoc. -- Gintautas Miliauskas

Hello *, On 2014-10-27 at 11:37:01 +0100, Gintautas Miliauskas wrote:
Since I don't follow Phabricator I didn't even suspect you are making all this work.
Yes, looks like I undercommunicated, sorry about that.
In the hopes to aid with communication, I've just created a "GHC Windows Task Force" Team/Project in Phab: https://phabricator.haskell.org/project/view/11/ Assuming you make use of this, you can reference the group of people that are part of that "project" by simply using of its associated hash-tags like e.g. `#ghc_windows_task_force` (or a bit easier its abbreviation `#ghc-wtf`, we can add additional ones at well) in place of a user-name. So, if everyone interested in keeping the Windows platform working by code-reviewing would join the the "GHC Windows Task Force" Phab group, he/she could get CC'ed everytime there's the suspicion a patch may affect compilation on windows and may benefit from additional eyes... HTH, hvr

On 10/27/2014 1:37 PM, Gintautas Miliauskas wrote:
During a couple of days I'll extract my patch to Linker.c and put it to Phabricator then, and also I'll comment on Linker.c issues.
Sounds good. By the way, you attached a patch to #9218 https://ghc.haskell.org/trac/ghc/ticket/9218#comment:14; should I consider that an up-to-date version of your proposed change, or should I wait a few days more?
The last GHC built with this patch applied was x86_64 ghc-7.9.20140917. I had no problems with that build. I've made only the minor modification today (20141027) to let it apply to today's HEAD cleanly. The last 32-bit build was made 4-6 month ago perhaps. I have no much time to test this patch agaings today's HEAD, so I would greatly appreciate if you consider this as a final version (and report the problems if any). Cheers, Kyra

The patch looks good both on i686 and x86_64. Cool stuff!
On Mon, Oct 27, 2014 at 12:01 PM, kyra
On 10/27/2014 1:37 PM, Gintautas Miliauskas wrote:
During a couple of days I'll extract my patch to Linker.c and put it to Phabricator then, and also I'll comment on Linker.c issues.
Sounds good. By the way, you attached a patch to #9218 < https://ghc.haskell.org/trac/ghc/ticket/9218#comment:14>; should I consider that an up-to-date version of your proposed change, or should I wait a few days more?
The last GHC built with this patch applied was x86_64 ghc-7.9.20140917. I had no problems with that build.
I've made only the minor modification today (20141027) to let it apply to today's HEAD cleanly.
The last 32-bit build was made 4-6 month ago perhaps.
I have no much time to test this patch agaings today's HEAD, so I would greatly appreciate if you consider this as a final version (and report the problems if any).
Cheers, Kyra
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
-- Gintautas Miliauskas
participants (4)
-
Gintautas Miliauskas
-
Gintautas Miliauskas
-
Herbert Valerio Riedel
-
kyra