Let's say I write some Haskell code and compile it in an Ubuntu 64-bit installation, statically linking all Haskell packages and c libraries. Would the result be binary compatible with any other 64-bit linux distribution?
Asked
Active
Viewed 406 times
11
-
1It should be, see e.g. http://stackoverflow.com/a/10549484/477476 and http://stackoverflow.com/a/5953787/477476 – Cactus Jul 22 '15 at 02:37
-
Wow, the binary that results from `ghc -02 test.hs -optl-static -optl-pthread` is about 2.5GB (test.hs contains `main = print "yes"`). – Nate Symer Jul 22 '15 at 19:43
-
1actually 2.5MB. Someone can't read `ls` output haha – Nate Symer Jul 28 '15 at 22:53
1 Answers
1
Yes, because of the static linking - it is all in the binary. And yes, they can get quite big, for example a yesod output can easily alot to 70MB. Yet, it has a HTTP server within that 70 MB.
So, static linking can thus help portability, but has it's drawbacks in terms of executable file size.

Tobi Nary
- 4,566
- 4
- 30
- 50