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

stack build fails to properly isolate multiple executables #1038

Closed
lukehoersten opened this issue Sep 23, 2015 · 8 comments
Closed

stack build fails to properly isolate multiple executables #1038

lukehoersten opened this issue Sep 23, 2015 · 8 comments

Comments

@lukehoersten
Copy link

With a .cabal file that has more than one executable (executableA and executableB in my example below) section and a stack.yaml with more than one package, running:

stack build package:executableA

should build only that binary and it's dependencies.

Linking .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/executableA/executableA ...
myLib-0.1.0.0: install
Installing library in
/Users/luke/Code/haskell/project/.stack-work/install/x86_64-osx/lts-3.5/7.10.2/lib/x86_64-osx-ghc-7.10.2/myLib-0.1.0.0-1fPMqSl6oAj7NSYsiNCqCM
Installing executable(s) in
/Users/luke/Code/haskell/project/.stack-work/install/x86_64-osx/lts-3.5/7.10.2/bin
setup-Simple-Cabal-1.22.4.0-x86_64-osx-ghc-7.10.2:
.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/executableB/executableB:
does not exist

--  While building package myLib-0.1.0.0 using:
      /Users/luke/.stack/setup-exe-cache/setup-Simple-Cabal-1.22.4.0-x86_64-osx-ghc-7.10.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/ install
    Process exited with code: ExitFailure 1

What's wrong here is that nothing depends on executableB and it should not need to be installed. Furthermore it wasn't built (correctly because I said to only build executableA) so I don't know why it's trying to grab it.

@snoyberg
Copy link
Contributor

This is an upstream cabal issue, see:

haskell/cabal#2780

@lukehoersten
Copy link
Author

With cabal-install the way this works for me is I go into the package folder (where the cabal file lives) and just run cabal build executableA and it works just fine. Can this approach be used for stack?

@snoyberg
Copy link
Contributor

Actually, it does work: the install phase is failing, but your executable is present in the dist directory inside .stack-work. If this is really a problem for some workflow, we can add a --skip-install flag.

@lukehoersten
Copy link
Author

It's not building the binary I requested because it's trying to install the other binary first and failing because it doesn't exist.

Does the install resulting from the build just try to install all possible binaries instead of just the one I requested?

@snoyberg
Copy link
Contributor

I don't think that assessment is correct, have you looked in the dist
directory?

The bug is that cabal expects all executable to be present for the
install/copy command to succeed.

On Thu, Sep 24, 2015, 3:59 PM Luke Hoersten [email protected]
wrote:

It's not building the binary I requested because it's trying to install
the other binary first and failing because it doesn't exist.

Does the install resulting from the build just try to install all possible
binaries instead of just the one I requested?


Reply to this email directly or view it on GitHub
#1038 (comment)
.

@lukehoersten
Copy link
Author

The .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/ directory is empty except for an empty folder of the name executableB (the executable it's trying and failing to install because I didn't actually build it).

It definitely looks like, based on the output I pasted initially, that it gets to the point of linking the binary I want and then going on to trying and failing to install the other binary, killing the whole process.

We should probably avoid adding a flag unless we know for sure what's preventing the binary from being produced in dist in the first place.

@snoyberg
Copy link
Contributor

Is the package you're building perhaps in a subdirectory? Are you looking
in the .stack-work of that subdirectory?

On Thu, Sep 24, 2015, 4:09 PM Luke Hoersten [email protected]
wrote:

The .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/ directory is empty
except for a folder of the name executableB (the executable it's trying
and failing to install because I didn't actually build it).

It definitely looks like, based on the output I pasted initially, that it
gets to the point of linking the binary I want and then going on to trying
and failing to install the other binary, killing the whole process.

We should probably avoid adding a flag unless we know for sure what's
preventing the binary from being produced in dist in the first place.


Reply to this email directly or view it on GitHub
#1038 (comment)
.

@lukehoersten
Copy link
Author

Yup it's there in the subdir. I was just looking in the dist dir form the stack output. Thanks Michael.

So then the only thing left to consider is the no-install flag which at this point is less critical for me.

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

2 participants