-
Notifications
You must be signed in to change notification settings - Fork 722
Open
Labels
Description
Context
- pkg-config: Use --libs --static when building with using --enable-executable-staticย #6935 (comment)
- https://discourse.haskell.org/t/adding-template-haskell-library-produces-linker-error-on-alpine/13000
Problem description
When linking executable A fully statically (--enable-executable-static
) against a Haskell library B, which has defined extra-libraries-static
(either explicitly or implicitly through pkg-config
), then this information is not used when linking A.
Illustration:
+ executable A
- extra-libraries-static <- respected
- extra-libraries <- respected
+ library dependency B
- extra-libraries-static <- ignored
- extra-libraries <- respected
Reproducer
https://github.com/hasufell/cabal-extra-libraries
Error
This will produce errors as such:
/home/buildozer/aports/main/curl/src/curl-8.14.1/lib/curl_ntlm_core.c:378:0: error:
(.text+0x1f6): undefined reference to `DES_ecb_encrypt'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/buildozer/aports/main/curl/src/curl-8.14.1/lib/curl_ntlm_core.c:382:(.text+0x21b): undefined reference to `DES_ecb_encrypt'
collect2: error: ld returned 1 exit status
ghc-9.6.7: `gcc' failed in phase `Linker'. (Exit code: 1)
Full build log: https://gist.github.com/hasufell/71755429d3c617701e5a2b276cea5524
angerman