Skip to content

cabal sdist target selection is broken #11385

Open

Description

@phadej
% cabal sdist splitmix
Error: [Cabal-7151]
The component library cannot be packaged for distribution on its own. Only entire packages may be packaged for distribution.

splitmix is the name of package. cabal-install is hallucinating.

Activity

  1. ffaf1 commented on Jan 5, 2026

    @ffaf1
    Collaborator

    To reproduce:

    cabal init -nm --lib prova
    cd prova
    cabal sdist prova
    
  2. philderbeast commented on Mar 5, 2026

    @philderbeast
    Collaborator

    I tried the reproducer but providing the package with .cabal extension and then not providing the package at all (relying on it being found in the current directory):

    $ cabal sdist prova
    Warning: this is a debug build of cabal-install with assertions enabled.
    Error: [Cabal-7151]
    The component library cannot be packaged for distribution on its own.
    Only entire packages may be packaged for distribution.
    
    $ cabal sdist prova.cabal
    Warning: this is a debug build of cabal-install with assertions enabled.
    Wrote tarball sdist to
    /home/.../prova/dist-newstyle/sdist/prova-0.1.0.0.tar.gz
    
    $ cabal sdist
    Warning: this is a debug build of cabal-install with assertions enabled.
    Wrote tarball sdist to
    /home/.../prova/dist-newstyle/sdist/prova-0.1.0.0.tar.gz
    

    Checking the targets and noting that this command is meant to take packages not targets.

    $ cabal target
    Warning: this is a debug build of cabal-install with assertions enabled.
    Resolving dependencies...
    Fully qualified target forms:
     - prova:lib:prova
    Found 1 target matching all.
    
    $ cabal sdist --help
    Generate a source distribution file (.tar.gz).
    
    Usage: cabal sdist [FLAGS] [PACKAGES]
    
    Generates tarballs of project packages suitable for upload to Hackage.
    ...
    
  3. philderbeast commented on Mar 5, 2026

    @philderbeast
    Collaborator

    The folder of the package can also be used:

    $ cabal sdist .
    Warning: this is a debug build of cabal-install with assertions enabled.
    Wrote tarball sdist to
    /home/.../prova/dist-newstyle/sdist/prova-0.1.0.0.tar.gz
    
  4. philderbeast commented on Mar 5, 2026

    @philderbeast
    Collaborator

    In this project the all target (all packages!) can be used:

    $ cabal run cabal -- sdist all
    Warning: this is a debug build of cabal-install with assertions enabled.
    Build profile: -w ghc-9.12.2 -O1
    In order, the following will be built (use -v for more details):
     - cabal-install-3.17.0.0 (exe:cabal) (configuration changed)
    Warning: this is a debug build of cabal-install with assertions enabled.
    Configuring executable 'cabal' for cabal-install-3.17.0.0...
    Warning: this is a debug build of cabal-install with assertions enabled.
    Preprocessing executable 'cabal' for cabal-install-3.17.0.0...
    Building executable 'cabal' for cabal-install-3.17.0.0...
    Warning: this is a debug build of cabal-install with assertions enabled.
    Wrote tarball sdist to
    /home/.../cabal/dist-newstyle/sdist/Cabal-3.17.0.0.tar.gz
    Wrote tarball sdist to
    /home/.../cabal/dist-newstyle/sdist/Cabal-described-3.17.0.0.tar.gz
    Wrote tarball sdist to
    /home/.../cabal/dist-newstyle/sdist/Cabal-syntax-3.17.0.0.tar.gz
    Wrote tarball sdist to
    ...
    Wrote tarball sdist to
    /home/.../cabal/dist-newstyle/sdist/solver-benchmarks-3.tar.gz
    
  5. phadej commented on Apr 16, 2026

    @phadej
    CollaboratorAuthor
    % cabal sdist aeson:lib:aeson
    Error: [Cabal-7151]
    The component library cannot be packaged for distribution on its own. Only entire packages may be packaged for distribution.
    

    still an issue. yes, I can use cabal sdist all; but if you trell me to use that, just remove the target selection from sdist compeltely if it doesnt' work.

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions