Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does `stack build` store generated executables?

I'm using multiple stack.yaml files to build against GHC 7.8 and 7.10. How do I set up my PATH to include the binaries for a specific stack.yaml file, e.g. stack-7.8.yaml?

like image 916
ntc2 Avatar asked Jul 17 '15 00:07

ntc2


2 Answers

The stack path --local-install-root command solves this problem. E.g., to setup your path for the binaries from stack --stack-yaml stack-7.8.yaml, do

export PATH=$(stack --stack-yaml stack-7.8.yaml path --local-install-root):$PATH

Note: the stack exec command can also be used here, but I don't want to clutter my scripts with calls to stack --stack-yaml stack-7.8.yaml exec <cmd> instead of plain <cmd>.

like image 192
ntc2 Avatar answered Oct 11 '22 22:10

ntc2


To answer the question in the title, the executables are stored in a project-local .stack-work folder. For me, the full path from the project folder is .stack-work/dist/e626a42b/build/{PROJECT_NAME}-exe. Other executables, such as the test and bench executables, are also stored here, in {PROJECT_NAME}-test and {PROJECT_NAME}-bench respectively.

like image 5
Patrick Jennings Avatar answered Oct 11 '22 22:10

Patrick Jennings