From bb2a8542a4ca37c7ba0d07f4fb4d4c4ff1a8d64f Mon Sep 17 00:00:00 2001 From: gordonwwang Date: Fri, 10 Nov 2023 23:09:36 +0800 Subject: [PATCH 1/2] [Patch 1/2 v1]:Bug#113045 Build failure with Protobuf-24.2 in Linux Building with WITH_PROTOBUF=system failed with Protobuf 24.2 in Linux. In cmake/protobuf.cmake, add fixes related to IF(LINUX AND WITH_PROTOBUF STREQUAL system AND PB_MINOR_VERSION VERSION_GREATER 21) Signed-off-by: gordonwwang --- cmake/protobuf.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmake/protobuf.cmake b/cmake/protobuf.cmake index 11c0f925935a..447ce6cdb8ef 100644 --- a/cmake/protobuf.cmake +++ b/cmake/protobuf.cmake @@ -191,6 +191,22 @@ MACRO(MYSQL_CHECK_PROTOBUF) ) ENDIF() + # fix protobuf version 22 and up in Linux + IF(LINUX AND WITH_PROTOBUF STREQUAL "system" AND PB_MINOR_VERSION VERSION_GREATER 21) + FIND_OBJECT_DEPENDENCIES("${PROTOBUF_LIBRARY}" protobuf_dependencies) + SET_TARGET_PROPERTIES(ext::libprotobuf PROPERTIES + INTERFACE_LINK_LIBRARIES "${protobuf_dependencies}" + ) + FIND_OBJECT_DEPENDENCIES("${PROTOBUF_LITE_LIBRARY}" lite_dependencies) + SET_TARGET_PROPERTIES(ext::libprotobuf-lite PROPERTIES + INTERFACE_LINK_LIBRARIES "${lite_dependencies}" + ) + FIND_OBJECT_DEPENDENCIES("${Protobuf_PROTOC_LIBRARY}" protoc_dependencies) + SET_TARGET_PROPERTIES(ext::libprotoc PROPERTIES + INTERFACE_LINK_LIBRARIES "${protoc_dependencies}" + ) + ENDIF() + IF("${PROTOBUF_VERSION}" VERSION_LESS "${MIN_PROTOBUF_VERSION_REQUIRED}") COULD_NOT_FIND_PROTOBUF() ENDIF() From f25c0975c724964850f263e4d11894e0a1e75d05 Mon Sep 17 00:00:00 2001 From: gordonwwang Date: Fri, 10 Nov 2023 23:23:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[Patch=202/2=20v1]:Bug#113045=20Build=20fai?= =?UTF-8?q?lure=20with=20Protobuf-24.2=20in=20Linux=20Run=20the=20FIND=5FO?= =?UTF-8?q?BJECT=5FDEPENDENCIES=20function=20to=20find=20dependent=20libra?= =?UTF-8?q?ries.=20If=20the=20output=20of=20objdump=20is=20as=20follows:?= =?UTF-8?q?=20=E2=80=9C=20NEEDED=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20libstdc++.so.6=20NEEDED=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20libc.so.6=20NEEDED=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20ld-Linux-x86-64.2=20"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At this point, libc.so.6 can be processed normally and converted to "-lc"; However, "libstdc++.so.6" cannot be captured by the regular expression because it contains "++", so it cannot install the transposition "-lstdc++"; Although "ld-Linux-x86-64.2" can be captured by the regular expression, it is incorrectly converted to "-ld-Linux-x86-64", and the correct result should be "-ldl". Signed-off-by: gordonwwang --- cmake/fileutils.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/fileutils.cmake b/cmake/fileutils.cmake index da9830185012..22dfb8d67356 100644 --- a/cmake/fileutils.cmake +++ b/cmake/fileutils.cmake @@ -128,8 +128,11 @@ IF(LINUX) SET(DEPENDENCIES) FOREACH(LINE ${OBJDUMP_OUTPUT_LIST}) STRING(REGEX MATCH - "^[ ]+NEEDED[ ]+([-_A-Za-z0-9\\.]+)" UNUSED ${LINE}) + "^[ ]+NEEDED[ ]+([-+_A-Za-z0-9\\.]+)" UNUSED ${LINE}) IF(CMAKE_MATCH_1) + IF(CMAKE_MATCH_1 STREQUAL "ld-linux-x86-64.so.2" OR CMAKE_MATCH_1 STREQUAL "ld-linux-aarch64.so.1") + SET(CMAKE_MATCH_1 "libdl.so.2") + ENDIF() LIST(APPEND DEPENDENCIES ${CMAKE_MATCH_1}) ENDIF() ENDFOREACH()