Skip to content

Support for cabal as script interpreter for windows #6122

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

Closed
jneira opened this issue Jul 1, 2019 · 2 comments
Closed

Support for cabal as script interpreter for windows #6122

jneira opened this issue Jul 1, 2019 · 2 comments

Comments

@jneira
Copy link
Member

jneira commented Jul 1, 2019

Describe the bug
Attempting to use cabal as script interpreter seems to not work in windows, even using mingw64 shell

To Reproduce
Steps to reproduce the behavior:
Create a test.hs file:

#!/usr/bin/env cabal
{- cabal:
with-compiler: ghc-8.6.5
build-depends: base
-}

main :: IO()
main = putStrLn "Interpret me please"
  • Run cabal v2-run test.hs command in a dos shell
  • Or run ./test.hs in a mingw shell

Expected behavior

The script should be interpreted and show the message

Actual behavior

  • cabal throws an error:
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
 - fake-package-0 (exe:script) (configuration changed)
Configuring executable 'script' for fake-package-0..
Preprocessing executable 'script' for fake-package-0..
Building executable 'script' for fake-package-0..
[1 of 1] Compiling Main             ( Main.hs, \path\to\test-interpreter\di
st-newstyle\build\x86_64-windows\ghc-8.6.5\fake-package-0\x\script\build\script\
script-tmp\Main.o )

Main.hs:1:1: error:
    Could not load module ‘Prelude’
    It is a member of the hidden package ‘base-4.12.0.0’.
    Perhaps you need to add ‘base’ to the build-depends in your .cabal file.ile.
    it is a hidden module in the package ‘hackage-security-0.5.3.0’
    Use -v to see a list of the files searched for.
  |
1 | {- cabal:
  | ^

System informataion

  • Windows
  • cabal
cabal-install version 2.4.1.0
compiled using version 2.4.1.0 of the Cabal library
  • ghc, any, tested with 8.6.5

Additional context

Trying to build haskell-ide-engine with cabal, using the script feature: haskell/haskell-ide-engine#1221

@hvr
Copy link
Member

hvr commented Jul 1, 2019

@jneira can you try with either cabal HEAD, or with the tip of the 2.4 branch? As you can see from https://github.com/haskell/cabal/blob/2.4/cabal-install/changelog there were a couple fixes done for a cabal 2.4.2 point release which might fix your issue

possible duplicate of #5775

@jneira
Copy link
Member Author

jneira commented Jul 1, 2019

Arrgh i cant believe i missed that one in my search, sorry for that.
Trying with cabal built from 2.4 branch works as expected.
Thanks for the point, closing this as duplicate of #5775

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants