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

ExitFailure at src/HIE/Bios/Cradle.hs #45

Closed
K0Te opened this issue Sep 17, 2019 · 18 comments
Closed

ExitFailure at src/HIE/Bios/Cradle.hs #45

K0Te opened this issue Sep 17, 2019 · 18 comments

Comments

@K0Te
Copy link

K0Te commented Sep 17, 2019

I've tried following blog-post https://chrispenner.ca/posts/hie-core to setup HIE in Sublime text, but setup result in hie-bios raising error without any extra info:

 ◌ :
        1:1   	compiler    	error     	(ExitFailure 1,"","")
             	            	          	CallStack (from HasCallStack):
             	            	          	  error, called at src/HIE/Bios/Cradle.hs:217:18 in hie-bios-0.1.1-7daBaOW11mp8owawn8j60h:HIE.Bios.Cradle

LSP config in sublime:

		"hie":
		{
			"command":
			[
				"stack",
				"exec",
				"hie-core",
				"--",
				"--lsp",
				"--cwd",
				"."
			],
			"enabled": false,
			"languageId": "haskell",
			"scopes":
			[
				"source.haskell"
			],
			"syntaxes":
			[
				"Packages/Haskell/Haskell.sublime-syntax"
			]
		},

Please advise how to get any extra info. I've added simple hie.yaml to root of the project, but this does not help: cradle: {stack}

@mpickering
Copy link
Collaborator

Is stack on your path?

What happens if you run hie-core in the root of your project?

Perhaps you meant ghcide rather than hie-core in your sublime config?

@K0Te
Copy link
Author

K0Te commented Sep 17, 2019

Yes, stack ghc/ghci works fine, directly running hie-core:

$ stack exec hie-core
Starting hie-core (GHC v8.6)
/Users/kote/hsbackend
[1/6] Finding hie-bios cradle
Cradle {cradleRootDir = "/Users/kote/hsbackend", cradleOptsProg = CradleAction: stack}

[2/6] Converting Cradle to GHC session
#!/usr/bin/env bash
if [ "$1" == "--interactive" ]; then
  pwd
  echo "$@"
else
  ghc "$@"
fi

hie-core: (ExitFailure 1,"","")
CallStack (from HasCallStack):
  error, called at src/HIE/Bios/Cradle.hs:217:18 in hie-bios-0.1.1-7daBaOW11mp8owawn8j60h:HIE.Bios.Cradle

Just an idea - maybe issue happens because I use docker-based build in stack:

$ cat stack.yaml
resolver: lts-14.6

allow-newer: true
docker:
    enable: true

packages: [.]
...

@mpickering
Copy link
Collaborator

Maybe the issue is that you don't have ghc on your path?

We need to fix this situation but for now, you need ghc on your path.

@K0Te
Copy link
Author

K0Te commented Sep 17, 2019

I have older GCH in $PATH:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.4.3
$ stack ghc --  --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5

Should I have same GHC that is used to build project ?
AFAIU with docker+stack, all dependencies will be inside of docker, so maybe some dependencies are also missing locally. Also even produced binaries can be incompatible, so that I cannot run results of stack build directly on local OS, but they can be deployed in compatible container:

$ file .stack-work/dist/x86_64-linux-dkda49f7ca9b244180d3cfb1987cbc9743/Cabal-2.4.0.1/build/periodic/periodic
.stack-work/dist/x86_64-linux-dkda49f7ca9b244180d3cfb1987cbc9743/Cabal-2.4.0.1/build/periodic/periodic: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=43f95c5c3ebd6ad7f5af39f7c4687cc4f005f549, with debug_info, not stripped
$ .stack-work/dist/x86_64-linux-dkda49f7ca9b244180d3cfb1987cbc9743/Cabal-2.4.0.1/build/periodic/periodic
-bash: .stack-work/dist/x86_64-linux-dkda49f7ca9b244180d3cfb1987cbc9743/Cabal-2.4.0.1/build/periodic/periodic: cannot execute binary file
$ stack exec periodic
$ echo $?
0

@mpickering
Copy link
Collaborator

I'm not sure what your exact issue is but I don't expect things to work for you right now anyway.

@madgen
Copy link

madgen commented Sep 17, 2019

I have the same problem (slightly different location).

$ stack exec -- ghcide
Starting ghcide (GHC v8.6)
~/p/haskell/verified-leftist-heap
[1/6] Finding hie-bios cradle
Cradle {cradleRootDir = "~/p/haskell/verified-leftist-heap", cradleOptsProg = CradleAction: stack}

[2/6] Converting Cradle to GHC session
ghcide: (ExitFailure 1,"","")
CallStack (from HasCallStack):
  error, called at src/HIE/Bios/Cradle.hs:241:18 in hie-bios-0.1.1-DmIjTbjtu5iGixdjhE06h7:HIE.Bios.Cradle

If I run ghcide without hie.yaml, it just complains about imports that it can't find.

$ stack exec -- ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5

The project is a single file with stack script at the top of it and it works if I just do stack <filename>. The top line of the file

#!/usr/bin/env stack
-- stack script --resolver lts-14.6 --package QuickCheck --ghc-options -Wall

@mpickering
Copy link
Collaborator

@madgen So to be clear, it's not a normal *.cabal package but just a single file?

I'm not sure that is supported (yet?).

@madgen
Copy link

madgen commented Sep 17, 2019

@mpickering Yup, just a single file. What is the minimum modification you think I'd need to make it work (given that I'm running it with stack)?

@mpickering
Copy link
Collaborator

Briefly reading the stack documentation I don't see any way to query stack to tell us what options it would use to load the script. If there is such a way then we could maybe add support for stack scripts as well.

@madgen
Copy link

madgen commented Sep 17, 2019

@mpickering Sorry, that's not what I meant (though clearly that's what is needed to solve it for good). I meant should I create a stack.yaml or package.yaml or a *.cabal file to get around the problem for now for this specific project?

@mpickering
Copy link
Collaborator

If you create a normal stack project or normal cabal project then it should work fine.

@madgen
Copy link

madgen commented Sep 17, 2019

Alright, thanks Matthew!

@domenkozar
Copy link

domenkozar commented Oct 17, 2019

I'm getting the same error from hie-bios-0.2.1, while running stack manually gets me:

$ stack build
Cabal file info not found for katip-0.7.0.0@sha256:a130d70f7165c0a35396bed70f0f21f34fb07724f8b48b5370e30bda26d3e25f, updating
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Downloading timestamp
No package index update available and cache up to date
Package index cache populated
Could not find katip-0.7.0.0@sha256:a130d70f7165c0a35396bed70f0f21f34fb07724f8b48b5370e30bda26d3e25f on Hackage
The specified revision was not found.
Possible candidates: katip-0.7.0.0@sha256:4b30d0643e18d01a3fd264d3d75921b49b2f464336a52fa46fa049107ebbfe04,4272, katip-0.7.0.0@sha256:171304c72f39e1856709e1b575c7585d56a1774a03c15ef48c89d2b26350f4d3,4443.

@domenkozar
Copy link

domenkozar commented Oct 17, 2019

Removing --silent in https://github.com/mpickering/hie-bios/blob/master/src/HIE/Bios/Cradle.hs#L370 doesn't help, as that changes stderr AND stdout.

@domenkozar
Copy link

@mpickering another hack I can think of is running stack twice, once for parsing with --silent and if that fails, again to get the error. Hoping it's idempotent.

@mpickering
Copy link
Collaborator

I think a more robust way would be to bake a filepath into the wrapper when it is created so the wrapper can write the arguments to a file which is then read by hie-bios. Then the commands can run at full verbosity. What do you think?

@domenkozar
Copy link

Sounds much better.

@fendor
Copy link
Collaborator

fendor commented Jan 27, 2020

This issue can be closed now, afaict.
The initial issue has been solved and the other two rather unrelated issues are also solved. Feel free to reopen, but if it is not related to the initial issue, please open a new issue :)

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

5 participants