[odb-users] Linux Linking ODB - libtool vs g++

Boris Kolpackov boris at codesynthesis.com
Tue Aug 30 11:30:07 EDT 2011


Hi Thomas,

[CC'ed odb-users in case others run into a similar issue.]

Szumowski, Thomas <thomas.szumowski at lmco.com> writes:

> ldd /usr/local/lib/libodb-sqlite.so 
>         libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x00b83000)

Ok, I think I know what's going on here. You have two versions of
libsqlite3.so, one in /usr/lib and the other in /usr/local/lib.
/usr/local/lib doesn't appear to be in your LD_LIBRARY_PATH and
when you use the g++ command line to link the example, it 
resolves libsqlite3.so to /usr/lib/libsqlite3.so (just like in
the ldd output above). libsqlite3.so in /usr/lib is probably 
quite old and that's the reason why sqlite3_open_v2 is reported
unresolved.

When you added -rpath /usr/local/lib to the g++ command line, that
added this directory to the library search list and the correct 
libsqlite3.so was used. Similarly, adding /usr/local/lib to 
LD_LIBRARY_PATH fixes the problem.

So, I would say, the recommended solution it to add /usr/local/lib
to LD_LIBRARY_PATH or, better yet, as Dan suggested, add it to
/etc/ld.so.conf (and don't forget to run ldconfig).

Boris



More information about the odb-users mailing list