[odb-users] libodb with cmake

Alex Beimler beimler at jaeschke.de
Thu Feb 19 13:43:37 EST 2015

Hmmm ok,
Is there a option to setup the build-dir for the obj-Files?

I have the Problem to build libodb and libodb-sqlite as static lib.
I think the Problem is the linker chooses the shared lib instead of the 
static lib.
There is a Linker-Error of undefined reference to odb::statments::.. 
(and other odb-functions):
lib/libodb-sqlite.a(statement.o): In Funktion 
./thirdparty/libodb-sqlite/odb/sqlite/statement.cxx:25: undefined 
reference to
lib/libodb-sqlite.a(statement.o): In Funktion 
`odb::sqlite::statement::init(char const*, unsigned long, 
odb::sqlite::statement_kind, odb::sqlite::binding const*, bool)':
./thirdparty/libodb-sqlite/odb/sqlite/statement.cxx:73: undefined 
reference to
`odb::statement::process_update(char const*, void const* const*, 
unsigned long, unsigned long, char, std::string&)'
undefined reference to 
`odb::connection::cache_query_(odb::prepared_query_impl*, std::type_info 
const&, void*, std::type_info const*, void (*)(void*))'
undefined reference tof 
`odb::connection::cache_query_(odb::prepared_query_impl*, std::type_info 
const&, void*, std::type_info const*, void (*)(void*))'

My application links:
g++ ... -std=c++14 ... -g -Wall .......cpp.o ...  ...-odb.cxx.o ... -o 
application ... libodb.a libodb-sqlite.a 
thirdparty/sqlite3/libsqlite3-static.a -lpthread -ldl

I use the --with-libodb=${OUT_BUILD_DIR}  to set libpath, but it does 
not work if i have already a shared lib (maybe in /usr/local/lib or 
libodb-sqlite is build with:
gcc ... -L${OUT_BUILD_DIR} -lodb -lsqlite3  -lpthread

What if i have build sqlite3 as static lib and use this in my project 
but libodb-sqlite chooses the shared librarys from systempath 

But if i link my application this way:
g++ ... -std=c++14 ... -g -Wall .......cpp.o ...  ...-odb.cxx.o ... -o 
application ... libodb.so libodb-sqlite.a 
thirdparty/sqlite3/libsqlite3-static.a -lpthread -ldl

it works, but dont feel right.

Am 19.02.2015 um 15:55 schrieb Boris Kolpackov:
> Hi Alex,
> Alex Beimler<alex-beimler at web.de>  writes:
>> Is there a Full Support of cmake for libodb, libodb-sqlite, libodb-...
>> I mean not the odb-Compiler (already solved this Problem) or the
>> FindPackage-Modul.
> Ok, you mean building the ODB runtimes with CMake. No, there is
> no such support and I have no immediate plans to implement it
> (really don't like CMake).
> But if someone is prepared to implement this and maintain it
> afterwards, then I can consider adding them to the package.
> In fact, the VC++ projects/solutions and the autotools-based
> build system are all automatically generated by the 'build',
> our own make-based development build system. Nothing will
> prevent us from doing the same for CMake. So the main effort
> will be to come up with the initial implementation.
> Boris

More information about the odb-users mailing list