-lXYZ is a linker shortcut; it tells the linker to look for libXYZ.a, e.g. to link with libm.a you just specify -lm. So if you specify -lsqlite3.so the linker dutifully adds lib and .a and goes off looking for libsqlite3.so.a. If you want it to link with sqlite3.so, just leave the -l prefix off.