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 [target] no longer works, builds all targets #3229

Closed
nh2 opened this issue Jun 26, 2017 · 4 comments
Closed

stack build [target] no longer works, builds all targets #3229

nh2 opened this issue Jun 26, 2017 · 4 comments

Comments

@nh2
Copy link
Collaborator

nh2 commented Jun 26, 2017

There is a regression in stack that stack build myexe no longer builds just the executable myexe, but all executables from the package.

Especially projects with many executables, and projects where linking takes a long time suffer from this (both are the case for IOHK's cardano-sl).

The reason according to @mgsloan:

I think this was the result of switching from using runhaskell Setup.hs install to copy + register - f71a515 .
copy fails if it can't find every executable, and there's no way in released cabal to tell it to only copy particular targets. There was a patch well before the most recent cabal release, but for some reason it is only available on master. So, with future cabal this may be fixable.

@snoyberg
Copy link
Contributor

Let's finally set to rest the theory that it's the switch from install to copy/register (it's not):

stack new foo
cd foo
stack exec --no-ghc-package-path -- runghc Setup.hs configure --user
stack exec --no-ghc-package-path -- runghc Setup.hs build lib:foo
stack exec --no-ghc-package-path -- runghc Setup.hs install

Results in:

Installing library in
/Users/michael/.cabal/lib/x86_64-osx-ghc-8.0.2/foo-0.1.0.0-K7FRl2SdaSPJF1E2Gf1Eav
Installing executable(s) in /Users/michael/.cabal/bin
Warning: The directory /Users/michael/.cabal/bin is not in the system search
path.
dist/build/foo-exe/foo-exe: copyFile: does not exist (No such file or
directory)

@snoyberg
Copy link
Contributor

The problem: Cabal (the library) will fail and die if you call the copy command when some of the executables are unavailable.

Original solution: oh well, user will get an error message, realize he/she has to call build once without arguments, and then can give components.

Current solution: never tell build to only build a subset of components, since that can lead to copy failing.

Proposed solution: before calling Cabal build, Stack should check if all executables are built. If they are, pass in components. Otherwise, give a logInfo that we're building all components once, and then future calls will build individual components.

@chrisdone
Copy link
Member

Found the related commit: dc6313f

@snoyberg
Copy link
Contributor

Merged to master, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants