You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
copy command fails when building only some components #2780
Create a project with both a library and executable
cabal clean
cabal configure
cabal build lib:packagename
cabal copy
Expected: command succeeds, copying over the library only, and not the test suite
Actual: errors out since the executable does not exist, e.g.:
Installing library in
/home/vagrant/.cabal/lib/x86_64-linux-ghc-7.10.2/tmp-0.1.0.0-JdaAODhQa7p5WhxMngbYYt
Installing executable(s) in /home/vagrant/.cabal/bin
Setup.hs: dist/build/tmp-exe/tmp-exe: does not exist
This problem could be mitigated by allowing copy to take a list of components like build does.
$ stack --resolver ghc-8.2.1 exec --no-ghc-package-path -- runghc Setup.hs configure --user
Configuring foo-0.1.0.0...
$ stack --resolver ghc-8.2.1 exec --no-ghc-package-path -- runghc Setup.hs build lib:foo
Preprocessing library for foo-0.1.0.0..
Building library for foo-0.1.0.0..
[1 of 1] Compiling Lib ( src/Lib.hs, dist/build/Lib.o )
$ stack --resolver ghc-8.2.1 exec --no-ghc-package-path -- runghc Setup.hs copy
Installing library in /Users/michael/.cabal/lib/x86_64-osx-ghc-8.2.1/foo-0.1.0.0-wI4nsLkf3p3YT1pJBa9gp
Installing executable foo-exe 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)
I understand that Cabal 2.0 has introduced per-component configuration, which is intended as a workaround. I've discussed with @ezyang, and the ultimate plan is to add support for this to Stack (which will be necessary for Backpack anyway). In the meanwhile, we have a workaround in Stack that forces the executable component to be built the first time.
So my take: I still consider this a bug that is unfixed in Cabal 2.0, but we're effectively working around it in Stack.
Sorry I missed the conversation here. Let me clarify a few points:
Per-component build will solve the problem, as @snoyberg says
./Setup build someexe && ./Setup copyindeed does not work in Cabal HEAD (and it will never work, for reasons explicated earlier in this ticket; specifically, Cabal would need to start tracking state of "what the most recent set of executables that were built" where, and this just doesn't seem like a good answer when there's a better solution below)
./Setup build someexe && ./Setup copy someexe (@snoyberg suggested alleviation at the very beginning of this ticket) works in Cabal 2.0, and it may be worth adding the little bit of logic to support it
Activity
lukehoersten commentedon Sep 25, 2015
+1
mgsloan commentedon Nov 10, 2015
Recently ran into this one... +1
Always build exes, due to cabal copy limitation
Accept components to copy in ./Setup copy, fixes haskell#2780.
Accept components to copy in ./Setup copy, fixes haskell#2780.
Accept components to copy in ./Setup copy, fixes haskell#2780.
Accept components to copy in ./Setup copy, fixes haskell#2780.
Accept components to copy in ./Setup copy, fixes haskell#2780.
Accept components to copy in ./Setup copy, fixes haskell#2780.
Accept components to copy in ./Setup copy, fixes haskell#2780.
Accept components to copy in ./Setup copy, fixes haskell#2780.
Accept components to copy in ./Setup copy, fixes haskell#2780.
Accept components to copy in ./Setup copy, fixes haskell#2780.
Accept components to copy in ./Setup copy, fixes haskell#2780.
Accept components to copy in ./Setup copy, fixes haskell#2780.
24 remaining items
ezyang commentedon Oct 25, 2016
@mgsloan GHC 8.0.2 is coming soon, so this is your last chance to get a 1.24 patch in!
23Skidoo commentedon Oct 15, 2017
@mgsloan @ezyang Guys, is this still broken or is the ticket only open because the fix is not in 1.24? If it's the latter, I think we should close it.
snoyberg commentedon Oct 15, 2017
The problem still exists with Cabal 2.0:
I understand that Cabal 2.0 has introduced per-component configuration, which is intended as a workaround. I've discussed with @ezyang, and the ultimate plan is to add support for this to Stack (which will be necessary for Backpack anyway). In the meanwhile, we have a workaround in Stack that forces the executable component to be built the first time.
So my take: I still consider this a bug that is unfixed in Cabal 2.0, but we're effectively working around it in Stack.
23Skidoo commentedon Oct 15, 2017
@snoyberg Thanks!
ezyang commentedon Dec 29, 2017
Sorry I missed the conversation here. Let me clarify a few points:
./Setup build someexe && ./Setup copyindeed does not work in Cabal HEAD (and it will never work, for reasons explicated earlier in this ticket; specifically, Cabal would need to start tracking state of "what the most recent set of executables that were built" where, and this just doesn't seem like a good answer when there's a better solution below)./Setup build someexe && ./Setup copy someexe(@snoyberg suggested alleviation at the very beginning of this ticket) works in Cabal 2.0, and it may be worth adding the little bit of logic to support it