Skip to content

'new-run' seems to not work when there's both an exe and a lib in a package #4608

Closed

Description

@23Skidoo

To reproduce:

  • Create a package with both a library and an executable in it.
  • Try to build and run it with a command like cabal new-run exe-name -- arg1 arg2.

This will fail with an error message similar to the following:

$ cabal new-run consumers-example -- args
Up to date
[...]/dist-newstyle/build/x86_64-linux/ghc-8.0.2/consumers-2.0.1/build/consumers-example/consumers-example: rawSystem: runInteractiveProcess: exec: does not exist (No such file or directory)

The problem is that the exe is actually under ./dist-newstyle/build/x86_64-linux/ghc-8.0.2/consumers-2.0.1/c/consumers-example/build/consumers-example/consumers-example (note the /c/consumers-example bit) in this configuration, so new-run predictably fails to find it.

Activity

  1. added this to the 2.2 milestone on Jul 17, 2017
  2. added
    cabal-install: v2-build system
    on Jul 17, 2017
  3. ezyang commented on Jul 19, 2017

    @ezyang
    Contributor

    I'm surprised this bug could have happened. Could it be extractMatchingElaboratedConfiguredPackages is not returning the elaborated component for the executable, but the library instead? I don't see any obvious bugs in the code.

  4. fgaz commented on Jul 19, 2017

    @fgaz
    Member

    #4607 also fixes this. I'll add a test.
    EDIT: added with 999d0f2

  5. added 2 commits that reference this issue on Jul 19, 2017
  6. int-index commented on Aug 28, 2017

    @int-index
    Collaborator

    I've just encountered this issue. The upstream version of cabal works, but the one on Hackage doesn't. Maybe it's time for a release?

  7. fgaz commented on Aug 28, 2017

    @fgaz
    Member
  8. moll commented on Dec 14, 2017

    @moll

    Is it me is cabal new-run entirely out of its depths now with Cabal v2.0.1? With both a single executable and an exe and lib together, I'm getting:

    cabal new-run exe:foo -- a
    cabal: Unknown target 'a'.
    There is no component 'a'.
    The project has no package 'a'.
    

    A plain cabal new-run returns:

    Up to date
    

    cabal new-build and a manual invocation of the exe in dist-newstyle work fine.

  9. moll commented on Dec 14, 2017

    @moll

    Unless I'm mistaken with the 3 and 4 digit version numbers... cabal --version is returning v2.0.0.1, not v2.0.1 as https://github.com/haskell/cabal/milestone/45 lists...

  10. 23Skidoo commented on Dec 15, 2017

    @23Skidoo
    MemberAuthor

    new-run didn't make it into 2.0, try with HEAD or 2.2, which will be out next month.

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

Metadata

Metadata

Assignees

Labels

cabal-install: v2-build systemtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions