-
Notifications
You must be signed in to change notification settings - Fork 702
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
cabal-install doesn't consider build-tools as dependencies #220
Comments
(Imported comment by @dcoutts on 2008-02-01) One problem is that not all build-tools correspond to haskell packages. Some do some don't. We have a hard coded list of them at the moment (which can be extended in Setup.hs files) so we could extend that with what haskell package if any the tools correspond to. Any better suggestions to make it a tad more generic? |
(Imported comment by @dcoutts on 2008-02-28) This limitation clearly confuses people.
|
(Imported comment by darrint on 2008-06-16) Seems like what you need is to be able to determine which packages provide which executables. Alex, for instance, declares that it provides an executable by that name. For the next release of cabal-install, maybe change the package repository metadata format to include more (all?) the cabal info instead of a file list. That will allow you to solve more situations and do a full install plan up front. Would that work? |
(Imported comment by @dcoutts on 2008-06-16) See also #342 |
(Imported comment by @mcandre on 2009-01-05) I have the same problem with ncurses and c2hs. I'd really like dependencies to be handled automatically whenever possible. |
Looking forward to this being fixed. |
@mietek right now this is blocked on no one having the time to work on this. If you're interested perhaps you could take a look? If you have any questions you can write to cabal-devel@haskell.org. |
@tibbe: I can't right now, but I am interested in solving this, in one way or another. |
👍 |
Halcyon supports declaring and automatically installing Similarly, you can use See Haskell Language for an example of declaring alex and happy as sandbox extra apps. |
This is quite a big flaw. I am an Haskell newbie, but i will try to put my two cents in order to keep the discussion alive
What is the purpose of |
|
IMHO to keep this KISS-y, If, at some point in the future, we want to support auto-installing /cc @kosmikus |
@hvr’s suggestion would certainly make the experience less frustrating. As it is, you’ll only find out you’re missing a build-tool halfway through building your dependencies — and that’s if you’re paying attention, because #1924 means unless you manually abort the build, you’ll continue burning CPU cycles on something which has no chance of succeeding. |
Fixes SublimeHaskell#184 Fixes SublimeHaskell#240 See: - b2a391257ccff8e191fde98ba949e91fa65e6daf - haskell/cabal#220
I recently discovered that build-tools can be used to specify dependencies on internal executables (haskell#220). This means that we can make a nice improvement to the package-tests test suite: instead of manually building a Setup.hs script ourselves, we can add one to the Cabal file for Cabal, and have the test suite have a build-tools dependency on it. Perhaps the only objection to this is that the Cabal *library* now has an executable cabal-setup. Maybe with some buildable shenanigans we can make it so that we never build this executable unless the user asks for it, or the test suite is enabled. Alternately, cabal-setup is a generally handy executable to have around. In fact, we can use this idea to completely kill the LBI hack. But I'm going to leave that for another patchset, assuming we like this one. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
I recently discovered that build-tools can be used to specify dependencies on internal executables (haskell#220). This means that we can make a nice improvement to the package-tests test suite: instead of manually building a Setup.hs script ourselves, we can add one to the Cabal file for Cabal, and have the test suite have a build-tools dependency on it. Perhaps the only objection to this is that the Cabal *library* now has an executable cabal-setup. Maybe with some buildable shenanigans we can make it so that we never build this executable unless the user asks for it, or the test suite is enabled. Alternately, cabal-setup is a generally handy executable to have around. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
I recently discovered that build-tools can be used to specify dependencies on internal executables (haskell#220). This means that we can make a nice improvement to the package-tests test suite: instead of manually building a Setup.hs script ourselves, we can add one to the Cabal file for Cabal, and have the test suite have a build-tools dependency on it. Perhaps the only objection to this is that the Cabal *library* now has an executable cabal-setup. Maybe with some buildable shenanigans we can make it so that we never build this executable unless the user asks for it, or the test suite is enabled. Alternately, cabal-setup is a generally handy executable to have around. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
I recently discovered that build-tools can be used to specify dependencies on internal executables (haskell#220). This means that we can make a nice improvement to the package-tests test suite: instead of manually building a Setup.hs script ourselves, we can add one to the Cabal file for Cabal, and have the test suite have a build-tools dependency on it. Perhaps the only objection to this is that the Cabal *library* now has an executable cabal-setup. Maybe with some buildable shenanigans we can make it so that we never build this executable unless the user asks for it, or the test suite is enabled. Alternately, cabal-setup is a generally handy executable to have around. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
I recently discovered that build-tools can be used to specify dependencies on internal executables (haskell#220). This means that we can make a nice improvement to the package-tests test suite: instead of manually building a Setup.hs script ourselves, we can add one to the Cabal file for Cabal, and have the test suite have a build-tools dependency on it. Perhaps the only objection to this is that the Cabal *library* now has an executable cabal-setup. Maybe with some buildable shenanigans we can make it so that we never build this executable unless the user asks for it, or the test suite is enabled. Alternately, cabal-setup is a generally handy executable to have around. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
CC @hvr I implemented this in #3662 and I realized that we'll need to change
|
as we discussed on IRC, it turns out that "proposal B" is starting to look a lot more attractive given the pointed out issues, as requires less confusing magic/fallback tricks |
This fixes haskell#220: new-build now builds, installs and adds executables to PATH automatically if they show up in 'build-tools'. However, there is still more that could be done: the new behavior only applies to a specific list of 'build-tools' (alex, happy, etc) which Cabal recognizes out of the box. The plan is to introduce a new 'tool-depends' field to allow dependencies on other executables as well. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Summary by @ezyang. When you write
build-tools: alex
, Cabal only checks that an executable of this name is installed;cabal-install
does not know that if there is no such executable,alex
needs to be installed. One complication is thatbuild-tools
does not necessarily correspond to a package, so it is not a priori obvious tocabal-install
what should be installed to get an executable.Here is Proposal A: Build-tools only
build-tools
goal, similar to howsetup
qualified goals work.build-tools
as a package name, and we solve for each build-tool as a separatebuild-tools
dependency (so we don't do something goofy like try to solve forhappy
andalex
's dependency sets consistently when they really couldn't care less.)build-tools
fields don't correspond to actual packages. We give two escape hooks in this situation. First, Cabal has an internal mapping of build tools toMaybe PackageName
. IfNothing
, this indicates that the build-tool is not managed by Cabal and we shouldn't try to solve for it. IfJust pn
, then it means that installingpn
will also install the requested executable. This mapping will be configurable using thebuild-tool-packages
field in acabal-project
and also modifiable by command line argument. (Names can be bikeshedded of course.) Our second escape hook is, if abuild-tool
refers to an unknown package name, we print a warning but continue to solve, simply ignoring that package. A user can suppress the warning by disabling this using the aforementioned flag.Consider these examples:
build-tools: mytoolpkg
: cabal-install will install all executables defined by a package namedmytoolpkg
, and ensure they are available prior to building this package.build-tools: gtk2hsc2hs
: cabal-install is hard-coded to know that thegtk2hsc2hs
executable is provided by thegtk2hs-buildtools
, so it ensures that it builds and installs all executables from the package before building this package.build-tools: someprog
, plus a flag--provides-build-tool someprog=somepkg
, cabal-install seessomeprog
(which has no package), but using the flag mapping it knows thatsomepkg
is the package that provides this build tool.Here is Proposal B: tool-depends
build-tools
goal, similar to howsetup
qualified goals work. (Like before)tool-depends
field, which consists ofpkg:exename version-constraints
specifications, e.g.,tool-depends: gtk2hs-buildtools:gtk2hs2hs < 2.0
. This means that we must build thegtk2hsc2hs
executable fromgtk2hs-buildtools
before building this package. In principle cabal-install need only build thegtk2hsc2hs
executable, although today's setup interface doesn't allow one to selectively enable executables, so we'd probably just build all executables. If qualification is omitted it is assumed that you need ALL executables from the package.build-tools
refers exclusively to non-packaged executables, e.g. provided by the system. However, for backwards compatibility, we introduce an internal mapping hard-coded into GHC which maps somebuild-tools
fields to package names. The intended interpretation is thatbuild-tools: happy > 0.4
actually elaborates totool-depends: happy:happy > 0.4
. This mapping will be configurable using thebuild-tool-packages
field in acabal-project
and also modifiable by command line argument. (Names can be bikeshedded of course.)Examples:
tool-depends: mytoolpkg
: cabal-install will install all executables defined by a package namedmytoolpkg
, and ensure they are available prior to building this package.tool-depends: mytoolpkg:mytool
: cabal-install will install the executablemytool
frommytoolpkg
before building this packagebuild-tools: happy
: this is equivalent to writingtool-depends: happy:happy
.build-tools: someprog
: as before this does not effect solver behavior; there just simply needs to be asomeprog
in the path.(Imported from Trac #227, reported by guest on 2008-02-01)
On #haskell, nelhage mentioned that one of the bugs he ran into while trying to install Yi-0.3 through cabal-install was an error which looked like this:
That is, the dependency on Alex (a version which satisfied >=2.0.1&&<3) was not met. Perfectly sensible as he did not have Alex installed. Puzzled, he did a 'cabal install alex', which worked, and then re-started. (I guess he had his GHC installed locally?).
He and I were puzzled, because cabal-install is supposed/usually does track down dependencies. Is build-tools excluded for a reason, or was it just accidentally omitted from dependency-tracking? If the latter, I think this is a bit of a bug.
(I use Cabal-1.2.3.0, btw, and the error message above was my reproduction of Nelhage's problem. I had to uninstall Alex from my system, but that did the trick, and reinstalling bypassed the issue just fine - which is why I hadn't seen it before.)
gwern
The text was updated successfully, but these errors were encountered: