-
Notifications
You must be signed in to change notification settings - Fork 698
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
Work with GHC_PACKAGE_PATH #3728
Comments
OK, that sounds fine to me. |
Fixes haskell#3728. Fixes haskell#2711.
Fixes haskell#3728. Fixes haskell#2711.
@ttuegel this patch is likely to break In fact this will really break |
GHC_PACKAGE_PATH can really only specify an immutable global database: the paths are added before the global database, can't be cleared from the command line, and can't be installation targets. If I update |
Fixes haskell#3728. The previously applied fix only affected the old builder; this version applies to both.
This is blocked on #3651 (Support Nix in cabal-install). To really do this properly, cabal-install needs to pay attention to when certain environment variables change and reconfigure; this will break the usual workflow for Nix users unless I implement Nix integration first. |
I have reverted the partial solution I applied before in lieu of a complete solution. Therefore, this issue is still fully open. |
Hmm. I guess nix-local-build doesn't have this problem, because the passed in package databases are recorded as the part of the project shared config; when it changes the cache is invalidated. |
Right now, neither builder respects GHC_PACKAGE_PATH and so neither has this problem. I'm thinking that, to be truly correct, we should also reconfigure if other variables change, like PATH. |
The rabbit hole goes very deep. Not only should we rebuild if PATH changes, but we should rebuild if the binary pointed to inside path changes hash, or if any of the dynamic libraries that it would be linked against would change. Furthermore, for precision, we should only rebuild if we would have been affected by a change in PATH; e.g. if a user adds a path which doesn't affect any of the path lookups, that should not force us to relookup. (This would even be "easy" to do for Cabal's lookups on PATH, but if ghc independently tries to call out to the program you have more problems.) Gotta stop somewhere. |
That's a good point. To keep consistency with Cabal's current behavior, I think I will not reconfigure if GHC_PACKAGE_PATH changes; therefore, I will need to capture it during configuration and set the captured value before each call to GHC. |
I think this can be solved in a similar fashion as #7676. Maybe since it's less explicit than a flag and it could cause problems without the user knowing it's set, we could have a config option
I think that with proper warnings we can ignore this, like we do with --package-db. We don't perform that check on the global db either after all, and it can change too (eg. |
I believe this issue to be the source of a major annoyance for Guix users, a nix-like functional package manager. Contrary to nix, Guix makes heavy use of For example:
For this use case, it would be very handy if Cabal would expand elements in What would have to be implemented in order to get this issue resolved? |
Bump. Any ideas anybody? @ttuegel, do you perchance remember after only 8 years? |
Looking at the revert commit message it seems that it was reverted because it was deemed necessary to cache/store the If storing the |
I have also run into this today. I want to use the |
The patches by Thomas Tuegal are not sufficient for I am working on exploring how invasive/feasible proper |
**tl;dr** Applying this patch makes Cabal work in Guix environments and ensures that Cabal picks up Haskell packages installed via Guix. Guix makes heavy use of GHC_PACKAGE_PATH to make GHC pickup Haskell packages installed via the Guix package manager. The environment variable is set using native-search-paths from the GHC packages. Unfortunately, upstream Cabal does presently not respect GHC_PACKAGE_PATH. If this environment variable is set, `cabal build` and other commands will terminate. For building packages, Guix does not make much use of cabal-install hence this is not as big of an issue. However, cabal-install does therefore presently not work out-of-the-box in environments created by Guix. For example, in `guix shell` environments. This makes it essentially impossible to use Guix for setting up development environments for Haskell software. Cabal upstream is aware of this issue and a patch exists to workaround this problem. The patch is currently not merged upstream due to issues related to reconfiguration (changing GHC_PACKAGE_PATH between `cabal configure` and `cabal build`). However, I would argue that this edge case is not that relevant for Guix and therefore propose including this patch with the Cabal Guix package. As outlined above, cabal-install is not usable by default presently, and I would therefore argue that this is a major improvement over the current situation. I am willing to work with Cabal upstream to have this issue fixed upstream eventually. Note that this requires patching the GHC package instead of the cabal-install package as Guix uses the version of the Cabal package <https://hackage.haskell.org/package/Cabal> distributed with GHC. See: haskell/cabal#3728 * gnu/packages/haskell-apps.scm (cabal-install): Include patch to support the GHC_PACKAGE_PATH environment variable. Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> Signed-off-by: Lars-Dominik Braun <lars@6xq.net> Change-Id: Ib77ffa937b878690d0e2d8964b534842b99da039
**tl;dr** Applying this patch makes Cabal work in Guix environments and ensures that Cabal picks up Haskell packages installed via Guix. Guix makes heavy use of GHC_PACKAGE_PATH to make GHC pickup Haskell packages installed via the Guix package manager. The environment variable is set using native-search-paths from the GHC packages. Unfortunately, upstream Cabal does presently not respect GHC_PACKAGE_PATH. If this environment variable is set, `cabal build` and other commands will terminate. For building packages, Guix does not make much use of cabal-install hence this is not as big of an issue. However, cabal-install does therefore presently not work out-of-the-box in environments created by Guix. For example, in `guix shell` environments. This makes it essentially impossible to use Guix for setting up development environments for Haskell software. Cabal upstream is aware of this issue and a patch exists to workaround this problem. The patch is currently not merged upstream due to issues related to reconfiguration (changing GHC_PACKAGE_PATH between `cabal configure` and `cabal build`). However, I would argue that this edge case is not that relevant for Guix and therefore propose including this patch with the Cabal Guix package. As outlined above, cabal-install is not usable by default presently, and I would therefore argue that this is a major improvement over the current situation. I am willing to work with Cabal upstream to have this issue fixed upstream eventually. Note that this requires patching the GHC package instead of the cabal-install package as Guix uses the version of the Cabal package <https://hackage.haskell.org/package/Cabal> distributed with GHC. See: haskell/cabal#3728 * gnu/packages/haskell-apps.scm (cabal-install): Include patch to support the GHC_PACKAGE_PATH environment variable. Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> Signed-off-by: Lars-Dominik Braun <lars@6xq.net> Change-Id: Ib77ffa937b878690d0e2d8964b534842b99da039
**tl;dr** Applying this patch makes Cabal work in Guix environments and ensures that Cabal picks up Haskell packages installed via Guix. Guix makes heavy use of GHC_PACKAGE_PATH to make GHC pickup Haskell packages installed via the Guix package manager. The environment variable is set using native-search-paths from the GHC packages. Unfortunately, upstream Cabal does presently not respect GHC_PACKAGE_PATH. If this environment variable is set, `cabal build` and other commands will terminate. For building packages, Guix does not make much use of cabal-install hence this is not as big of an issue. However, cabal-install does therefore presently not work out-of-the-box in environments created by Guix. For example, in `guix shell` environments. This makes it essentially impossible to use Guix for setting up development environments for Haskell software. Cabal upstream is aware of this issue and a patch exists to workaround this problem. The patch is currently not merged upstream due to issues related to reconfiguration (changing GHC_PACKAGE_PATH between `cabal configure` and `cabal build`). However, I would argue that this edge case is not that relevant for Guix and therefore propose including this patch with the Cabal Guix package. As outlined above, cabal-install is not usable by default presently, and I would therefore argue that this is a major improvement over the current situation. I am willing to work with Cabal upstream to have this issue fixed upstream eventually. Note that this requires patching the GHC package instead of the cabal-install package as Guix uses the version of the Cabal package <https://hackage.haskell.org/package/Cabal> distributed with GHC. See: haskell/cabal#3728 * gnu/packages/haskell-apps.scm (cabal-install): Include patch to support the GHC_PACKAGE_PATH environment variable. Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> Signed-off-by: Lars-Dominik Braun <lars@6xq.net> Change-Id: Ib77ffa937b878690d0e2d8964b534842b99da039
**tl;dr** Applying this patch makes Cabal work in Guix environments and ensures that Cabal picks up Haskell packages installed via Guix. Guix makes heavy use of GHC_PACKAGE_PATH to make GHC pickup Haskell packages installed via the Guix package manager. The environment variable is set using native-search-paths from the GHC packages. Unfortunately, upstream Cabal does presently not respect GHC_PACKAGE_PATH. If this environment variable is set, `cabal build` and other commands will terminate. For building packages, Guix does not make much use of cabal-install hence this is not as big of an issue. However, cabal-install does therefore presently not work out-of-the-box in environments created by Guix. For example, in `guix shell` environments. This makes it essentially impossible to use Guix for setting up development environments for Haskell software. Cabal upstream is aware of this issue and a patch exists to workaround this problem. The patch is currently not merged upstream due to issues related to reconfiguration (changing GHC_PACKAGE_PATH between `cabal configure` and `cabal build`). However, I would argue that this edge case is not that relevant for Guix and therefore propose including this patch with the Cabal Guix package. As outlined above, cabal-install is not usable by default presently, and I would therefore argue that this is a major improvement over the current situation. I am willing to work with Cabal upstream to have this issue fixed upstream eventually. Note that this requires patching the GHC package instead of the cabal-install package as Guix uses the version of the Cabal package <https://hackage.haskell.org/package/Cabal> distributed with GHC. See: haskell/cabal#3728 * gnu/packages/haskell-apps.scm (cabal-install): Include patch to support the GHC_PACKAGE_PATH environment variable. Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> Signed-off-by: Lars-Dominik Braun <lars@6xq.net> Change-Id: Ib77ffa937b878690d0e2d8964b534842b99da039
FYI: Guix now patches Cabal with a variant of the patch proposed by Thomas Tuegal: https://git.savannah.gnu.org/cgit/guix.git/commit/?id=9236047476e728b9ae1746d56b8547e023f72307 for the reasons outlined above. Would still be cool to get a proper patch integrated into Cabal itself. |
Guix makes heavy use of GHC_PACKAGE_PATH to make GHC pickup Haskell packages installed via the Guix package manager. The environment variable is set using native-search-paths from the GHC packages. Unfortunately, upstream Cabal does presently not respect GHC_PACKAGE_PATH. If this environment variable is set, `cabal build` and other commands will terminate. For building packages, Guix does not make much use of cabal-install hence this is not as big of an issue. However, cabal-install does therefore presently not work out-of-the-box in environments created by Guix. For example, in `guix shell` environments. This makes it essentially impossible to use Guix for setting up development environments for Haskell software. Cabal upstream is aware of this issue and a patch exists to workaround this problem. The patch is currently not merged upstream due to issues related to reconfiguration (changing GHC_PACKAGE_PATH between `cabal configure` and `cabal build`). However, I would argue that this edge case is not that relevant for Guix and therefore propose including this patch with the Cabal Guix package. As outlined above, cabal-install is not usable by default presently, and I would therefore argue that this is a major improvement over the current situation. I am willing to work with Cabal upstream to have this issue fixed upstream eventually. Note that this requires patching the GHC package instead of the cabal-install package as Guix uses the version of the Cabal package <https://hackage.haskell.org/package/Cabal> distributed with GHC. See: haskell/cabal#3728 * gnu/packages/haskell-apps.scm (cabal-install): Include patch to support the GHC_PACKAGE_PATH environment variable. Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>
**tl;dr** Applying this patch makes Cabal work in Guix environments and ensures that Cabal picks up Haskell packages installed via Guix. Guix makes heavy use of GHC_PACKAGE_PATH to make GHC pickup Haskell packages installed via the Guix package manager. The environment variable is set using native-search-paths from the GHC packages. Unfortunately, upstream Cabal does presently not respect GHC_PACKAGE_PATH. If this environment variable is set, `cabal build` and other commands will terminate. For building packages, Guix does not make much use of cabal-install hence this is not as big of an issue. However, cabal-install does therefore presently not work out-of-the-box in environments created by Guix. For example, in `guix shell` environments. This makes it essentially impossible to use Guix for setting up development environments for Haskell software. Cabal upstream is aware of this issue and a patch exists to workaround this problem. The patch is currently not merged upstream due to issues related to reconfiguration (changing GHC_PACKAGE_PATH between `cabal configure` and `cabal build`). However, I would argue that this edge case is not that relevant for Guix and therefore propose including this patch with the Cabal Guix package. As outlined above, cabal-install is not usable by default presently, and I would therefore argue that this is a major improvement over the current situation. I am willing to work with Cabal upstream to have this issue fixed upstream eventually. Note that this requires patching the GHC package instead of the cabal-install package as Guix uses the version of the Cabal package <https://hackage.haskell.org/package/Cabal> distributed with GHC. See: haskell/cabal#3728 * gnu/packages/haskell-apps.scm (cabal-install): Include patch to support the GHC_PACKAGE_PATH environment variable. Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> Signed-off-by: Lars-Dominik Braun <lars@6xq.net> Change-Id: Ib77ffa937b878690d0e2d8964b534842b99da039
At the moment, Cabal will die if run with the
GHC_PACKAGE_PATH
environment variable set. I think this is an arbitrary restriction. Instead, it shouldGHC_PACKAGE_PATH
,configure
command by--package-db
, andGHC_PACKAGE_PATH
before invoking GHC.Cabal should do the same for
GHCJS_PACKAGE_PATH
.See also #2711.
I am implementing this in
reconfigure
./cc @ezyang @23Skidoo
The text was updated successfully, but these errors were encountered: