How to statically link some external libraries?

I want to produce a statically-linked executable. First I tried "-optl-static -optc-static -optl-pthrea", which statically links all external libraries. But when I ran this executable it gives me "abort (core dumped)" error. I suspect the statically-linked glibc library might be the cause. So I decide to statically link all other libraries and leave the glibc as a dynamic library. How to do this using Cabal? Should I write a custom "Setup.hs"?

Hi, This is what I have in my .cabal file to get a statically-linked executable: ghc-options: -Wall -static -threaded cc-options: -static ld-options: -static -pthread Sylvain On 18/07/2017 20:46, Kai Zhang wrote:
I want to produce a statically-linked executable. First I tried "-optl-static -optc-static -optl-pthrea", which statically links all external libraries. But when I ran this executable it gives me "abort (core dumped)" error. I suspect the statically-linked glibc library might be the cause. So I decide to statically link all other libraries and leave the glibc as a dynamic library. How to do this using Cabal? Should I write a custom "Setup.hs"?
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

Thanks, but that would link all libraries statically.
On Wed, Jul 19, 2017 at 1:17 AM Sylvain Henry
Hi,
This is what I have in my .cabal file to get a statically-linked executable:
ghc-options: -Wall -static -threaded cc-options: -static ld-options: -static -pthread
Sylvain
On 18/07/2017 20:46, Kai Zhang wrote:
I want to produce a statically-linked executable. First I tried "-optl-static -optc-static -optl-pthrea", which statically links all external libraries. But when I ran this executable it gives me "abort (core dumped)" error. I suspect the statically-linked glibc library might be the cause. So I decide to statically link all other libraries and leave the glibc as a dynamic library. How to do this using Cabal? Should I write a custom "Setup.hs"?
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to:http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
participants (3)
-
Kai Zhang
-
Kai Zhang
-
Sylvain Henry