-
Notifications
You must be signed in to change notification settings - Fork 703
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
[nix-local-build] Support --prefix
, --datadir
, etc
#3586
Comments
Do these flags effect building or just installing? I vaguely recall with edit answer seems to be #3473 |
They affect building because prefix paths will affect what RPATHs we bake into the libraries we produce, as well as any hardcoded paths via a |
I tagged this to high priority, as e.g. |
Surely less high priority than getting new-install working, though? |
I would like to take a stab at this if this is still wanted. Are there any pointers as to where to start? I did a bit of digging and found this module choosing some default cabal/cabal-install/Distribution/Client/ProjectPlanning.hs Lines 1550 to 1573 in 6a97912
|
I observe that this issue breaks Because these tools are necessary to bootstrap and use Haskell world, I’ve thrown in the towel and just used an ugly hack of replacing this incorrect path in the binary with the correct path padded with extraneous port contents alex
Port alex contains:
/opt/local/bin/alex
/opt/local/share/alex/AlexTemplate.hs
/opt/local/share/alex/AlexWrappers.hs
port contents happy
Port happy contains:
/opt/local/bin/happy
/opt/local/share/happy/GLR_Base
/opt/local/share/happy/GLR_Lib
/opt/local/share/happy/GLR_Lib-ghc
/opt/local/share/happy/GLR_Lib-ghc-debug
/opt/local/share/happy/HappyTemplate
/opt/local/share/happy/HappyTemplate-arrays
/opt/local/share/happy/HappyTemplate-arrays-coerce
/opt/local/share/happy/HappyTemplate-arrays-coerce-debug
/opt/local/share/happy/HappyTemplate-arrays-debug
/opt/local/share/happy/HappyTemplate-arrays-ghc
/opt/local/share/happy/HappyTemplate-arrays-ghc-debug
/opt/local/share/happy/HappyTemplate-coerce
/opt/local/share/happy/HappyTemplate-ghc |
@essandess: That's unfortunate. Does the workaround in #3586 (comment) work for you? Optionally with |
* Addresses broken datadir issue: haskell/cabal#3586
* Addresses broken datadir issue: haskell/cabal#3586
We’re using It’s ancient practice with Unix build tools to use The Setting up a chroot jail environment for a package manger install is something that almost certainly will never happen. |
The I agree this should be just fixed and I don't remember any particular difficulty apart of the sprawling code base and testsuite. Right --- and @fgaz confirms above we don't expect any traps or conflicts, so the "longstanding" is not an indication of technical problems, just social ones. |
How does that one work? I don't see anything in the $ man cabal | egrep -e pkg[-_]datadir
$ cabal build --help | egrep -e pkg[-_]datadir https://cabal.readthedocs.io/en/stable/search.html?q=pkg_datadir&check_keywords=yes&area=default
|
* Addresses broken datadir issue: haskell/cabal#3586
* Addresses broken datadir issue: haskell/cabal#3586
I'm looking at this now and whew its a complicated mess. Honestly, I'm not sure if datafiles ever really did work at all with v2. @fgaz can you show an example where they work and in particular show where the copying is supposed to take place? It looks to me like neither In any case, I think I'm on track to get I don't think my brain has the capacity to handle prefix or the other installDir flags in the same PR, nor am I sure how many of them make sense at all. |
First of all: nobody addressed #3586 (comment). Cabal is like make, cabal-install is like apt. You wouldn't call apt while building a package for arch or fedora, right? The distinction is still there exactly for this reason. Nix, debian, arch... all use Cabal (with appropriate --prefix, --datadir, etc), and use their respective package manager to... do package manager things.
if using cabal-install is actually needed for distro packaging (though haskell is not at npm-like crazy level of dependencies so I don't see why), try to use it just to generate a build plan to then execute with your distro package manager. haskell.nix does this. Our bootstrap script does something similar. Another example. If that's still not enough, there's
Agda uses them, they work.
v2-build sets the paths to the values they would assume if the package was installed in the store. v2-run takes care of overriding that through
I think we should make it clear that this is not like |
Ah I see. Thanks!
cabal/Cabal/src/Distribution/Simple.hs Line 568 in 0abbe37
Which in turn is the One True place that datafiles are copied to where they're assigned. That said, I don't understand the objection to just letting the --datadir flag set the underlying --datadir that eventually gets sent to I'm open to the argument that nobody actually needs this. But I also think requiring end users (not distros) to not use So I'm very much of two minds here. |
@fgaz: what's your opinion on fixing @essandess: apologies for the confusion
I meant
I thought you were referring to that one. but apparently not. :) |
Ok, I have a funny in-between proposal. so I suggest we A) remove the options from This maybe satisfies all concerns? |
No, not quite. It works work fine for statically-linked executables. The problem is with dynamically-linked executables - breviary l because in addition to copying the executable itself (pretty much anywhere, should run ok regardless), now need to copy all of the shared libraries - and somehow make sure the loader would be able to find them. |
Is this related to support for the existing installDirs flags (--prefix, --datadir, etc)? Or is this another feature you would like? I.e. is it about restoring feature parity with v1-build and the installdirs flags in some other way, or...? |
Both
new-configure
andnew-build
seem to silently swallow these options at the moment.The text was updated successfully, but these errors were encountered: