I have a custom build of SQLite3 at /somepath
, so /somepath/.libs
contains libsqlite3.so.0.8.6
and the symbolic links to it. I wanted to link a program against it and assumed
g++ -O3 -g -fPIC -I /somepath -I /somepath/src -L /somepath/.libs -lsqlite3 -o myfile.so myfile.cpp
would work. It compiles, but I get a segmentation fault due to some problem in my code, and when trying to debug I run into the issues which look like LD_PRELOAD not working with my program and Setting my lib for LD_PRELOAD makes some processes produce loader errors: I can run LD_PRELOAD=myfile.so /somepath/sqlite3 ...
, but under GDB I get symbol lookup error and LD_DEBUG=all LD_PRELOAD=myfile.so gdc -c core /somepath/sqlite3 ...
reveals symbols are getting looked up in /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
instead of /somepath/libsqlite3.so.0
, and unsurprisingly missing the symbols for functions added in the custom build. How can I fix this and debug my code?