[odb-users] Unable to build with static libraries

Chris Richards chris.richards at yellowfeather.co.uk
Thu Oct 11 04:43:28 EDT 2012


Hi Boris,

The examples now build OK, but it looks as though they are still using 
the shared libraries. When I run 'ldd driver' on the hello example I get 
the following:

[chrisr at localhost hello]$ ldd driver
         linux-gate.so.1 =>  (0x00e40000)
         libboost_date_time.so.1.46.1 => not found
         libboost_system.so.1.46.1 => not found
         libmysqlclient_r.so.15 => /usr/lib/mysql/libmysqlclient_r.so.15 
(0x005a0000)
         libpthread.so.0 => /lib/libpthread.so.0 (0x00570000)
         libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x03cc1000)
         libm.so.6 => /lib/libm.so.6 (0x0053e000)
         libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00349000)
         libc.so.6 => /lib/libc.so.6 (0x003e3000)
         libcrypt.so.1 => /lib/libcrypt.so.1 (0x03ede000)
         libnsl.so.1 => /lib/libnsl.so.1 (0x00af4000)
         libz.so.1 => /usr/lib/libz.so.1 (0x0058b000)
         libssl.so.6 => /lib/libssl.so.6 (0x0026d000)
         libcrypto.so.6 => /lib/libcrypto.so.6 (0x00101000)
         /lib/ld-linux.so.2 (0x003bf000)
         libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00ce0000)
         libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00d57000)
         libcom_err.so.2 => /lib/libcom_err.so.2 (0x00cd0000)
         libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00244000)
         libresolv.so.2 => /lib/libresolv.so.2 (0x00b5b000)
         libdl.so.2 => /lib/libdl.so.2 (0x00569000)
         libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00d4c000)
         libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x00b56000)
         libselinux.so.1 => /lib/libselinux.so.1 (0x00ada000)
         libsepol.so.1 => /lib/libsepol.so.1 (0x00a92000)


Do I need to reconfigure and rebuild libodb-mysql with LDFLAGS and LIBS set?

Regards,
Chris

> Boris Kolpackov <mailto:boris at codesynthesis.com>
> 10 October 2012 18:30
> Hi Chris,
>
>
> Hm, for some reason libtool doesn't pass dependency libraries when
> linking statically. I will have to look into this.
>
> In the meantime, an easy workaround is to configure examples like
> this:
>
> ./configure --with-database=mysql LDFLAGS=-L/usr/lib/mysql 
> LIBS=-lmysqlclient_r
>
> Change /usr/lib/mysql to /usr/lib64/mysql in the above command line if
> you are using a 64-bit distribution.
>
> Boris
> Chris Richards <mailto:chris.richards at yellowfeather.co.uk>
> 10 October 2012 17:27
> Hi,
>
> I've just tried building ODB with static linking and am getting a 
> linker error building the examples. I have downloaded v2.1.0, and run 
> configure and make as below:
>
> ./configure --disable-shared
> make
> sudo make install
>
> I have done this for lidodb, libodb-boost and libodb-mysql. When I try 
> to build the ODB examples with:
>
> ./configure --disable-shared --with-database=mysql
> make
>
> I get lots of undefined references to 'mysql_stmt_xxx' methods.
>
> Could you let me know how to build against static libraries?
>
> BTW This is on CentOS 5, with gcc v4.1.2 and boost 1.46.1
>
>
> Thanks,
> Chris


More information about the odb-users mailing list