Small Haskell program compiled with GHC into huge binary

Let’s see what’s going on, try $ du -hs A 13M A $ file A A: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.27, not stripped $ ldd A linux-vdso.so.1 => (0x00007fff1b9ff000) libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x00007fb21f418000) libX11.so.6 => /usr/lib/libX11.so.6 (0x00007fb21f0d9000) libGLU.so.1 => /usr/lib/libGLU.so.1 (0x00007fb21ee6d000) libGL.so.1 => /usr/lib/libGL.so.1 … Read more

What do ‘statically linked’ and ‘dynamically linked’ mean?

There are (in most cases, discounting interpreted code) two stages in getting from source code (what you write) to executable code (what you run). The first is compilation which turns source code into object modules. The second, linking, is what combines object modules together to form an executable. The distinction is made for, among other … Read more