Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
phadej opened this issue Dec 8, 2019 · 2 comments
Open

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

phadej opened this issue Dec 8, 2019 · 2 comments
Labels
cabal-install: cmd/install cabal-install: solver re: install --lib Concerning `cabal install --lib` re: internal library Concerning internal libraries in packages type: bug

Comments

@phadej
Copy link
Collaborator

phadej commented Dec 8, 2019

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.

@hvr hvr added the type: bug label Dec 8, 2019
@phadej
Copy link
Collaborator Author

phadej commented Dec 8, 2019

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.

@grayjay
Copy link
Collaborator

grayjay commented Dec 11, 2019

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.

@jneira jneira added re: install --lib Concerning `cabal install --lib` cabal-install: cmd/install labels Jul 27, 2022
@andreasabel andreasabel added the re: internal library Concerning internal libraries in packages label Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cabal-install: cmd/install cabal-install: solver re: install --lib Concerning `cabal install --lib` re: internal library Concerning internal libraries in packages type: bug
Projects
None yet
Development

No branches or pull requests

6 participants