mysql80: fix build on aarch64-linux

This commit is contained in:
Aaron Jheng 2022-11-12 07:57:17 +00:00
parent 2741fd822e
commit 790f859ef7
No known key found for this signature in database
GPG key ID: F6A547A869D050A3
2 changed files with 28 additions and 0 deletions

View file

@ -16,6 +16,10 @@ self = stdenv.mkDerivation rec {
nativeBuildInputs = [ bison cmake pkg-config ]
++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ];
patches = [
./no-force-outline-atomics.patch # Do not force compilers to turn on -moutline-atomics switch
];
## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references.
postPatch = ''
substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool

View file

@ -0,0 +1,24 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 727d66011f9..acae1aada57 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1338,19 +1338,6 @@ IF(UNIX AND MY_COMPILER_IS_GNU_OR_CLANG
ENDIF()
ENDIF()
-# For aarch64 some sub-architectures support LSE atomics and some don't. Thus,
-# compiling for the common denominator (-march=armv8-a) means LSE is not used.
-# The -moutline-atomics switch enables run-time detection of LSE support.
-# There are compilers (gcc 9.3.1 for example) which support this switch, but
-# do not enable it by default, even though it seems to help. So, we force it.
-IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
- MY_CHECK_CXX_COMPILER_FLAG( "-moutline-atomics" HAVE_OUTLINE_ATOMICS)
- IF(HAVE_OUTLINE_ATOMICS)
- STRING_APPEND(CMAKE_C_FLAGS " -moutline-atomics")
- STRING_APPEND(CMAKE_CXX_FLAGS " -moutline-atomics")
- ENDIF()
-ENDIF()
-
IF(LINUX)
OPTION(LINK_RANDOMIZE "Randomize the order of all symbols in the binary" OFF)
SET(LINK_RANDOMIZE_SEED "mysql"