Skip to content
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

futhark does not compile on windows #832

Closed
flip111 opened this issue Jan 16, 2020 · 17 comments
Closed

futhark does not compile on windows #832

flip111 opened this issue Jan 16, 2020 · 17 comments

Comments

@flip111
Copy link

flip111 commented Jan 16, 2020

See
futhark_build.txt notable line:

C:\sr\snapshots\9bcf929c\lib\x86_64-windows-ghc-8.8.1\haskell-src-exts-1.22.0-620ASTx4cKYEetyTEBU7vQ\HShaskell-src-exts-1.22.0-620ASTx4cKYEetyTEBU7vQ.o: unhandled PEi386 relocation type 0

This looks to be similar to digital-asset/ghc-lib#142

@athas
Copy link
Member

athas commented Jan 16, 2020

Looks like this is fixed in GHC 8.8.2, which came out today. I'll update the stack.yaml snapshot when one becomes available.

@flip111
Copy link
Author

flip111 commented Jan 17, 2020

230b799 (16 Oct 2019) is the latest working version at the moment

@athas
Copy link
Member

athas commented Jan 26, 2020

The new stack snapshot uses GHC 8.8.2. Could you check whether it fixes it for you?

@flip111
Copy link
Author

flip111 commented Jan 26, 2020

Unfortunately it's not fixed with the new nightly.

@athas
Copy link
Member

athas commented Jan 26, 2020

Drat. This is a GHC bug, and I really am not very familiar with its code (least of all its Windows runtime). I suggest reporting it on the GHC bug tracker.

@flip111
Copy link
Author

flip111 commented Jan 26, 2020

There is a ticket for it here https://gitlab.haskell.org/ghc/ghc/issues/17599

@flip111
Copy link
Author

flip111 commented Jan 27, 2020

Looks like a fix didn't get in 8.8.2 after all. Need to wait until the next release

@athas
Copy link
Member

athas commented Jan 27, 2020

I see. Thanks for looking into this!

@reversefold
Copy link

I also ran into this. The fix is supposedly in master of GHC 8.8 so should be in GHC 8.8.3.

In the meantime, no futhark version higher than 0.12.1 will compile on windows. (I just tested 0.12.1 and it does finish compiling at least.)

@athas Is there a way we could use a GHC 8.8.x nightly build or something to get around the issue? I'm not familiar with haskell, ghc, or stack myself, I'm new to this and trying out futhark.

@athas
Copy link
Member

athas commented Mar 10, 2020

Futhark can as of recently also be built with cabal, although I have yet to document it. If you manually install a sufficiently new GHC (that is, 8.8.3) and the cabal command line tool, you should be able to do cabal install. By default, I think cabal will put the binaries somewhere nonobvious, but it will tell you where so you can fish them out.

I think installing the core Haskell Platform will get you everything you need.

@reversefold
Copy link

The Haskell Platform is still 8.6.5, so that doesn't really help unfortunately.

@athas
Copy link
Member

athas commented Mar 10, 2020

Can you install the 8.8.3 Windows GHC binary directly? It's also installable via Chocolatey.

In fact, I'm setting up some Windows CI on Azure pipelines right this moment, because I guess it's time we start taking it seriously again. I use Chocolatey there.

@reversefold
Copy link

reversefold commented Mar 10, 2020

I tried getting ghc 8.8.3 and cabal 3.0 manually but then realized they were in chocolatey. Those installed fine.

Combining those with the haskell platform's mingw and msys (via path) I was able to get the build started but I'm still getting some errors. Oddly it's saying that futhark is 0.12.1, but this appears to be in futhark.cabal file.

PS C:\Users\paper\Dropbox\futhark-windows\futhark> cabal build
Warning: Requested index-state2020-02-05T00:00:00Z is newer than
'hackage.haskell.org'! Falling back to older state (2020-02-04T23:36:26Z).
Resolving dependencies...
Build profile: -w ghc-8.8.3 -O1
In order, the following will be built (use -v for more details):
 - futhark-0.12.1 (lib) (first run)
 - futhark-0.12.1 (exe:futhark) (first run)
Configuring library for futhark-0.12.1..
Preprocessing library for futhark-0.12.1..
cabal.exe: can't find source for Futhark\CodeGen\ImpGen\Kernels\SegGenRed in
src,
C:\Users\paper\Dropbox\futhark-windows\futhark\dist-newstyle\build\x86_64-windows\ghc-8.8.3\futhark-0.12.1\build\autogen,
C:\Users\paper\Dropbox\futhark-windows\futhark\dist-newstyle\build\x86_64-windows\ghc-8.8.3\futhark-0.12.1\build\global-autogen

cabal.exe: Failed to build futhark-0.12.1 (which is required by exe:futhark
from futhark-0.12.1).

@athas
Copy link
Member

athas commented Mar 10, 2020

Bizarrely, that looks like it's using an old .cabal file (those are automatically generated from package.yaml). I've been considering for a file whether to go back to explicit .cabal files, and I guess this pushesd me over the edge (especially since there is no hpack in Chocolatey).

Try the use-cabal-file branch, which has an explicit futhark.cabal.

@reversefold
Copy link

This happened because I has previously checked out the v0.12.1 tag and tried to build. git clean wouldn't delete the file and I didn't see it in the .gitignore but I'm guessing those first few lines might have been ignoring it....

I deleted the futhark.cabal, modified stack.yaml to have resolver: ghc-8.8.3 and tried some more combinations of cabal build and stack build, modifying stack.yaml to add a bunch of entries to extra-deps per the output.

Eventually I somehow made it into a state where cabal build worked for me and built a futhark.exe in dist-newstyle\build\x86_64-windows\ghc-8.8.3\futhark-0.15.0\x\futhark\build\futhark\futhark.exe

At this point I'm going to try to use this build (later today, though) and see if it works for me.

@athas
Copy link
Member

athas commented Mar 10, 2020

Good you got it working. Stack also just (today) released the first snapshot with GHC 8.8.3, which I have upgraded to in master.

@athas
Copy link
Member

athas commented Mar 31, 2020

The Azure CI now also compiles Futhark on Windows (with cabal and GHC 8.10.1). GHC also seems to be taking testing on Windows a bit more seriously, so hopefully the constant breakage will stop.

@athas athas closed this as completed Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants