haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 211 forks source link

[ERROR] hie: panic! planPackages.mkPackage: Got non-unpacked package src! #1621

Closed GavinRay97 closed 4 years ago

GavinRay97 commented 4 years ago

If anyone has ideas, I would be super grateful. I am attempting to learn Haskell for the first time, and without something like HIE to hold my hand a bit it is going to be a much more difficult task.

The process I went through was was:

However, when opening a Haskell file, I get this:

image

Looking at the debug log, I found:

image

The project I was attempting to use this with is cabal.project-based, if that helps any.

https://github.com/hasura/graphql-engine/tree/master/server

I am going to try building from source rather than Nix a shot. Seems as though it will take a while but its the only idea I have left :man_shrugging:

fendor commented 4 years ago

First test is to see, what is the output of cabal build? Does it build without any warnings? You should also enable more logs. In vscode, that works over extensions > Haskell Language Server > Tracing or something similar and set it to Trace. Also, modify your env to define an environment variable CABAL_HELPER_DEBUG=3

As a work-around, you may check out the definition of a hie.yaml file. Examples can be found at https://github.com/haskell/haskell-ide-engine#project-configuration and an example for hie: https://github.com/haskell/haskell-ide-engine/blob/master/hie.yaml.cbl

GavinRay97 commented 4 years ago

@fendor

What is the output of cabal build?

(base) user@machine:~/Projects/hasura-graphql-engine/server$ cabal build
Warning: The build command is a part of the legacy v1 style of cabal usage.

Please switch to using either the new project style and the new-build command
or the legacy v1-build alias as new-style projects will become the default in
the next version of cabal-install. Please file a bug if you cannot replicate a
working v1- use case with the new-style commands.

For more information, see: https://wiki.haskell.org/Cabal/NewBuild

Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
[__0] trying: graphql-engine-1.0.0 (user goal)
[__1] unknown package: zlib (dependency of graphql-engine)
[__1] fail (backjumping, conflict set: graphql-engine, zlib)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: graphql-engine, zlib
Trying configure anyway.
Configuring graphql-engine-1.0.0...
cabal: Encountered missing dependencies:
QuickCheck -any,
Spock-core -any,
aeson -any,
aeson-casing -any,
ansi-wl-pprint -any,
asn1-encoding -any,
asn1-types -any,
async -any,
attoparsec -any,
attoparsec-iso8601 >=1.0,
auto-update -any,
base64-bytestring >=1.0,
byteorder -any,
case-insensitive -any,
ci-info -any,
cryptonite -any,
data-has -any,
dependent-map >=0.2.4 && <0.4,
dependent-sum ==0.4.*,
ekg-core -any,
ekg-json -any,
fast-logger -any,
file-embed -any,
generic-arbitrary -any,
graphql-parser -any,
hashable -any,
http-client -any,
http-client-tls -any,
http-types -any,
insert-ordered-containers -any,
jose -any,
lens -any,
lifted-async -any,
lifted-base -any,
list-t -any,
mime-types >=0.1,
monad-control -any,
monad-time -any,
monad-validate -any,
mustache -any,
network -any,
network-uri -any,
optparse-applicative -any,
pem -any,
pg-client -any,
postgresql-binary -any,
postgresql-libpq -any,
profunctors -any,
psqueues >=0.2,
regex-tdfa >=1.2,
scientific -any,
semver -any,
shakespeare >=2.0.22,
split -any,
stm-containers -any,
string-conversions -any,
text-builder >=0.6,
text-conversions -any,
th-lift-instances -any,
these >=0.7.1 && <0.8,
transformers-base -any,
unordered-containers -any,
uri-encode -any,
uuid -any,
vector -any,
wai -any,
wai-websockets -any,
warp -any,
websockets -any,
wreq -any,
x509 -any,
yaml -any,
zlib -any

However, cabal new-build seems to run just fine:

(base) user@machine:~/Projects/hasura-graphql-engine/server$ cabal new-build
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
 - graphql-engine-1.0.0 (lib) (first run)
 - graphql-engine-1.0.0 (exe:graphql-engine) (first run)
Preprocessing library for graphql-engine-1.0.0..
Building library for graphql-engine-1.0.0..
[113 of 162] Compiling Hasura.GraphQL.Schema.BoolExp ( src-lib/Hasura/GraphQL/Schema/BoolExp.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Schema/BoolExp.o )
[114 of 162] Compiling Hasura.GraphQL.Schema.Select ( src-lib/Hasura/GraphQL/Schema/Select.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Schema/Select.o )
[115 of 162] Compiling Hasura.GraphQL.Schema.Function ( src-lib/Hasura/GraphQL/Schema/Function.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Schema/Function.o )
[116 of 162] Compiling Hasura.GraphQL.Schema.Mutation.Update ( src-lib/Hasura/GraphQL/Schema/Mutation/Update.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Schema/Mutation/Update.o )
[117 of 162] Compiling Hasura.GraphQL.Schema.Mutation.Insert ( src-lib/Hasura/GraphQL/Schema/Mutation/Insert.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Schema/Mutation/Insert.o )
[118 of 162] Compiling Hasura.GraphQL.Schema.Mutation.Delete ( src-lib/Hasura/GraphQL/Schema/Mutation/Delete.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Schema/Mutation/Delete.o )
[119 of 162] Compiling Hasura.GraphQL.Resolve.BoolExp ( src-lib/Hasura/GraphQL/Resolve/BoolExp.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Resolve/BoolExp.o )
[120 of 162] Compiling Hasura.GraphQL.Schema ( src-lib/Hasura/GraphQL/Schema.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Schema.o )
[121 of 162] Compiling Hasura.RQL.DDL.Schema.Function ( src-lib/Hasura/RQL/DDL/Schema/Function.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Schema/Function.o )
[122 of 162] Compiling Hasura.RQL.DDL.ComputedField ( src-lib/Hasura/RQL/DDL/ComputedField.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/ComputedField.o )
[123 of 162] Compiling Hasura.RQL.Types.Catalog ( src-lib/Hasura/RQL/Types/Catalog.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/Types/Catalog.o )
[124 of 162] Compiling Hasura.RQL.DDL.Schema.Diff ( src-lib/Hasura/RQL/DDL/Schema/Diff.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Schema/Diff.o )
[125 of 162] Compiling Hasura.RQL.DDL.Schema.Cache.Common ( src-lib/Hasura/RQL/DDL/Schema/Cache/Common.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Schema/Cache/Common.o )
[126 of 162] Compiling Hasura.RQL.DDL.Schema.Cache.Permission ( src-lib/Hasura/RQL/DDL/Schema/Cache/Permission.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Schema/Cache/Permission.o )
[127 of 162] Compiling Hasura.RQL.DDL.Schema.Cache.Dependencies ( src-lib/Hasura/RQL/DDL/Schema/Cache/Dependencies.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Schema/Cache/Dependencies.o )
[128 of 162] Compiling Hasura.RQL.DDL.Schema.Catalog ( src-lib/Hasura/RQL/DDL/Schema/Catalog.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Schema/Catalog.o )
[129 of 162] Compiling Hasura.RQL.DDL.Schema.Rename ( src-lib/Hasura/RQL/DDL/Schema/Rename.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Schema/Rename.o )
[130 of 162] Compiling Hasura.RQL.DDL.Schema.Table ( src-lib/Hasura/RQL/DDL/Schema/Table.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Schema/Table.o )
[131 of 162] Compiling Hasura.RQL.DDL.Schema.Cache.Fields ( src-lib/Hasura/RQL/DDL/Schema/Cache/Fields.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Schema/Cache/Fields.o )
[132 of 162] Compiling Hasura.GraphQL.Validate ( src-lib/Hasura/GraphQL/Validate.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Validate.o )
[133 of 162] Compiling Hasura.GraphQL.Resolve.Select ( src-lib/Hasura/GraphQL/Resolve/Select.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Resolve/Select.o )
[134 of 162] Compiling Hasura.GraphQL.Resolve.Mutation ( src-lib/Hasura/GraphQL/Resolve/Mutation.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Resolve/Mutation.o )
[135 of 162] Compiling Hasura.GraphQL.Resolve.Insert ( src-lib/Hasura/GraphQL/Resolve/Insert.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Resolve/Insert.o )
[136 of 162] Compiling Hasura.GraphQL.Resolve ( src-lib/Hasura/GraphQL/Resolve.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Resolve.o )
[137 of 162] Compiling Hasura.GraphQL.Execute.Query ( src-lib/Hasura/GraphQL/Execute/Query.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Execute/Query.o )
[138 of 162] Compiling Hasura.GraphQL.Logging ( src-lib/Hasura/GraphQL/Logging.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Logging.o )
[139 of 162] Compiling Hasura.GraphQL.Execute.LiveQuery.Plan ( src-lib/Hasura/GraphQL/Execute/LiveQuery/Plan.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Execute/LiveQuery/Plan.o )
[140 of 162] Compiling Hasura.GraphQL.Execute.LiveQuery.Poll ( src-lib/Hasura/GraphQL/Execute/LiveQuery/Poll.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Execute/LiveQuery/Poll.o )
[141 of 162] Compiling Hasura.GraphQL.Execute.LiveQuery.State ( src-lib/Hasura/GraphQL/Execute/LiveQuery/State.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Execute/LiveQuery/State.o )
[142 of 162] Compiling Hasura.GraphQL.Execute.LiveQuery ( src-lib/Hasura/GraphQL/Execute/LiveQuery.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Execute/LiveQuery.o )
[143 of 162] Compiling Hasura.GraphQL.Execute.Plan ( src-lib/Hasura/GraphQL/Execute/Plan.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Execute/Plan.o )
[144 of 162] Compiling Hasura.GraphQL.RemoteServer ( src-lib/Hasura/GraphQL/RemoteServer.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/RemoteServer.o )
[145 of 162] Compiling Hasura.RQL.DDL.RemoteSchema ( src-lib/Hasura/RQL/DDL/RemoteSchema.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/RemoteSchema.o )
[146 of 162] Compiling Hasura.RQL.DDL.Schema.Cache ( src-lib/Hasura/RQL/DDL/Schema/Cache.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Schema/Cache.o )
[147 of 162] Compiling Hasura.RQL.DDL.Schema ( src-lib/Hasura/RQL/DDL/Schema.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Schema.o )
[148 of 162] Compiling Hasura.Server.Migrate ( src-lib/Hasura/Server/Migrate.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/Server/Migrate.o )
[149 of 162] Compiling Hasura.RQL.DDL.Relationship.Rename ( src-lib/Hasura/RQL/DDL/Relationship/Rename.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Relationship/Rename.o )
[150 of 162] Compiling Hasura.RQL.DDL.Metadata.Types ( src-lib/Hasura/RQL/DDL/Metadata/Types.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Metadata/Types.o )
[151 of 162] Compiling Hasura.RQL.DDL.Metadata.Generator ( src-lib/Hasura/RQL/DDL/Metadata/Generator.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Metadata/Generator.o )
[152 of 162] Compiling Hasura.RQL.DDL.Metadata ( src-lib/Hasura/RQL/DDL/Metadata.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/RQL/DDL/Metadata.o )
[153 of 162] Compiling Hasura.GraphQL.Execute ( src-lib/Hasura/GraphQL/Execute.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Execute.o )
[154 of 162] Compiling Hasura.Server.Init ( src-lib/Hasura/Server/Init.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/Server/Init.o )
[155 of 162] Compiling Hasura.Server.Telemetry ( src-lib/Hasura/Server/Telemetry.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/Server/Telemetry.o )
[156 of 162] Compiling Hasura.Server.Query ( src-lib/Hasura/Server/Query.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/Server/Query.o )
[157 of 162] Compiling Hasura.GraphQL.Transport.WebSocket ( src-lib/Hasura/GraphQL/Transport/WebSocket.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Transport/WebSocket.o )
[158 of 162] Compiling Hasura.GraphQL.Transport.HTTP ( src-lib/Hasura/GraphQL/Transport/HTTP.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Transport/HTTP.o )
[159 of 162] Compiling Hasura.GraphQL.Explain ( src-lib/Hasura/GraphQL/Explain.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/GraphQL/Explain.o )
[160 of 162] Compiling Hasura.Server.App ( src-lib/Hasura/Server/App.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/Server/App.o )
[161 of 162] Compiling Hasura.Server.SchemaUpdate ( src-lib/Hasura/Server/SchemaUpdate.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/Server/SchemaUpdate.o )
[162 of 162] Compiling Hasura.App       ( src-lib/Hasura/App.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/noopt/build/Hasura/App.o )
Configuring executable 'graphql-engine' for graphql-engine-1.0.0..
Warning: Unknown extensions: DerivingVia, DerivingVia, DerivingVia,
DerivingVia
Preprocessing executable 'graphql-engine' for graphql-engine-1.0.0..
Building executable 'graphql-engine' for graphql-engine-1.0.0..
[1 of 1] Compiling Main             ( src-exec/Main.hs, /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/x/graphql-engine/noopt/build/graphql-engine/graphql-engine-tmp/Main.o )
Linking /home/user/Projects/hasura-graphql-engine/server/dist-newstyle/build/x86_64-linux/ghc-8.6.5/graphql-engine-1.0.0/x/graphql-engine/noopt/build/graphql-engine/graphql-engine ...

Setting export CABAL_HELPER_DEBUG=3 in ~.bashrc and then reloading VS Code + echoing to confirm:

image

Error log again:

image

GavinRay97 commented 4 years ago

Copying over the hie.yaml config you linked to the project directory, a less ambiguous error message (but maybe a regression?):

image

The pertinent bit seems to be:

hie-wrapper couldn't find a HIE binary with a matching GHC version in your all-hies installation
hie: callProcess: /nix/store/343icmxpdvx3cqjm8vpq4mq2m93gs4xs-haskell-ide-engine-combined/libexec/bin/hie "--lsp" "-d" "--vomit" (exit 1): failed

Which seems odds, when you see this directly above:

2020-02-01 14:46:23.645481801 [ThreadId 4] - Use Plain GHC
2020-02-01 14:46:23.675969955 [ThreadId 4] - GHC Output: "Just "8.6.5""
2020-02-01 14:46:23.676215692 [ThreadId 4] - Project GHC version:8.6.5
2020-02-01 14:46:23.676600279 [ThreadId 4] - hie exe candidates :["hie-8.6.5","hie-8.6","hie"]
2020-02-01 14:46:23.677809251 [ThreadId 4] - found hie exe at:/nix/store/343icmxpdvx3cqjm8vpq4mq2m93gs4xs-haskell-ide-engine-combined/libexec/bin/hie
GavinRay97 commented 4 years ago

Okay, following some of the comments from this issue thread:

https://github.com/haskell/haskell-ide-engine/issues/1337

It turns out that in the binaries location of my all-hies install, I do not seem to explicitly have hie-8.6.5:

image

And the top line of the log file is:

2020-02-01 15:02:07.762264804 [ThreadId 4] - run entered for hie-wrapper(hie-wrapper) Version 1.0.0.0 x86_64 ghc-8.6.4

So I guess when it says candidates, it means all possible compatible binaries that exist, not necessarily on your sytem.

2020-02-01 15:02:07.795543036 [ThreadId 4] - hie exe candidates :["hie-8.6.5","hie-8.6","hie"]
fendor commented 4 years ago

Yes, I meant the cabal new-build/cabal v2-build. Since cabal 3.0.0.0 these are the same as cabal build.

Is your ghc version on the path 8.6.5 while your all-hies only installed 8.6.4 maybe?

Unfortunately, regarding loading the project into hie without the hie.yaml I have no idea, if possible share the project so we can try as well, but I have no further ideas to help debug it.

GavinRay97 commented 4 years ago

It just looks like all-hies did not install hie-8.6.5

(Notice the .hie84 at end of let hie = import)

image

How do I specify hie-8.6.5 in the all-hies nix install?

Edit: seems to be

nix-env -iA selection --arg selector 'p: { inherit (p) ghc865; }' -f https://github.com/infinisil/all-hies/tarball/master
fendor commented 4 years ago

You could have switched to ghc-8.6.4 on the path, too.

GavinRay97 commented 4 years ago

Okay, still not working but at least this seems this like progress.

Sorry to pester you with all of this.

Multi-cradle is saying no prefixes match:

image

My hie.yaml is as follows:

cradle:
  cabal:
    - path: '/home/user/Projects/haskell-ide-engine/hie-plugin-api/Haskell'
      component: 'lib:hie-plugin-api'
    - path: '/home/user/Projects/haskell-ide-engine/test/dispatcher/'
      component: 'haskell-ide-engine:dispatcher-test'
    - path: '/home/user/Projects/haskell-ide-engine/test/functional/'
      component: 'haskell-ide-engine:func-test'
    - path: '/home/user/Projects/haskell-ide-engine/test/unit/'
      component: 'haskell-ide-engine:unit-test'
    - path: '/home/user/Projects/haskell-ide-engine/test/plugin-dispatcher/'
      component: 'haskell-ide-engine:plugin-dispatcher-test'
    - path: '/home/user/Projects/haskell-ide-engine/test/wrapper/'
      component: 'haskell-ide-engine:wrapper-test'
    - path: '/home/user/Projects/haskell-ide-engine/test/utils/'
      component: 'haskell-ide-engine:hie-test-utils'
    - path: '/home/user/Projects/haskell-ide-engine/app/MainHie.hs'
      component: 'haskell-ide-engine:hie'
    - path: '/home/user/Projects/haskell-ide-engine/app/HieWrapper.hs'
      component: 'haskell-ide-engine:hie-wrapper'
    - path: '/home/user/Projects/haskell-ide-engine/'
      component: 'lib:haskell-ide-engine'
fendor commented 4 years ago

Not a problem, I am glad if I can help!

Please adapt the paths to your local project accordingly, e.g.

cradle:
  cabal:
    - path: '/home/user/Projects/hasura.../src'
      component: 'lib:hasura-hasql' 

this is an example! path is definitely incorrect and the component name might be, too!

You can check the component by experimenting with cabal v2-repl lib:hasura-hasql and see if this loads! Name scheme should be lib:<project-name>. For executables: exe:<executable-name> and so on for test, bench, ...

GavinRay97 commented 4 years ago

:man_facepalming:

Okay so I was not supposed to literally copy-paste the hie.yaml configuration. Those path/component keys need to be adapted to suit the project?

How do I know how many of them I need?

This appears to work: cabal v2-repl lib:graphql-engine

(base) user@machine:~/Projects/hasura-graphql-engine/server$ cabal v2-repl lib:graphql-engine
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
 - graphql-engine-1.0.0 (lib) (ephemeral targets)
Preprocessing library for graphql-engine-1.0.0..
GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
[  1 of 162] Compiling Control.Arrow.Trans ( src-lib/Control/Arrow/Trans.hs, interpreted )
[  2 of 162] Compiling Control.Arrow.Extended ( src-lib/Control/Arrow/Extended.hs, interpreted )
....

image

I can see here name: graphql-engine in this graphql-engine.cabal file.

And then in cabal.project:

packages: .

package *
  optimization: 2

  haddock-html: true
  haddock-hoogle: true
  haddock-hyperlink-source: true
  haddock-quickjump: true

package graphql-engine
  ghc-options: -j
  haddock-options: "--show-all"

The graphql-engine.cabal file is quite, quite long. How do I know which of these I need to include in the hie.yaml?

cabal-version:       2.2

name:                graphql-engine
version:             1.0.0
synopsis:            GraphQL API over Postgres
homepage:            https://www.hasura.io
license:             Apache-2.0
author:              Vamshi Surabhi
maintainer:          vamshi@hasura.io
copyright:           Hasura Inc.
category:            Database
build-type:          Simple

source-repository head
  type:     git
  location: https://github.com/hasura/graphql-engine

flag developer
  description: Enable support for development-only APIs
  default: False
  manual: True

common common-all
  ghc-options:
    -fmax-simplifier-iterations=20 -foptimal-applicative-do
    -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints

  if flag(developer)
    cpp-options: -DDeveloperAPIs

  default-language: Haskell2010
  default-extensions:
    ApplicativeDo BangPatterns BlockArguments ConstraintKinds DefaultSignatures DeriveDataTypeable
    DeriveFoldable DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable DerivingVia EmptyCase
    FlexibleContexts FlexibleInstances FunctionalDependencies GeneralizedNewtypeDeriving
    InstanceSigs LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude
    OverloadedStrings QuantifiedConstraints QuasiQuotes RankNTypes ScopedTypeVariables
    StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeOperators

common common-exe
  ghc-options:
    -threaded -rtsopts
    -- Re. `-I2` see #2565
    --
    -- `-qn2` limits the parallel GC to at most 2 capabilities. This came up in #3354/#3394, as the
    -- parallel GC was causing significant performance overhead. Folks in #ghc on freenode advised
    -- limiting the parallel GC to 2 or 3 capabilities as a very conservative choice, since more
    -- than that is highly unlikely to ever be helpful. More benchmarking would be useful to know if
    -- this is the right decision. It’s possible it would better to just turn it off completely.
    "-with-rtsopts=-N -I2 -qn2"

library
  import: common-all
  hs-source-dirs:      src-lib
  build-depends:       base
                     , lifted-base
                     , pg-client
                     , text
                     , text-builder >= 0.6
                     , bytestring
                     , postgresql-libpq
                     , mtl
                     , aeson
                     , aeson-casing
                     , unordered-containers
                     , template-haskell
                     , hashable
                     , transformers
                     , transformers-base
                     , http-types
                     , attoparsec
                     , attoparsec-iso8601 >= 1.0
                     , time
                     , scientific
                     , Spock-core
                     , split
                     , optparse-applicative
                     , containers
                     , monad-control
                     , monad-time
                     , monad-validate
                     , fast-logger
                     , wai
                     , postgresql-binary
                     , process
                     , http-client-tls
                     , profunctors
                     , deepseq
                     , dependent-map >=0.2.4 && <0.4
                     , dependent-sum >=0.4 && <0.5

                     -- `these >=1` is split into several different packages, but our current stack
                     -- resolver has `these <1`; when we upgrade we just need to add an extra
                     -- dependency on `semialign`
                     , these >=0.7.1 && <0.8

                     -- Encoder related
                     , uuid
                     , vector

                     -- Logging related
                     , network
                     , byteorder

                     -- for parsing RSA keys
                     , cryptonite

                     -- for jwt verification
                     , jose
                     , pem
                     , x509
                     , asn1-encoding
                     , asn1-types

                     -- Server related
                     , warp
                     , th-lift-instances
                     , lens

                     -- GraphQL related
                     , graphql-parser

                     -- URL parser related
                     , network-uri
                     , uri-encode

                     -- String related
                     , case-insensitive
                     , string-conversions
                     , text-conversions

                     -- Http client
                     , wreq
                     , http-client

                     -- ordered map
                     , insert-ordered-containers

                     -- Parsing SemVer
                     , semver

                     -- Templating
                     , mustache
                     , file-embed
                     , shakespeare >= 2.0.22

                     --
                     , data-has
                     -- for src-exec
                     , yaml
                     , template-haskell >= 2.11

                     -- websockets interface related
                     , websockets
                     , wai-websockets
                     , stm
                     , stm-containers
                     , list-t
                     , async
                     , lifted-async

                     -- logging related
                     , base64-bytestring >= 1.0
                     , auto-update

                     -- regex related
                     , regex-tdfa >= 1.2

                     -- pretty printer
                     , ansi-wl-pprint

                     -- for capturing various metrics
                     , ekg-core
                     , ekg-json

                     -- metrics for CI integration
                     , ci-info

                     -- serve static files
                     , filepath >= 1.4
                     , mime-types >= 0.1

                     -- for handling posix signals for graceful shutdown
                     , unix
                     -- HTTP compression
                     , zlib

                     -- caching
                     , psqueues >= 0.2

                     -- testing
                     , QuickCheck
                     , generic-arbitrary

  exposed-modules:     Control.Arrow.Extended
                     , Control.Arrow.Trans
                     , Control.Monad.Stateless
                     , Control.Monad.Unique

                     -- exposed for tests
                     , Data.Parser.CacheControl

                     , Hasura.Prelude
                     , Hasura.App
                     , Hasura.Db
                     -- Exposed for benchmark:
                     , Hasura.Cache.Bounded
                     , Hasura.Cache.Unbounded
                     , Hasura.Cache
                     , Hasura.Logging
                     , Hasura.HTTP
                     , Hasura.Incremental

                     , Hasura.Server.App
                     , Hasura.Server.Auth
                     , Hasura.Server.Init
                     , Hasura.Server.Query
                     , Hasura.Server.Utils
                     , Hasura.Server.Version
                     , Hasura.Server.Logging
                     , Hasura.Server.Context
                     , Hasura.Server.Migrate
                     , Hasura.Server.Compression
                     , Hasura.Server.PGDump

                     , Hasura.RQL.Types
                     , Hasura.RQL.Types.Run
                     , Hasura.RQL.DDL.Metadata
                     , Hasura.RQL.DDL.Metadata.Types
                     , Hasura.RQL.DDL.Metadata.Generator
                     , Hasura.RQL.DDL.Schema
                     , Hasura.EncJSON

                     , Data.Aeson.Ordered

  other-modules:       Hasura.Incremental.Select
                     , Hasura.Incremental.Internal.Cache
                     , Hasura.Incremental.Internal.Dependency
                     , Hasura.Incremental.Internal.Rule

                     , Hasura.Server.Auth.JWT
                     , Hasura.Server.Middleware
                     , Hasura.Server.Cors
                     , Hasura.Server.CheckUpdates
                     , Hasura.Server.Telemetry
                     , Hasura.Server.SchemaUpdate
                     , Hasura.Server.Config
                     , Hasura.Server.Migrate.Version
                     , Hasura.Server.Auth.JWT.Internal
                     , Hasura.Server.Auth.JWT.Logging

                     , Hasura.RQL.Instances
                     , Hasura.RQL.Types.SchemaCache
                     , Hasura.RQL.Types.SchemaCache.Build
                     , Hasura.RQL.Types.SchemaCacheTypes
                     , Hasura.RQL.Types.BoolExp
                     , Hasura.RQL.Types.Function
                     , Hasura.RQL.Types.Catalog
                     , Hasura.RQL.Types.Column
                     , Hasura.RQL.Types.Common
                     , Hasura.RQL.Types.ComputedField
                     , Hasura.RQL.Types.DML
                     , Hasura.RQL.Types.Error
                     , Hasura.RQL.Types.EventTrigger
                     , Hasura.RQL.Types.Metadata
                     , Hasura.RQL.Types.Permission
                     , Hasura.RQL.Types.QueryCollection
                     , Hasura.RQL.Types.RemoteSchema
                     , Hasura.RQL.DDL.ComputedField
                     , Hasura.RQL.DDL.Relationship
                     , Hasura.RQL.DDL.Deps
                     , Hasura.RQL.DDL.Permission.Internal
                     , Hasura.RQL.DDL.Permission
                     , Hasura.RQL.DDL.Relationship.Rename
                     , Hasura.RQL.DDL.Relationship.Types
                     , Hasura.RQL.DDL.Schema.Cache
                     , Hasura.RQL.DDL.Schema.Cache.Common
                     , Hasura.RQL.DDL.Schema.Cache.Dependencies
                     , Hasura.RQL.DDL.Schema.Cache.Fields
                     , Hasura.RQL.DDL.Schema.Cache.Permission
                     , Hasura.RQL.DDL.Schema.Catalog
                     , Hasura.RQL.DDL.Schema.Diff
                     , Hasura.RQL.DDL.Schema.Enum
                     , Hasura.RQL.DDL.Schema.Function
                     , Hasura.RQL.DDL.Schema.Rename
                     , Hasura.RQL.DDL.Schema.Table
                     , Hasura.RQL.DDL.Utils
                     , Hasura.RQL.DDL.EventTrigger
                     , Hasura.RQL.DDL.Headers
                     , Hasura.RQL.DDL.RemoteSchema
                     , Hasura.RQL.DDL.QueryCollection
                     , Hasura.RQL.DML.Delete
                     , Hasura.RQL.DML.Internal
                     , Hasura.RQL.DML.Insert
                     , Hasura.RQL.DML.Mutation
                     , Hasura.RQL.DML.Returning
                     , Hasura.RQL.DML.Select.Internal
                     , Hasura.RQL.DML.Select.Types
                     , Hasura.RQL.DML.Select
                     , Hasura.RQL.DML.Update
                     , Hasura.RQL.DML.Count
                     , Hasura.RQL.GBoolExp

                     , Hasura.GraphQL.Transport.HTTP.Protocol
                     , Hasura.GraphQL.Transport.HTTP
                     , Hasura.GraphQL.Transport.WebSocket.Protocol
                     , Hasura.GraphQL.Transport.WebSocket.Server
                     , Hasura.GraphQL.Transport.WebSocket
                     , Hasura.GraphQL.Schema.BoolExp
                     , Hasura.GraphQL.Schema.Common
                     , Hasura.GraphQL.Schema.Function
                     , Hasura.GraphQL.Schema.OrderBy
                     , Hasura.GraphQL.Schema.Select
                     , Hasura.GraphQL.Schema.Merge
                     , Hasura.GraphQL.Schema.Mutation.Common
                     , Hasura.GraphQL.Schema.Mutation.Insert
                     , Hasura.GraphQL.Schema.Mutation.Update
                     , Hasura.GraphQL.Schema.Mutation.Delete
                     , Hasura.GraphQL.Schema
                     , Hasura.GraphQL.Utils
                     , Hasura.GraphQL.Validate
                     , Hasura.GraphQL.Validate.Types
                     , Hasura.GraphQL.Validate.Context
                     , Hasura.GraphQL.Validate.Field
                     , Hasura.GraphQL.Validate.InputValue
                     , Hasura.GraphQL.Explain
                     , Hasura.GraphQL.Execute
                     , Hasura.GraphQL.Execute.Plan
                     , Hasura.GraphQL.Execute.Query
                     , Hasura.GraphQL.Execute.LiveQuery
                     , Hasura.GraphQL.Execute.LiveQuery.Options
                     , Hasura.GraphQL.Execute.LiveQuery.Plan
                     , Hasura.GraphQL.Execute.LiveQuery.Poll
                     , Hasura.GraphQL.Execute.LiveQuery.State
                     , Hasura.GraphQL.Execute.LiveQuery.TMap
                     , Hasura.GraphQL.Resolve
                     , Hasura.GraphQL.Resolve.Types
                     , Hasura.GraphQL.Resolve.Context
                     , Hasura.GraphQL.Resolve.BoolExp
                     , Hasura.GraphQL.Resolve.InputValue
                     , Hasura.GraphQL.Resolve.Introspect
                     , Hasura.GraphQL.Resolve.Insert
                     , Hasura.GraphQL.Resolve.Mutation
                     , Hasura.GraphQL.Resolve.Select
                     , Hasura.GraphQL.RemoteServer
                     , Hasura.GraphQL.Context
                     , Hasura.GraphQL.Logging

                     , Hasura.Events.Lib
                     , Hasura.Events.HTTP

                     , Control.Concurrent.Extended
                     , Control.Lens.Extended
                     , Data.Aeson.Extended
                     , Data.HashMap.Strict.Extended
                     , Data.HashMap.Strict.InsOrd.Extended
                     , Data.Parser.JSONPath
                     , Data.Sequence.NonEmpty
                     , Data.TByteString
                     , Data.Text.Extended
                     , Data.Time.Clock.Units

                     , Hasura.SQL.DML
                     , Hasura.SQL.Error
                     , Hasura.SQL.GeoJSON
                     , Hasura.SQL.Rewrite
                     , Hasura.SQL.Time
                     , Hasura.SQL.Types
                     , Hasura.SQL.Value
                     , Network.URI.Extended

executable graphql-engine
  import: common-all, common-exe
  hs-source-dirs:    src-exec
  main-is:           Main.hs
  build-depends:     base
                   , graphql-engine
                   , bytestring
                   , pg-client
                   , text
                   , text-conversions

test-suite graphql-engine-tests
  import: common-all, common-exe
  type: exitcode-stdio-1.0
  build-depends:
    , aeson
    , base
    , bytestring
    , graphql-engine
    , hspec >=2.6.1 && <3
    , hspec-core >=2.6.1 && <3
    , hspec-expectations-lifted
    , http-client
    , http-client-tls
    , lifted-base
    , monad-control
    , mtl
    , natural-transformation >=0.4 && <0.5
    , optparse-applicative
    , pg-client
    , QuickCheck
    , time
    , transformers-base
    , unordered-containers
  hs-source-dirs: src-test
  main-is: Main.hs
  other-modules:
    Data.Parser.CacheControlSpec
    Hasura.IncrementalSpec
    Hasura.RQL.MetadataSpec
    Hasura.Server.MigrateSpec

-- Benchmarks related to caching (e.g. the plan cache).
--
-- NOTE: Some of these are very slow and can only be reasonably run with `cache -n 1` for now.
benchmark cache
  import: common-all, common-exe
  type: exitcode-stdio-1.0
  main-is: Main.hs
  hs-source-dirs: src-bench-cache
  build-depends:     base
                   , criterion
                   , mwc-random
                   , mwc-probability
                   , vector
                   , deepseq
                   , graphql-engine
                   , split
                   , async
                   , text
                   , bytestring
fendor commented 4 years ago

You already got the gist of it! You have different components, e.g. the library, some benchmark (called cache), an executable named graphql-engine and a testsuite graphql-engine-tests. If you want to work on all of these, you need to supply a pair of path and component for each one of them. The path should be the current work directory (location of the cabal.project) and then append the hs-source-dirs to it. E.g.

cradle:
  cabal:
    - path: '/home/user/Projects/hasura.../src-lib'
      component: 'lib:graphql-engine'
    - path: '/home/user/Projects/hasura.../src-exec'
      component: 'exe:graphql-engine' 
    - path: '/home/user/Projects/hasura.../src-test'
      component: 'test:graphql-engine-tests'
    - path: '/home/user/Projects/hasura.../src-bench-cache'
      component: 'bench:cache' 

Does this help?

EDIT: if you happen to have multiple hs-source-dirs for a single component, you can just supply multiple pairs of path and component! The path can also be a filepath. Useful if you have multiple components in the same directory, e.g. multiple executables in src-exec.

GavinRay97 commented 4 years ago

WEW, IT MOSTLY WORKED!!!

image

It got part of the way through stuff, and when I hovered something it went to build documentation and then crashed =/

image

fendor commented 4 years ago

Oh, I think that might be a nix bug? Building from source might help. cc @Infinisil do I recall that correctly?

GavinRay97 commented 4 years ago

Build HIE from source instead of using the all-hies nix package?

fendor commented 4 years ago

Yes, building haskell-ide-engine from source via something like ./cabal-hie-install.sh hie-8.6.4 (I am not entirely sure about the command, try ./cabal-hie-install.sh help if it doesnt work). If you are on nixos, use nix-shell before that to switch shell. Make sure that ~/.cabal/bin is on the path after that and check via which hie-8.6.4 that the correct version is on the path.

GavinRay97 commented 4 years ago

@fendor

IT WORKS!!! Thank you so much! :pray:

This is amazing :heart:

I am going to PR a section in the Hasura GraphQL Engine documentation about how to do all of this so that others might benefit too.

GavinRay97 commented 4 years ago

One last thing if I may:

Is it possible to cache the documentation information so that each time the project is loaded, HIE does not need to rebuild?

It also seems to keep rebuilding the same symbols + documentation repeatedly (IE, I Hover a function, it pops up the documentation window and annotation for it, then I move my cursor off and back to it after a second and it rebuilds all of the project docs again, endlessly)

fendor commented 4 years ago

Very glad to hear it! However, that sounds wrong regarding the documentation. I dont think it should be doing that. It would be you nice if you could open another issue for that!

infinisil commented 4 years ago

Looks like https://github.com/Infinisil/all-hies/issues/32

Seems like removing ~/.stack seems to have fixed it with all-hies for at least one person

GavinRay97 commented 4 years ago

Very glad to hear it! However, that sounds wrong regarding the documentation. I dont think it should be doing that. It would be you nice if you could open another issue for that!

Sure, I just feel bad for creating so many issues/comments and taking up everyones time.

Let me record a video with the verbose output of HIE streaming to the screen + upload it somewhere because I think that would make visualization & understanding the issue a lot easier.

Edit: I also PRed this info into Hasura for others =D

https://github.com/hasura/graphql-engine/pull/3819

GavinRay97 commented 4 years ago

https://github.com/haskell/haskell-ide-engine/issues/1623

jneira commented 4 years ago

Hi, i am afraid that i am getting the same original error, with actual master in windows. Afaiu the issue was resolved using an explicit hie.yaml but i think it worths reopen to see if we can fix the root cause. I am getting the error opening haskell-ide-engine itself.

Searching the error msg in thecabal-helper repo i've found it here:

https://github.com/DanielG/cabal-helper/blob/c20981c0cf56d0a9d9fbfba9be961dbb4d5896c9/src/CabalHelper/Compiletime/Program/CabalInstall.hs#L279

I think the immediate cause that triggers the problem is to have a source-repository-package in the cabal.project, after removing the existing one for cabal-helper in haskell-ide-engine, the project is loaded succesfully.

jneira commented 4 years ago

Opened issue upstream: https://github.com/DanielG/cabal-helper/issues/99

jneira commented 4 years ago

Fixed upstream and integrated in hie with #1771