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

Invoke a runghc for the execution platform in the cabal_wrapper #1510

Merged
merged 4 commits into from
Mar 19, 2021

Conversation

facundominguez
Copy link
Member

In this PR cabal_wrapper always uses a runghc binary from a toolchain that targets the execution platform. Otherwise, there would be no way to execute Setup.hs when cross-compiling.

Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows this fails with

runghc2.exe: C:\users\runneradmin\_bazel_runneradmin\z5des2pa\execroot\YOUR_PROJECT_NAME_HERE\bazel-out\host\bin\external\rules_haskell\haskell\ghc-stage2.exe: rawSystem: does not exist (No such file or directory)

I suspect the issue is that ctx.actions.symlink creates a copy instead of a symlink on Windows. (Symlinks not being available on Windows by default). runghc then tries to find GHC relative to itself and can't. One way to work around this would be to not create a symlink but a wrapper script that calls runghc. That will require two rules: One to generate the source file for the script and one sh_binary that makes the script executable.

haskell/private/runghc.bzl Outdated Show resolved Hide resolved
haskell/private/runghc.bzl Outdated Show resolved Hide resolved
@facundominguez facundominguez force-pushed the fd/runghc branch 2 times, most recently from 7d1c741 to 12d2fd6 Compare March 18, 2021 02:14
Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

haskell/cabal.bzl Outdated Show resolved Hide resolved
@facundominguez facundominguez merged commit bfafae0 into master Mar 19, 2021
@facundominguez facundominguez deleted the fd/runghc branch March 19, 2021 13:57
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

Successfully merging this pull request may close these issues.

2 participants