Skip to content

plan.json includes internal libraries which aren't built. #6407

Open

Description

@phadej

Describe the bug

plan.json includes also internal libraries which aren't always built.

To Reproduce

$ cabal v2-install --lib overloaded

In ~/.ghc/.../environments/default I get

package-id overloaded-0.1.3-0f5ef0185b0463d9c537b950ec837dc1f2c91bda0aab9c3e85c6116c29835dbf
package-id overloaded-0.1.3-cbb948b926e47cefb1f7cce1fac8681fbaa99202a33cb5a0225d7225620c3ed2

one of which is overloaded library, and the second is overloaded:optics-hasfield which is not what I asked for.


Similarly if I depend on overloaded in a package, the overloaded:optics-hasfield will pop into plan.json, even cabal v2-build doesn't build it.

Expected behavior

cabal should be more precise.

Activity

  1. phadej commented on Dec 8, 2019

    @phadej
    CollaboratorAuthor

    Note: including internal package into environment exposes it modules. So this might cause unfortunate surprises!

    ~ % cabal v2-install --lib overloaded
    Resolving dependencies...
    Build profile: -w ghc-8.6.5 -O1
    In order, the following will be built (use -v for more details):
     - overloaded-0.1.3 (lib:optics-hasfield) (requires build)
    Starting     overloaded-0.1.3 (lib:optics-hasfield)
    Building     overloaded-0.1.3 (lib:optics-hasfield)
    Installing   overloaded-0.1.3 (lib:optics-hasfield)
    Completed    overloaded-0.1.3 (lib:optics-hasfield)
    
    ~ % ghci
    GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
    Loaded package environment from /home/phadej/.ghc/x86_64-linux-8.6.5/environments/default
    Prelude> :m +Optics.HasField
    Prelude Optics.HasField>
    

    Optics.HasField is a module of internal overloaded:optics-hasfield library. The above should not work.

  2. sebright commented on Dec 11, 2019

    @sebright
    Collaborator

    The unnecessary internal libraries in plan.json are probably caused by the dependency solver always solving for all components. #5413 and #5136 are also related.

  3. added
    re: internal library
    on Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cabal-install: cmd/installcabal-install: solverre: install --libre: internal librarytype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions