-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot build on Windows with GHC 9.4 #34
Conversation
I think there's a bug in CI that always installs and uses 9.4.7 |
I tried to compile ghcup with 9.4.7 and my impression so far is that it's completely busted. I'm getting things like |
@bgamari I don't really have the capacity to go through GHC issue tracker. Is this tracked anywhere? 9.4 is effectively broken on windows. Are GHC devs aware? |
The switch to clang did cause a few bug reports to get opened for 9.4. Most have been fixed already. But I don't think this one has been brought to GHC's attention. It might be good if someone could open a ticket. |
@hasufell I can't reproduce your failure, do you have a reproducer? Is cabal generating the macros? I can reproduce the original failure, which seems to be a bug in c2hs. Here is the bit of the header file it chokes on: static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CAST
_castf64_u64(double __A) {
return __builtin_bit_cast(unsigned long long, __A);
} |
I can't at the moment either. I reinstalled ghcup on windows, which performed a new and updated msys2 installation. Maybe some older msys2 fails with newer GHC? |
That seems plausible. ghcup should not be using the same toolchain across different GHC versions. |
What? |
It is incorrect to set up one single toolchain to be shared by multiple different versions of GHC, as GHCup currently does. |
I'm not sure what you mean with that really or how you envision to manage msys2. Please be more specific. Are you saying that every specific GHC version only works with a specific range of msys2 versions? If so, it's the obligation of GHC devs to provide a table for this compatibility. Otherwise, I'm not sure what you mean. |
Every windows GHC bindist ships with a toolchain it is guaranteed to work for. GHCup should be using the toolchain that the particular GHC version shipped with. This is probably not the right place for this discussion. |
Yeah, I think you're misunderstanding how things work on windows. We're not overwriting the GHC shipped toolchain. Msys2 is installed by chocolatey and stack and ghcup exactly once to install system packages, support autoconf based setups etc. |
If I understand correctly, this isn't a GHC bug. It looks to me like is another case of the root cause of haskell/c2hs#268. Specifically |
I don't know much about c2hs, but why does it not surface with older GHCs then? |
Presumably because the headers provided with older GHC toolchains don't rely on syntax outside of the dialect understood by |
I see. So I guess c2hs could blame GHC for using an unsupported dialect and GHC can blame c2hs for being an incomplete C parser ;) This is an unfortunate coupling. |
Can we try this as a stop gap? haskell/c2hs#291 (comment) |
Yes, the whole situation is generally unfortunate. haskell/c2hs#291 (comment) does seem like a plausible workaround. A better approach would arguably be to add support for Ultimately, I think it would be even better if |
@bgamari I used to use ghcup as a test case for whether a GHC is recommendable: can I build ghcup with that GHC on all platforms? If I can't (even if it's a libraries fault), I'd tilt towards "no". I'm not sure what GHC itself can do about that situation. |
@bgamari While your point is well taken in this case |
The C standard specifies that identifiers starting with double-underscores are reserved for definition by the implementation. While |
I can confirm that this package builds with a |
With
See https://github.com/Bodigrim/libarchive/actions/runs/7595352273/job/20687816483 @bgamari any ideas? |
Does cleaning your cabal store and |
@bgamari feel free to fork my repo and rerun GitHub actions in your fork. If it helps then it has something to do with caching of environment. I don't have a local Windows machine at the moment. |
I'll have a look. Thanks @Bodigrim ! |
I can replicate the failures observed by @Bodigrim in my own workflow. Additionally, inspection of both logs confirms that there is no caching involved. Moreover, the issue is far from specific to GHC 9.4; the build fails all the way back to 8.10.7. |
Unfortunately, I am unable to reproduce this in any of my local test environments. These include:
|
@bgamari maybe because the fix has been released? https://hackage.haskell.org/package/language-c-0.9.3/changelog |
I was referring to the linking issues noted by @Bodigrim, which I don't believe are related to the |
Apparently the issue is with Cabal 3.6.2.0. Bumping it to 3.10.2.1 fixes CI. Closing, thanks all. |
As witnessed by CI at https://github.com/Bodigrim/libarchive/actions/runs/6605253232/job/17940229969#step:14:124:
This is presumably because starting from 9.4 GHC uses clang instead of gcc on Windows, thus different headers, which
c2hs
is incapable to deal with.One might hit this issue by building
ghcup
on Windows with GHC 9.4. CC @hasufell.I assume that this actually a general issue with
c2hs
. CC @deech.