From 790f859ef76762016f8a719aa07aaed2f059fc8f Mon Sep 17 00:00:00 2001 From: Aaron Jheng Date: Sat, 12 Nov 2022 07:57:17 +0000 Subject: [PATCH] mysql80: fix build on aarch64-linux --- pkgs/servers/sql/mysql/8.0.x.nix | 4 ++++ .../sql/mysql/no-force-outline-atomics.patch | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/servers/sql/mysql/no-force-outline-atomics.patch diff --git a/pkgs/servers/sql/mysql/8.0.x.nix b/pkgs/servers/sql/mysql/8.0.x.nix index 553cf937b0e..98563bda6cd 100644 --- a/pkgs/servers/sql/mysql/8.0.x.nix +++ b/pkgs/servers/sql/mysql/8.0.x.nix @@ -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 diff --git a/pkgs/servers/sql/mysql/no-force-outline-atomics.patch b/pkgs/servers/sql/mysql/no-force-outline-atomics.patch new file mode 100644 index 00000000000..a716a4f7f48 --- /dev/null +++ b/pkgs/servers/sql/mysql/no-force-outline-atomics.patch @@ -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"