Skip to content

Commit 24fe1f9

Browse files
author
Tor Didriksen
committed
Bug#35598485 Fix RPATH for opentelemetry plugins
We already have cmake code to fix RPATH for the group_replication plugin. Do the same thing for telemetry_client and component_telemetry. Also silence a message in opentelemetry cmake code: without the proper <mode> the text ends up in stderr rather than stdout. Change-Id: I923ae71fa0662ec72a0385c50be6972ade4f452b
1 parent a1bb865 commit 24fe1f9

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

cmake/component.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ MACRO(MYSQL_ADD_COMPONENT component_arg)
8989
ADD_DEPENDENCIES(${target} GenError)
9090

9191
IF (ARG_MODULE_ONLY)
92+
SET_TARGET_PROPERTIES(${target} PROPERTIES OUTPUT_NAME "${target}")
9293
# Store all components in the same directory, for easier testing.
9394
SET_TARGET_PROPERTIES(${target} PROPERTIES
9495
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugin_output_directory

cmake/install_macros.cmake

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,26 @@ FUNCTION(INSTALL_DEBUG_TARGET target)
260260
COMPONENT ${ARG_COMPONENT}
261261
OPTIONAL)
262262

263-
# mysqld-debug and debug/group_replication.so both need cleanup of RPATH.
264-
# We could/should *generate* these files, but since it only affects two
265-
# binaries, we hard-code them for simplicity.
263+
# mysqld-debug and some debug plugins need to change RPATH during install.
264+
# The RPATH fixup script for mysqld-debug is hard-coded.
265+
# We have a template .cmake.in file for any plugin that needs cleanup.
266266

267267
# NOTE: scripts should work for 'make install' and 'make package'.
268268
IF(UNIX_INSTALL_RPATH_ORIGIN_PRIV_LIBDIR)
269269
IF(${target} STREQUAL "mysqld")
270270
INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/cmake/rpath_remove.cmake)
271271
ENDIF()
272-
IF(${target} STREQUAL "group_replication")
273-
INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/cmake/rpath_remove_gr.cmake)
272+
# These plugins depend, directly or indirectly, on protobuf.
273+
IF(${target} STREQUAL "group_replication" OR
274+
${target} STREQUAL "telemetry_client" OR
275+
${target} STREQUAL "component_telemetry"
276+
)
277+
GET_TARGET_PROPERTY(output_name ${target} OUTPUT_NAME)
278+
SET(plugin_so_file "${output_name}.so")
279+
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/rpath_remove_plugin.cmake.in
280+
${CMAKE_BINARY_DIR}/rpath_${output_name}.cmake @ONLY)
281+
INSTALL(SCRIPT ${CMAKE_BINARY_DIR}/rpath_${output_name}.cmake)
282+
MESSAGE(STATUS "Changing RPATH when installing ${debug_target_location}")
274283
ENDIF()
275284
ENDIF()
276285

@@ -291,7 +300,7 @@ FUNCTION(INSTALL_DEBUG_TARGET target)
291300
COMPONENT ${ARG_COMPONENT}
292301
OPTIONAL)
293302
ENDIF()
294-
ENDFUNCTION()
303+
ENDFUNCTION(INSTALL_DEBUG_TARGET)
295304

296305

297306
FUNCTION(INSTALL_PRIVATE_LIBRARY TARGET)

cmake/rpath_remove_gr.cmake renamed to cmake/rpath_remove_plugin.cmake.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# along with this program; if not, write to the Free Software
2121
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2222

23-
# Clean up RPATH for the debug verson of group_replication.so after INSTALL.
23+
# Clean up RPATH for the debug verson of @plugin_so_file@ after INSTALL.
2424

2525
# See the generated cmake_install.cmake files:
2626
IF("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xServerx" OR
@@ -30,11 +30,11 @@ ELSE()
3030
RETURN()
3131
ENDIF()
3232

33-
# The debug plugin is in INSTALL_PLUGINDIR/debug/group_replication.so
33+
# The debug plugin is in INSTALL_PLUGINDIR/debug/@plugin_so_file@
3434
FOREACH(PATH
35-
"lib64/mysql/plugin/debug/group_replication.so"
36-
"lib/mysql/plugin/debug/group_replication.so"
37-
"lib/plugin/debug/group_replication.so"
35+
"lib64/mysql/plugin/debug/@plugin_so_file@"
36+
"lib/mysql/plugin/debug/@plugin_so_file@"
37+
"lib/plugin/debug/@plugin_so_file@"
3838
)
3939
SET(FULL_PATH "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${PATH}")
4040
MESSAGE(STATUS "Looking for ${FULL_PATH}")
@@ -45,7 +45,7 @@ FOREACH(PATH
4545
ENDFOREACH()
4646

4747
IF(NOT DEBUG_PLUGIN)
48-
MESSAGE(WARNING "Could not find debug version of group_replication.so")
48+
MESSAGE(WARNING "Could not find debug version of @plugin_so_file@")
4949
RETURN()
5050
ENDIF()
5151

0 commit comments

Comments
 (0)