Skip to content

copy command fails when building only some components #2780

Closed

Description

@snoyberg

Actions:

  1. Create a project with both a library and executable
  2. cabal clean
  3. cabal configure
  4. cabal build lib:packagename
  5. 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.

Activity

  1. lukehoersten commented on Sep 25, 2015

    @lukehoersten
    Member

    +1

  2. mgsloan commented on Nov 10, 2015

    @mgsloan
    Collaborator

    Recently ran into this one... +1

  3. added 3 commits that reference this issue on Jan 19, 2016
    35101d8
    b50b97b
    b7811f1
  4. added 7 commits that reference this issue on Jan 27, 2016
    4564a2c
    61721e8
    91bbb74
    759b8bc
    f9da187
    eedd07f
    4f4028a
  5. added 2 commits that reference this issue on Feb 20, 2016
    f182556
    4374645
  6. 24 remaining items

  7. ezyang commented on Oct 25, 2016

    @ezyang
    Contributor

    @mgsloan GHC 8.0.2 is coming soon, so this is your last chance to get a 1.24 patch in!

  8. modified the milestones: 2.0.1, 2.0 on Feb 17, 2017
  9. modified the milestones: 2.0.1, 2.0.2 on Sep 19, 2017
  10. 23Skidoo commented on Oct 15, 2017

    @23Skidoo
    Member

    @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.

  11. snoyberg commented on Oct 15, 2017

    @snoyberg
    CollaboratorAuthor

    The problem still exists with Cabal 2.0:

    $ 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.

  12. 23Skidoo commented on Oct 15, 2017

    @23Skidoo
    Member

    @snoyberg Thanks!

  13. ezyang commented on Dec 29, 2017

    @ezyang
    Contributor

    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 copy indeed 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions