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

document "cabal install --lib" #6392

Closed
jwaldmann opened this issue Nov 30, 2019 · 11 comments
Closed

document "cabal install --lib" #6392

jwaldmann opened this issue Nov 30, 2019 · 11 comments

Comments

@jwaldmann
Copy link

Hi.

The "--lib" flag to "cabal install" is not mentioned at https://www.haskell.org/cabal/users-guide/installing-packages.html#building-and-installing-a-user-package , and is missing from https://www.haskell.org/cabal/users-guide/genindex.html .

This creates confusion: 1. what does the flag do? 2. are we even looking in the right place for documentation? - e.g., sandboxing, documented there, is no longer a thing since we have environment files now?

(e.g., tidalcycles/Tidal#572 (comment) )

@yaxu
Copy link

yaxu commented Nov 30, 2019

Yes, I don't understand why I have to specify --lib when the .cabal file makes clear that it is a library.

@phadej
Copy link
Collaborator

phadej commented Jan 14, 2020

@yaxu, is https://hackage.haskell.org/package/cpphs an executable or a library?

@yaxu
Copy link

yaxu commented Jan 14, 2020

@phadej I think you might know the answer. Can you be a bit more explicit with your point please?

@phadej
Copy link
Collaborator

phadej commented Jan 14, 2020

@yaxu, cpphs is both a library and executable. it's really not clear whether one should install executable part, or library or both.

Also, cabal install cpphs says "any cpphs", if for some package executables come and go, (e.g. in case of yaml where you have to toggle flag lately). The package components aren't "stable" under versions.

Note, that we have to also invoke solver before we can know what we can install, as if you use say older GHC, or you miss pkg-config libraries, there might still be a version of the package (library or executable) which is installable. cabal install cpphs doesn't mean to install the latest version.

All that can be changed, but please think about non-trivial scenarios too.

@yaxu
Copy link

yaxu commented Jan 14, 2020

@phadej cabal install cpphs seems to install both library and executable. That would fit with what I'd expect, unless I asked for one or the other.

cabal install tidal doesn't seem to install anything, which isn't what I'd expect.

@phadej
Copy link
Collaborator

phadej commented Jan 15, 2020

@yaxu, no it doesn't install the library. It builds it, and adds it to the store, but doesn't add it to the environment file. You cannot fire ghci -package-env=default and use the library.

@yaxu
Copy link

yaxu commented Jan 15, 2020

@phadej I see. I did check that I can load the library in ghci, but it's very possible I already have it installed via v1-install, which installs both.
This is changed behaviour, and I've been finding it difficult to understand and work with, as well as hitting bugs. I believe that there is underlying logic to this new behaviour, but I can't see how the default install of a library-only package is not to install it, is a logical outcome.
I currently tell people to install tidal by trying cabal install --lib tidal first, and if that breaks try cabal install tidal. This is confusing for new users, who often aren't programmers at all, and just want to use Tidal as end-user programmers, to make music. They're unlikely to want to install anything else. Perhaps stack is better for this use case?

@phadej
Copy link
Collaborator

phadej commented Jan 15, 2020

That's why I opened #6481.

@yaxu
Copy link

yaxu commented Jan 15, 2020

Thanks @phadej, that's appreciated.

@ulysses4ever
Copy link
Collaborator

Initial bug report was about lacking documentation, not the design of v2-install. Documentation seems to have catched up with: https://cabal.readthedocs.io/en/3.6/cabal-commands.html#adding-libraries-to-ghc-package-environments

Should this be closed?

@Mikolaj
Copy link
Member

Mikolaj commented May 16, 2022

Well spotted. Closing. Thank you everybody for comments.

@Mikolaj Mikolaj closed this as completed May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants