diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-04-18 11:57:34 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-04-19 11:27:00 +0200 |
commit | 608c0e1c22ea6e2348bbb64d92d8c62d9c3410e8 (patch) | |
tree | d3921bbce4946d615c9c37f0d64797c85039b160 /libmysql | |
parent | ce355304e6ecd47c4e65d437267842acb8aae6b7 (diff) | |
download | mariadb-git-608c0e1c22ea6e2348bbb64d92d8c62d9c3410e8.tar.gz |
MDEV-5982 `make` fail @ ".../libmysql_versions.ld:155:9: invalid use of VERSION in input file"
add a workaround for gold
Diffstat (limited to 'libmysql')
-rw-r--r-- | libmysql/CMakeLists.txt | 46 | ||||
-rw-r--r-- | libmysql/libmysql_versions.ld.in | 16 |
2 files changed, 44 insertions, 18 deletions
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index e611efae65a..76156302c12 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -251,6 +251,25 @@ SET(CLIENT_API_FUNCTIONS ) IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + IF (NOT DISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING) + + INCLUDE (CheckCSourceCompiles) + FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.ld" + "VERSION {\nlibmysqlclient_18 {\nglobal: *;\n};\n}\n") + SET(CMAKE_REQUIRED_LIBRARIES "-Wl,src.ld") + CHECK_C_SOURCE_COMPILES("int main() { return 0; }" + SUPPORTS_VERSION_IN_LINK_SCRIPT) + SET(CMAKE_REQUIRED_LIBRARIES) + + IF (NOT SUPPORTS_VERSION_IN_LINK_SCRIPT) + # https://sourceware.org/bugzilla/show_bug.cgi?id=16895 + MESSAGE(SEND_ERROR "Your current linker does not support VERSION " + "command in linker scripts like a GNU ld or any compatible linker " + "should. Perhaps you're using gold? Either switch to GNU ld compatible " + "linker or run cmake with -DDISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING=TRUE " + "to be able to complete the build") + ENDIF (NOT SUPPORTS_VERSION_IN_LINK_SCRIPT) + # When building RPM, or DEB package on Debian, use ELF symbol versioning # for compatibility with distribution packages, so client shared library can # painlessly replace the one supplied by the distribution. @@ -335,14 +354,26 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") make_scrambled_password_323 ) - # Linker script to version symbols in Fedora- and Debian- compatible way, MDEV-5529 - SET(VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/libmysql_versions.ld.in) - # Generate version script. # Create semicolon separated lists of functions to export from # Since RPM packages use separate versioning for 5.1 API # and 5.5 API (libmysqlclient_16 vs libmysqlclient_18), # we need 2 lists. + SET (VERSION_HEADER +"VERSION { + libmysqlclient_18 { + global:") + SET (VERSION_FOOTER +" local: + *; + }; + + libmysqlclient_16 { + /* empty here. aliases are added above */ + }; +} +") + SET (CLIENT_API_5_1_LIST) SET (CLIENT_API_5_1_ALIASES) FOREACH (f ${CLIENT_API_FUNCTIONS_5_1} ${CLIENT_API_5_1_EXTRA}) @@ -355,6 +386,13 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET(CLIENT_API_5_5_LIST "${CLIENT_API_5_5_LIST}\t${f};\n") ENDFOREACH() + ELSE (NOT DISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING) + SET (CLIENT_API_5_1_ALIASES "/* Versioning disabled per user request. MDEV-5982 */") + ENDIF (NOT DISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING) + + # Linker script to version symbols in Fedora- and Debian- compatible way, MDEV-5529 + SET(VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/libmysql_versions.ld.in) + CONFIGURE_FILE( ${VERSION_SCRIPT_TEMPLATE} ${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld @@ -363,7 +401,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET(VERSION_SCRIPT_LINK_FLAGS "-Wl,${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld") -ENDIF() +ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET(CLIENT_SOURCES diff --git a/libmysql/libmysql_versions.ld.in b/libmysql/libmysql_versions.ld.in index 8d97da5b2eb..0cf5b45cc18 100644 --- a/libmysql/libmysql_versions.ld.in +++ b/libmysql/libmysql_versions.ld.in @@ -27,19 +27,7 @@ mysql_get_charset_by_csname = get_charset_by_csname; mysql_net_realloc = net_realloc; mysql_client_errors = client_errors; -VERSION { - -libmysqlclient_18 { - global: +@VERSION_HEADER@ @CLIENT_API_5_1_LIST@ @CLIENT_API_5_5_LIST@ - - local: - *; -}; - -libmysqlclient_16 { - /* empty here. aliases are added above */ -}; - -} +@VERSION_FOOTER@ |