Skip to Content
Navigation:

A stick figure smiling

Here's a preview from my zine, Bite Size Linux!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

browse more comics! get the zine!
read the transcript!

panel 1:

Most programs on Linux use a bunch of C libraries.

Some popular libraries:

openssl (for SSL!)
sqlite (embedded db?)
zlib (gzip!)
lib pcre (regular expressions!)
libstdc++ (C++ standard library!)

panel 2:

There are 2 ways. to use any library:
1. Link it into your binary
your code (big binary with lots of things!) | zlib | sqlite
and
2. Use separate shared libraries
your code
zlib
sqlite
(all different files)

panel 3:

Programs like this
your code | zlib | sqlite
are called “statically linked”

programs like this your code
zlib
sqlite
are called “dynamically linked”

panel 4:

person 1: how can I tell what shared libraries a Program is using?
person 2: Idd!!

libz.so.1 => /lib/x86-64...  
lib resolv.so.2 =>....  
libc.so.6 =>... 

+34 more

panel 5:

person 1: I got a “library not found” error when running my binary?!

person 2: If you know where the library is, try setting the LD_LIBRARY_PATH environment variable

dynamic linker: LO-LIBRARY_PATH tells me where to look!

panel 6: Where the dynamic linker looks

  1. ODT. RPATH in your executable
  2. LD- LIBRARY_PATH
  3. DT- RUNPATH in executable
  4. /etc/ld.so.cache.
    (run Idconfig -p to See contents)
  5. /lib, /usr/lib

Saturday Morning Comics!

Want another comic like this in your email every Saturday? Sign up here!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2021 | All rights reserved (see the FAQ for notes about licensing)