Skip to content

cabal install ignores --enable-executable-dynamic flag #8909

Closed

Description

@FedericoStra

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: True

if 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

  1. Mikolaj commented on Apr 19, 2023

    @Mikolaj
    Member

    I remember diagnosing this or a similar issue in the past. There should be a ticket with cabal install in it. This looked not implemented and not that hard to implement, so volunteers are kindly welcome.

  2. ulysses4ever commented on Apr 21, 2023

    @ulysses4ever
    Collaborator

    The closest I'm able to find are:

    But they're not exactly the same: they talk about static rather than dynamic... (and in one instance about build rather than install).

  3. self-assigned this
    on Jan 8, 2024
  4. alt-romes commented on Jan 8, 2024

    @alt-romes
    Collaborator

    This is another instance of #7297. The --enable-executable-dynamic is simply not considered when building the sdist.
    cabal build --enable-executable-dynamic works as expected.

  5. alt-romes commented on Feb 5, 2024

    @alt-romes
    Collaborator

    Fix in #9697.

  6. alt-romes commented on Feb 12, 2024

    @alt-romes
    Collaborator

    Fixed by #9697

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions