Repository navigation
Closed
Description
The bug
There is no (obvious) way to have cabal install a dynamically linked executable.
To Reproduce
With the following configuration
-- cabal.project
packages: .
executable-dynamic: True-- cabal.project.local
ignore-project: False
executable-dynamic: Trueif I run cabal install --enable-executable-dynamic, then a statically linked version of the executable gets installed:
$ ldd ~/.cabal/bin/<progname>
linux-vdso.so.1 (0x00007ffc2934b000)
libgmp.so.10 => /lib64/libgmp.so.10 (0x00007f1d49003000)
libc.so.6 => /lib64/libc.so.6 (0x00007f1d48e26000)
libm.so.6 => /lib64/libm.so.6 (0x00007f1d48d46000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1d490cd000)
Expected behavior
$ ldd ~/.cabal/bin/<progname>
linux-vdso.so.1 (0x00007ffe02fde000)
libHSbase-4.16.4.0-ghc9.2.7.so => ~/.ghcup/ghc/9.2.7/lib/ghc-9.2.7/base-4.16.4.0/libHSbase-4.16.4.0-ghc9.2.7.so (0x00007f440b000000)
libHSghc-bignum-1.2-ghc9.2.7.so => ~/.ghcup/ghc/9.2.7/lib/ghc-9.2.7/ghc-bignum-1.2/libHSghc-bignum-1.2-ghc9.2.7.so (0x00007f440baa4000)
libHSghc-prim-0.8.0-ghc9.2.7.so => ~/.ghcup/ghc/9.2.7/lib/ghc-9.2.7/ghc-prim-0.8.0/libHSghc-prim-0.8.0-ghc9.2.7.so (0x00007f440aa00000)
libHSrts-ghc9.2.7.so => ~/.ghcup/ghc/9.2.7/lib/ghc-9.2.7/rts/libHSrts-ghc9.2.7.so (0x00007f440af6e000)
libffi.so.7 => ~/.ghcup/ghc/9.2.7/lib/ghc-9.2.7/rts/libffi.so.7 (0x00007f440a600000)
libgmp.so.10 => /lib64/libgmp.so.10 (0x00007f440a95b000)
libc.so.6 => /lib64/libc.so.6 (0x00007f440a423000)
libm.so.6 => /lib64/libm.so.6 (0x00007f440a87b000)
librt.so.1 => /lib64/librt.so.1 (0x00007f440ba7a000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f440ba75000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f440ba6e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f440baf9000)
System information
- Operating system: Fedora Linux 37 (Workstation Edition) 6.2.10-200.fc37.x86_64
-
$ cabal --version cabal-install version 3.6.2.0 compiled using version 3.6.2.0 of the Cabal library $ ghc --version The Glorious Glasgow Haskell Compilation System, version 9.2.7
Additional information
I can get around the problem by putting ghc-options: -dynamic in the package.cabal file, but I don't think it's the appropriate solution.
Activity
Mikolaj commentedon Apr 19, 2023
I remember diagnosing this or a similar issue in the past. There should be a ticket with
cabal installin it. This looked not implemented and not that hard to implement, so volunteers are kindly welcome.ulysses4ever commentedon Apr 21, 2023
The closest I'm able to find are:
cabal v2-buildfails to override global config with--enable-static --disable-shared#6688But they're not exactly the same: they talk about
staticrather thandynamic... (and in one instance aboutbuildrather thaninstall).alt-romes commentedon Jan 8, 2024
This is another instance of #7297. The
--enable-executable-dynamicis simply not considered when building the sdist.cabal build --enable-executable-dynamicworks as expected.Apply project local options on install
Apply project local options on install
alt-romes commentedon Feb 5, 2024
Fix in #9697.
Apply local configuration to install targets
Apply local configuration to install targets
Apply local configuration to install targets
Apply local configuration to install targets
Apply local configuration to install targets
Apply local configuration to install targets
Apply local configuration to install targets
Apply local configuration to install targets
alt-romes commentedon Feb 12, 2024
Fixed by #9697
Apply local configuration to install targets