2
votes

I'm trying to get stack running for the first time, but running stack setup in an example project (from stack new helloworld new-template) fails with the following output (I skipped the beginning, which I think was normal):

Installing library in
/home/ajl/.stack/programs/x86_64-linux/ghc-7.10.2/lib/ghc7.10.2/ghc_JzwEp1oQ8kA7NFNTGk1ho5 "/home/ajl/.stack/programs/x86_64-linux/ghc-7.10.2/lib/ghc-7.10.2/bin/ghc-pkg" --force --global-package-db "/home/ajl/.stack/programs/x86_64-linux/ghc-7.10.2/lib/ghc-7.10.2/package.conf.d" update rts/dist/package.conf.install
Reading package info from "rts/dist/package.conf.install" ... done.

: Warning: Unrecognized field 420 on line 420
(Skipped unrecognized field for every line 419 down to 1)
: Warning: Unrecognized field 1 on line 1
: missing id field
: invalid package identifier:
: invalid package key:
make[1]: *** [install_packages] Error 1
make: *** [install] Error 2

Installing GHC ...% 

I'm on Ubuntu 14.04, running stack 1.0.2. Not sure if it's relevant but I have ghc 7.10.1 with Cabal 1.23.0.0 installed on the system already, which work fine.

I have tried changing the resolver to older LTS versions with older ghc versions. I also tried deleting ~/.stack. Not sure what else to try given the unhelpfulness of the errors.

1
I just checked with your exact setup (well one difference: using it on Windows right now) and it works fine - I would interpret this as having problems with rts/dist/package.conf.install - can you check what's in there at line 420 and maybe edit your question to include the lines around this too? - Random Dev
Where would I find it? It's not in ~/.stack, nor is it in the project directory. - Alex
it should be part of your base GHC installation - Random Dev
not 100% sure but you could try to remove the ghc-options from your .cabal (where the -rtsopts etc. are) and retry - maybe it'll stop trying to parse this file then (just to check) - Random Dev
Gave it a go, but it didn't help. I can't find any package.conf.install in my local ghc installation (did find in /usr to be sure). Half the reason I want to use stack is because it's self-contained anyway. Shouldn't it not be getting anything from my local machine? - Alex

1 Answers

2
votes

I figured it out. The GHC build uses grep to make packages.conf.install. I have GREP_OPTIONS=--color=auto -n set in my zsh config. The -n was putting line numbers in front of everything, which was causing the errors.

The reason I couldn't find packages.conf.install anywhere before is because it is made on the fly during GHC make. And stack does that in /tmp.