Bug #45128 Connector/C 6.0.1 links libstdc++
Submitted: 27 May 2009 12:00 Modified: 30 Jul 2009 10:56
Reporter: Ulf Wendel Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C Severity:S1 (Critical)
Version:6.0.1 OS:Any
Assigned to: Georg Richter CPU Architecture:Any

[27 May 2009 12:00] Ulf Wendel
Description:
The Connector/C++ 6.0.1 binaries (for Linux) link libstdc++. A C driver must not link C++ libraries.

The version of libstdc++ we link belongs to the GCC 3.x series. Many current Linux systems run GCC 4.x. Those systems may not have libstdc++.so.5 installed by default.

nixnutz@ulflinux:~/ftp/mysql-connector-c-6.0.1-linux-glibc2.3-x86-32bit> ldd lib/libmysqlclient.so
        linux-gate.so.1 =>  (0xffffe000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xf7d45000)
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0xf7c84000)
        libm.so.6 => /lib/libm.so.6 (0xf7c5f000)
        libc.so.6 => /lib/libc.so.6 (0xf7b2c000)
        /lib/ld-linux.so.2 (0x56555000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf7b1f000)

The dependency is created by YaSSL. For whatever reason, cmake compiles the YaSSL sources from the Connector/C source distribution using a C++ compiler. This will cause the inclusion of libstdc++ when linking the driver library.

Note that the libmysqlclient that ships with MySQL, e.g. MySQL 5.1.35, does not link libstdc++. This is how things should work:

nixnutz@ulflinux:~/src/php5_libmysql> ldd /usr/local/mysql/lib/mysql/libmysqlclient.so
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aed75cac000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00002aed75ec7000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x00002aed76100000)
        libm.so.6 => /lib64/libm.so.6 (0x00002aed76318000)
        libz.so.1 => /lib64/libz.so.1 (0x00002aed7656b000)
        libc.so.6 => /lib64/libc.so.6 (0x00002aed76780000)
        /lib64/ld-linux-x86-64.so.2 (0x0000555555554000)

The dependency with libstdc++ is causing trouble for the MySQL OpenOffice.org extension (AKA Connector/OO.org). Therefore, I have set the flag "Affects customer". Connector/OpenOffice.org wraps Connector/C++. Connector/C++ is linked against Connector/C. The OpenOffice.org build environment is using a pre-compiled version of Connector/C for building Connector/OpenOffice.org. Therefore, Connector/OpenOffice.org inherits the libstdc++ dependency. libstdc++.so.5 is both clashing with libstdc++.so.6 used by OpenOffice.org and - as it belongs to GCC 3.x - may be missing on may systems. For various reasons OpenOffice.org cannot build Connector/C from source. 

The libstdc++ dependency of Connector/C is a Connector/OpenOffice.org show stopper bug for the planned GA release in September. In other words: we need a fix and a binary release well before September to be able to proceed with Connector/OpenOffice.org.

Compiling from source, BTW, does not fix it. The libstdc++ dependency will remain.

How to repeat:
Download, unpack, check ldd or download, compile, check ldd.
[27 May 2009 12:13] Tonci Grgin
Changing category to more appropriate one after discussing with Miguel.
[28 May 2009 10:36] Omer Barnir
triage: this is a connector bug, as there is no category for connector/C setting to connector/C++ until one is added 

Discussion in meeting:
 - 2132 51mru 5.1+ but this is NOT server, it is a totally separate product (connector/c), not sure how to set target, etc.)
[29 Jun 2009 12:04] Ulf Wendel
Changing category to Connector/C as this is where the trouble starts. Connector/C++ is just a client of Connector/C.
[28 Jul 2009 21:40] Jim Winstead
This was resolved for Connector/C 6.0.2.
[30 Jul 2009 10:56] Tony Bedford
An entry was added to the 6.0.2 changelog:

MySQL Connector/C incorrectly linked against libstdc++. This dependency created various problems for MySQL Connector/OpenOffice.org.