Description:
This is basically a consolidation of these two bugs:
http://bugs.mysql.com/bug.php?id=59106
and
http://bugs.mysql.com/bug.php?id=59078
The soname of libmysqlclient.so.16 used in libmysqlclient for 5.5.8 is incompatible with prior versions of the library with the same soname. The reason for versioning a shared library is to prevent this exact problem from happening. Anything that requires a re-link and/or re-compile of linking programs, must also be paired with a change to the soname.
Likewise, linking a versioned library to an unversioned linking object will mean that programs needing the old version of the library will not function if the older development version of the library must be installed for some reason. The linker needs /usr/lib/libmysqlclient.so so it can *resolve* the soname to link things to, and if users want to compile something against the old library, they will need to install the old development version.
libmysqlclient_r.so.16.0.0, therefore, must not be a symlink to libmysqlclient.so. In fact, the library should just be dropped in 5.5.8. Builds can be fixed to no longer link against _r, and old programs can continue to use the libmysqlclient_r.so.16 copy of the library from 5.1 until they've been rebuilt.
How to repeat:
This is oriented around a Debian and/or Ubuntu system, but it will have the same problem on any distribution that has shipped libmysqlclient.so.16 from a previous version of MySQL:
1. Check out this revision of this packaging branch of mysql 5.5.8
bzr export -r 28 lp:~clint-fewbar/ubuntu/natty/mysql-5.1/mysql-5.5-packaging
2. If on Debian, you can build it with cd mysql-5.5-packaging && DEB_BUILD_OPTIONS=nocheck debuild. Otherwise, the cmake and make commands are contained in debian/rules to repeat the build in a similar fashion.
3. Install the new libmysqlclient16 packages that were produced:
sudo dpkg -i ../libmysqlclient16_5.5.8-0ubuntu3_*.deb
4. Install something from your distribution depends on libmysqlclient16:
sudo apt-get install sysbench
5. Run sysbench
$ sysbench --test=oltp --db-driver=mysql run
sysbench: /usr/lib/libmysqlclient_r.so.16: no version information available (required by sysbench)
The program does run in spite of the complaint, but there's potential for breakage in a very unpredictable way as types, arguments, or variables may have disappeared and will become unresolvable, causing system crashes.
Suggested fix:
=== modified file 'cmake/mysql_version.cmake'
--- cmake/mysql_version.cmake 2010-12-21 07:55:42 +0000
+++ cmake/mysql_version.cmake 2011-02-09 20:18:43 +0000
@@ -17,7 +17,7 @@
# Global constants, only to be changed between major releases.
#
-SET(SHARED_LIB_MAJOR_VERSION "16")
+SET(SHARED_LIB_MAJOR_VERSION "17")
SET(PROTOCOL_VERSION "10")
SET(DOT_FRM_VERSION "6")
=== modified file 'libmysql/CMakeLists.txt'
--- libmysql/CMakeLists.txt 2010-12-21 07:55:42 +0000
+++ libmysql/CMakeLists.txt 2011-02-09 20:21:21 +0000
@@ -172,7 +172,6 @@
SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION})
ENDIF()
ENDMACRO()
- INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} Development)
ENDIF()
IF(NOT DISABLE_SHARED)
@@ -203,23 +202,5 @@
#(mysqlclient in this case)
SET_TARGET_PROPERTIES(mysqlclient PROPERTIES CLEAN_DIRECT_OUTPUT 1)
SET_TARGET_PROPERTIES(libmysql PROPERTIES CLEAN_DIRECT_OUTPUT 1)
-
- # Install links to libmysqlclient.so (client_r)
- GET_VERSIONED_LIBNAME(
- "${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r"
- "${CMAKE_SHARED_LIBRARY_SUFFIX}"
- ""
- linkname)
- INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries)
- SET(OS_SHARED_LIB_SYMLINKS "${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}")
- LIST(REMOVE_DUPLICATES OS_SHARED_LIB_SYMLINKS)
- FOREACH(ver ${OS_SHARED_LIB_SYMLINKS})
- GET_VERSIONED_LIBNAME(
- "${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r"
- "${CMAKE_SHARED_LIBRARY_SUFFIX}"
- "${ver}"
- linkname)
- INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries)
- ENDFOREACH()
ENDIF()
ENDIF()