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
cabal list-bin cabal-tests (and others) fails with "No or multiple targets given" #7679
cabal list-bin cabal-tests complains about zero or multiple targets, even when a qualified target is used. I'm not sure why the error happens only with cabal-tests
To Reproduce
> cabal list-bin cabal-testsuite:exe:cabal-tests
cabal: No or multiple targets given
changed the title [-]cabal list-bin cabal-tests fails with "No or multiple targets given"[/-][+]cabal list-bin cabal-tests (and others) fails with "No or multiple targets given"[/+]on Sep 29, 2021
I mentioned 3.6.0.0 because that's what I'm using, and thought you need to know.
Unfortunately, I don't even have cabal-3.4.0.0 anymore. Are you saying that fur debugging you'd like me to install 3.4.0.0 again and try cabal list-bins?
Since I never tried this command (list-bins) in the past, and only trying it now to avoid the rebuild caused by install, there's a good reason to assume this but was present in older versions as well.
strange, I was able to install cabal-plan executable in the past, maybe some project config is interfering with? could you try to execute the command outside of any project (so out of any subdir of a project too)? will try to reproduce asap
strange, I was able to install cabal-plan executable in the past, maybe some project config is interfering with? could you try to execute the command outside of any project (so out of any subdir of a project too)? will try to reproduce asap
No need to. A couple-of-days-old cabal installed cabal-plan 0.7.2.0 as a library only. After cabal update, it installed 0.7.2.1 with the necessary executable. So, cabal-plan utility is installed and running.
Problem - it's of limited usefulness fur dynamic executables.
Not sure if it is related: After adding a test suite to a package, cabal list-bin stopped working with cabal: No or multiple targets given. The test suite is called tests, which is different from the name of the executable.
I tried all kinds of syntax for qualifying the target (as described in the latest docs), but none worked and some resulted in confusing failure messages, that indicate that more might be wrong with list-bin.
I made the failure message a bit more verbose and it turns out that the problem is that cabal list-bin PROGRAM_NAME fails be finding two targets: the executable (PROGRAM_NAME) and the test suite which is called tests. The same result is returns with cabal list-bin executable:PROGRAM_NAME.
So, problem (at least in my case) seems to be that cabal includes the test suite in the result, even though it is clearly not specified as a target.
Some more details. Here is an example run that logs the targetSelector as well as the final (reject) list of targets.
Note how the qualified target selector explicitly selects: the package (chainweb-mining-client), the kind (CEceName), and the component name (chainweb-mining-client), yet list of selected targets include the test-suite (build/tests/tests).
Activity
[-]cabal list-bin cabal-tests fails[/-][+]cabal list-bin cabal-tests fails with "No or multiple targets given"[/+][-]cabal list-bin cabal-tests fails with "No or multiple targets given"[/-][+]cabal list-bin cabal-tests (and others) fails with "No or multiple targets given"[/+]fgaz commentedon Sep 29, 2021
It looks like this happened in the wild agda/agda#4216 (comment)
fgaz commentedon Oct 10, 2021
@mouse07410 in #7739 you explicitly mentioned cabal 3.6 in the title. Is this a regression from 3.4 or earlier?
mouse07410 commentedon Oct 10, 2021
I mentioned 3.6.0.0 because that's what I'm using, and thought you need to know.
Unfortunately, I don't even have
cabal-3.4.0.0anymore. Are you saying that fur debugging you'd like me to install 3.4.0.0 again and trycabal list-bins?Since I never tried this command (list-bins) in the past, and only trying it now to avoid the rebuild caused by
install, there's a good reason to assume this but was present in older versions as well.fgaz commentedon Oct 10, 2021
No need. I just wanted to confirm you weren't implying this is a regression (from what I remember it isn't, it's always been like this).
relevant cabal-plan ticket:
jneira commentedon Oct 10, 2021
strange, I was able to install cabal-plan executable in the past, maybe some project config is interfering with? could you try to execute the command outside of any project (so out of any subdir of a project too)? will try to reproduce asap
mouse07410 commentedon Oct 10, 2021
No need to. A couple-of-days-old cabal installed
cabal-plan0.7.2.0 as a library only. Aftercabal update, it installed 0.7.2.1 with the necessary executable. So,cabal-planutility is installed and running.Problem - it's of limited usefulness fur dynamic executables.
mouse07410 commentedon Oct 10, 2021
If I could - I would. Sorry, beyond my competence. E.g., I can tell a good painting from a bad one, but I can't re-create a good one ;-)
larskuhtz commentedon Nov 2, 2021
Not sure if it is related: After adding a test suite to a package,
cabal list-binstopped working withcabal: No or multiple targets given. The test suite is called tests, which is different from the name of the executable.I tried all kinds of syntax for qualifying the target (as described in the latest docs), but none worked and some resulted in confusing failure messages, that indicate that more might be wrong with
list-bin.larskuhtz commentedon Nov 2, 2021
I made the failure message a bit more verbose and it turns out that the problem is that
cabal list-bin PROGRAM_NAMEfails be finding two targets: the executable (PROGRAM_NAME) and the test suite which is calledtests. The same result is returns withcabal list-bin executable:PROGRAM_NAME.So, problem (at least in my case) seems to be that cabal includes the test suite in the result, even though it is clearly not specified as a target.
larskuhtz commentedon Nov 2, 2021
Some more details. Here is an example run that logs the
targetSelectoras well as the final (reject) list of targets.Note how the qualified target selector explicitly selects: the package (
chainweb-mining-client), the kind (CEceName), and the component name (chainweb-mining-client), yet list of selected targets include the test-suite (build/tests/tests).larskuhtz commentedon Nov 2, 2021
cf. #7791 for a proposed fix
larskuhtz commentedon Nov 2, 2021
#7791 resolves the original issue that is described above: