set ld flag

This commit is contained in:
wang--ge 2024-02-06 16:58:10 +08:00
parent 16b5ca0d56
commit cec77824b6
2 changed files with 68 additions and 5 deletions

View File

@ -0,0 +1,57 @@
From 7e252db5027c0dddb4c5a403ba0a481c35c10283 Mon Sep 17 00:00:00 2001
From: gordonwwang <gordonwwang@tencent.com>
Date: Sun, 18 Feb 2024 14:27:33 +0800
Subject: [PATCH] Fix build failure with Protobuf-24.2
---
cmake/fileutils.cmake | 5 ++++-
cmake/protobuf.cmake | 16 ++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/cmake/fileutils.cmake b/cmake/fileutils.cmake
index da98301..22dfb8d 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()
diff --git a/cmake/protobuf.cmake b/cmake/protobuf.cmake
index 11c0f92..447ce6c 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()
--
2.33.0

View File

@ -30,10 +30,10 @@
%global sameevr %{?epoch:%{epoch}:}%{version}-%{release}
Name: mysql
Version: 8.0.35
Release: 1
Release: 2
Summary: MySQL client programs and shared libraries
URL: http://www.mysql.com
License: GPLv2 with exceptions and LGPLv2 and BSD
License: GPLv2 with exceptions and LGPLv2 and BSD-2-Clause
Source0: https://cdn.mysql.com/Downloads/MySQL-8.0/mysql-boost-%{version}.tar.gz
Source2: mysql_config_multilib.sh
Source3: my.cnf.in
@ -65,6 +65,7 @@ Patch125: boost-1.57.0-mpl-print.patch
%ifarch riscv64
Patch128: riscv-lock-free.patch
%endif
Patch129: fix-protobuf-version-22-and-up.patch
BuildRequires: cmake gcc-c++ libaio-devel libedit-devel libevent-devel libicu-devel lz4
BuildRequires: lz4-devel mecab-devel bison libzstd-devel
@ -119,6 +120,7 @@ MySQL server.
%package config
Summary: The config files required by server and client
%{?with_conflicts:Conflicts: greatsql-mysql-config}
%description config
The package provides the config file my.cnf and my.cnf.d directory used by any
MariaDB or MySQL program. You will need to install this package to use any
@ -129,7 +131,7 @@ package itself.
%package common
Summary: The shared files required for MySQL server and client
Requires: %{_sysconfdir}/my.cnf
Requires: %{name}-config%{?_isa} = %{sameevr}
%description common
The mysql-common package provides the essential shared files for any
MySQL program. You will need to install this package to use any other
@ -148,8 +150,8 @@ The package provides error messages files for the MySQL daemon
Summary: The MySQL server and related files
Suggests: %{name}%{?_isa} = %{sameevr}
Requires: mysql%{?_isa}
Requires: %{name}-common%{?_isa} = %{sameevr} %{_sysconfdir}/my.cnf
Requires: %{_sysconfdir}/my.cnf.d %{name}-errmsg%{?_isa} = %{sameevr}
Requires: %{name}-common%{?_isa} = %{sameevr} %{name}-config%{?_isa} = %{sameevr}
Requires: %{name}-errmsg%{?_isa} = %{sameevr}
%{?mecab:Requires: mecab-ipadic}
Requires: coreutils
Requires(pre): /usr/sbin/useradd
@ -233,6 +235,7 @@ popd
%ifarch riscv64
%patch128 -p1
%endif
%patch129 -p1
pushd mysql-test
add_test () {
echo "$1" : BUG#0 "${@:2}" >> %{skiplist}
@ -547,6 +550,9 @@ fi
%{_mandir}/man1/mysql_config.1*
%changelog
* Sun Feb 18 2024 Ge Wang <wang__ge@126.com> - 8.0.35-2
- Fix protobuf version 22 and up
* Tue Nov 07 2023 yaoxin <yao_xin001@hoperun.com> - 8.0.35-1
- Upgrade to 8.0.35 for fix cves