You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
scope:private executables broken with v2-install #6339
If I use a private executable with v1-install (tested inside a v1-sandbox) I get the behaviour I'm looking for:
the private executable is only installed in the libexec dir
I can run the executable from another program in the package with the help of the Paths_ module
With v2-install (on Linux):
cabal-install installs a broken symlink in installdir for the private executable
executables can have different component hashes. Using getLibexecDir from the public executable in the package doesn't give me the location of the others.
item 1. seems to be a bug.
I'm not sure about 2. How should I find a private executable if it's not a bug?
For reference, the code that doesn't work (from Main.hs in the attached archive):
main = do
putStrLn "Hello, Haskell! (public)"
libexec <- getLibexecDir
callProcess (libexec </> "private") []
To Reproduce
$ cabal v2-install testprivate-0.1.0.0.tar.gz
Expected behavior
testprivate is installed in installdir. When run, it should the private executable. The expected output is:
(2) is a known problem. The whole Paths_* mechanism is still in need of an overhaul for v2-build. Essentially we'd need to have a way to refer to other components' paths, so everything would have to be parameterised by UnitId for example.
Even though I introduced this feature I've stopped needing it so I don't really have much motivation to get it working on v2, but I'd be happy to help guide anyone who wants to tackle it.
When used with --install-method=copy, private executables cause the whole install to fail, rather than continuing after creating a broken symlink:
luite@linux$ cabal v2-install --install-method=copy
Wrote tarball sdist to
/home/luite/tmp/testprivate-0.1.0.0/dist-newstyle/sdist/testprivate-0.1.0.0.tar.gz
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
- testprivate-0.1.0.0 (exe:testprivate) (requires build)
- testprivate-0.1.0.0 (exe:private) (requires build)
Starting testprivate-0.1.0.0 (exe:testprivate)
Starting testprivate-0.1.0.0 (exe:private)
Building testprivate-0.1.0.0 (exe:private)
Building testprivate-0.1.0.0 (exe:testprivate)
Installing testprivate-0.1.0.0 (exe:private)
Completed testprivate-0.1.0.0 (exe:private)
Installing testprivate-0.1.0.0 (exe:testprivate)
Completed testprivate-0.1.0.0 (exe:testprivate)
Copying 'testprivate'
Copying 'private'
/home/luite/.cabal/store/ghc-8.6.5/testprivate-0.1.0.0-c74c0b2822283528a9b67bc922efc84031490d8d9d1396723a6340809089a5a8/bin/private: copyFile:atomicCopyFileContents:withReplacementFile:copyFileToHandle:openBinaryFile: does not exist (No such file or directory)
Unfortunately on Windows, we have to use --install-method=copy, since cabal-install doesn't support creating symlinks on Windows (the operating system does, although it's not enabled by default), and aborts the installation.
Looks like this problem is in Distribution.Client.CmdInstall, which should skip the private executable components in installExes or installUnitExes
Also the Path_name.getLibexecDir returns ~/.cabal/libexec/x86_64-linux-ghc-9.0.2/name-0.1.0
But ~/.cabal/libexec does not exist, ~/.cabal/store/ghc-9.0.2/abxm-0.1.0-e-name-332ce6bc0916b5af18d41d066c39d02b1c4eb6afb09f86d4c711a76aefab8689/libexec is where the un-linked executable is stored.
Sorry, did not follow the link at all... ( i presumed it would lead me to compiling cabal from source, or some messy install )
After updating nix channels, and adding ghcup to the list of packges, i get this from nix-shell:
error: Package ‘ghcup-0.1.17.10’ in /nix/store/69pqivsw2n1mg90fnq24dsg8k4w6yaz6-nixpkgs/nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix:109308 is marked as broken, refusing to evaluate.
And thank you for the investigation of what's failing. I guess we have enough clues, together with the old discussion, for somebody to dig deeper and fix it.
Activity
DanielG commentedon Nov 8, 2019
Thanks for the report.
(1) does sound like a bug yeah and
(2) is a known problem. The whole
Paths_*mechanism is still in need of an overhaul for v2-build. Essentially we'd need to have a way to refer to other components' paths, so everything would have to be parameterised by UnitId for example.Related issues: #5997, #4503
Even though I introduced this feature I've stopped needing it so I don't really have much motivation to get it working on v2, but I'd be happy to help guide anyone who wants to tackle it.
[-]private executables broken with v2-install?[/-][+]scope:private executables broken with v2-install[/+]luite commentedon Dec 11, 2019
When used with
--install-method=copy, private executables cause the whole install to fail, rather than continuing after creating a broken symlink:Unfortunately on Windows, we have to use
--install-method=copy, sincecabal-installdoesn't support creating symlinks on Windows (the operating system does, although it's not enabled by default), and aborts the installation.Looks like this problem is in
Distribution.Client.CmdInstall, which should skip the private executable components ininstallExesorinstallUnitExesalpha-bit commentedon Jul 4, 2022
Bumped into this issue today... ping.
For scope: private, still generates a broken link, and fails with --install-method=copy
Mikolaj commentedon Jul 4, 2022
Probably not fixed, but could you try with cabal 3.8.0.20220526 (https://discourse.haskell.org/t/cabal-3-8-pre-released)?
alpha-bit commentedon Jul 4, 2022
Noticing...
At https://cabal.readthedocs.io/en/3.6/cabal-package.html#executables says the executable is stored at $libexecdir/$libexecsubdir
But there is not a Path_name.getLibexecSubdir, to access the supposed $libexecdir/$libexecsubdir
https://cabal.readthedocs.io/en/3.6/cabal-package.html#accessing-data-files-from-package-code
Also the Path_name.getLibexecDir returns ~/.cabal/libexec/x86_64-linux-ghc-9.0.2/name-0.1.0
But ~/.cabal/libexec does not exist, ~/.cabal/store/ghc-9.0.2/abxm-0.1.0-e-name-332ce6bc0916b5af18d41d066c39d02b1c4eb6afb09f86d4c711a76aefab8689/libexec is where the un-linked executable is stored.
O.o ... scope: private seams a mess.
alpha-bit commentedon Jul 4, 2022
using version from nixpkgs... and have no idea on how to install a newer version.
tried: cabal install cabal-install
... and got not that version:
... i can survive without scope:private... :) ... just reporting the bug.
Mikolaj commentedon Jul 4, 2022
You'd install with ghcup, It's described in the link I gave.
alpha-bit commentedon Jul 4, 2022
Sorry, did not follow the link at all... ( i presumed it would lead me to compiling cabal from source, or some messy install )
After updating nix channels, and adding ghcup to the list of packges, i get this from nix-shell:
error: Package ‘ghcup-0.1.17.10’ in /nix/store/69pqivsw2n1mg90fnq24dsg8k4w6yaz6-nixpkgs/nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix:109308 is marked as broken, refusing to evaluate.
O.o ... so... noticed that there is a https://downloads.haskell.org/cabal/cabal-install-3.8.1.0-rc1/cabal-install-3.8.0.20220526-x86_64-linux-deb10.tar.xz
Downloaded, uncompressed, it has a cabal and a plan.json.
Tried it, it runs... :) ... and the bug persists, exactly as i described it initialy... :(
Mikolaj commentedon Jul 4, 2022
Thank you for the confirmation. I appreciate it.
Mikolaj commentedon Jul 4, 2022
And thank you for the investigation of what's failing. I guess we have enough clues, together with the old discussion, for somebody to dig deeper and fix it.