Commit 5f48b615 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-9298 : Build failure when linking libmysql.

If GCC or CLang compile with link time optimization (-flto),
they throw an error during link , when lto sees a
function (e.g mysql_real_connect) is redeclared as "external void *"
in libmysql_exports.cc

The fix disables -flto for generated libmysql_exports.cc
parent ff248202
...@@ -87,6 +87,11 @@ MACRO(CREATE_EXPORT_FILE VAR TARGET API_FUNCTIONS) ...@@ -87,6 +87,11 @@ MACRO(CREATE_EXPORT_FILE VAR TARGET API_FUNCTIONS)
ENDFOREACH() ENDFOREACH()
SET(CONTENT "${CONTENT} (void *)0\n}\;") SET(CONTENT "${CONTENT} (void *)0\n}\;")
CONFIGURE_FILE_CONTENT(${CONTENT} ${EXPORTS}) CONFIGURE_FILE_CONTENT(${CONTENT} ${EXPORTS})
# Avoid "function redeclared as variable" error
# when using gcc/clang option -flto(link time optimization)
IF(" ${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} " MATCHES " -flto")
SET_SOURCE_FILES_PROPERTIES(${EXPORTS} PROPERTIES COMPILE_FLAGS "-fno-lto")
ENDIF()
SET(${VAR} ${EXPORTS}) SET(${VAR} ${EXPORTS})
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment