SQLite Forum

Ubuntu SQLite 3.33
There is an almost complicated explanation of why dynamically linked libraries lead to surprises, most often unpleasant ones such as you have encountered. You should study the subject if you intend to do much more development.

The usual solutions are: (1) ensure that the desired dynamically linked library is the one your application is actually bound to at runtime; or (2) statically link the desired library into your application.

Apparently you have elected not to take option 2, but have not yet taken option 1 either.  Option 2 would be easiest, and I would recommend it unless there is good reason (hidden so far) not to go that route.  Or you can build the sqlite3.so (or sqlite3.dylib on Apple's mangle of FreeBSD) yourself and arrange that at least your application always (dynamically) loads the library it needs. Making option 1 work will involve setting the LD_LIBRARY_PATH environment variable (which comes with its own set of difficulties) or making sure your dynamic library is placed correctly to be preferred over other like-named files.