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

Comments

Projects
None yet
3 participants
@nh2
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

This comment has been minimized.

Contributor

snoyberg commented Jun 27, 2017

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

This comment has been minimized.

Contributor

snoyberg commented Jun 27, 2017

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

This comment has been minimized.

Member

chrisdone commented Jun 28, 2017

Found the related commit: dc6313f

chrisdone added a commit that referenced this issue Jun 28, 2017

chrisdone added a commit that referenced this issue Jun 28, 2017

chrisdone added a commit that referenced this issue Jun 28, 2017

chrisdone added a commit that referenced this issue Jun 28, 2017

chrisdone added a commit that referenced this issue Jun 28, 2017

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Jul 13, 2017

Merged to master, closing.

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