Update the fix for building in the debug mode

Upstream tracker: https://jira.mariadb.org/browse/MDEV-19740
This commit is contained in:
Michal Schorm 2020-03-10 09:29:49 +01:00
parent 55406c8293
commit 0e21d7319c
2 changed files with 24 additions and 38 deletions

View File

@ -1,28 +0,0 @@
Remove the '-Werror' GCC compilation flag, so the debug build compilation won't crash on random warnings.
'-Werror' is not your friend:
https://embeddedartistry.com/blog/2017/5/3/-werror-is-not-your-friend
--- mariadb-10.3.17/cmake/maintainer.cmake 2019-07-28 02:18:30.000000000 +0200
+++ mariadb-10.3.17/cmake/maintainer.cmake_patched 2019-09-03 13:41:49.082088685 +0200
@@ -33,7 +33,6 @@ SET(MY_WARNING_FLAGS
-Wnon-virtual-dtor
-Wvla
-Wwrite-strings
- -Werror
)
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
--- mariadb-10.3.17/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake 2019-07-28 02:18:32.000000000 +0200
+++ mariadb-10.3.17/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake_patched 2019-09-03 13:53:51.813324055 +0200
@@ -163,8 +163,8 @@ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL C
endif ()
## always want these in debug builds
-set(CMAKE_C_FLAGS_DEBUG "-Wall -Werror ${CMAKE_C_FLAGS_DEBUG}")
-set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Werror ${CMAKE_CXX_FLAGS_DEBUG}")
+set(CMAKE_C_FLAGS_DEBUG "-Wall ${CMAKE_C_FLAGS_DEBUG}")
+set(CMAKE_CXX_FLAGS_DEBUG "-Wall ${CMAKE_CXX_FLAGS_DEBUG}")
# pick language dialect
set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")

View File

@ -147,7 +147,7 @@
Name: mariadb
Version: 10.4.12
Release: 1%{?with_debug:.debug}%{?dist}
Release: 2%{?with_debug:.debug}%{?dist}
Epoch: 3
Summary: A very fast and robust SQL database server
@ -195,8 +195,6 @@ Patch10: %{pkgnamepatch}-ssl-cipher-tests.patch
Patch11: %{pkgnamepatch}-pcdir.patch
# Patch13: Fix Spider code on armv7hl; https://jira.mariadb.org/browse/MDEV-18737
Patch13: %{pkgnamepatch}-spider_on_armv7hl.patch
# Patch14: Remove the '-Werror' flag so the debug build won't crash on random warnings
Patch14: %{pkgnamepatch}-debug_build.patch
# Patch15: Add option to edit groonga's and groonga-normalizer-mysql install path
Patch15: %{pkgnamepatch}-groonga.patch
# Patch16: Workaround for "chown 0" with priviledges dropped to "mysql" user
@ -684,7 +682,6 @@ find . -name "*.jar" -type f -exec rm --verbose -f {} \;
%patch10 -p1
%patch11 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
@ -766,15 +763,29 @@ CFLAGS="$CFLAGS -fPIC"
%if %{with debug}
# Override all optimization flags when making a debug build
CFLAGS="$CFLAGS -O0 -g"
CPPFLAGS="$CPPFLAGS -O0 -g -D_FORTIFY_SOURCE=0"
# Fix GCC flags broken by MariaDB upstream
CFLAGS="$CFLAGS -Wno-error=deprecated-copy -Wno-error=pessimizing-move -Wno-error=unused-result -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow -Wno-error=sign-compare"
CPPFLAGS="$CPPFLAGS -Wno-error=deprecated-copy -Wno-error=pessimizing-move -Wno-error=unused-result -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow -Wno-error=sign-compare"
%endif
# -D_FORTIFY_SOURCE requires optimizations enabled. Disable the fortify.
CFLAGS=`echo "$CFLAGS" | sed -r 's/-D_FORTIFY_SOURCE=[012]/-D_FORTIFY_SOURCE=0/'`
CFLAGS=`echo "$CFLAGS" | sed -r 's/-O[0123]//'`
CFLAGS="$CFLAGS -O0 -g -D_FORTIFY_SOURCE=0"
# Fixes for Fedora 32 & Rawhide (GCC 10.0):
%if 0%{?fedora} >= 32
CFLAGS="$CFLAGS -Wno-error=class-memaccess"
%endif # f32
%endif # debug
CXXFLAGS="$CFLAGS"
CPPFLAGS="$CFLAGS"
# CFLAGS specific "-Wno-error"
%if %{with debug}
%if 0%{?fedora} >= 32
CFLAGS="$CFLAGS -Wno-error=enum-conversion"
%endif # f32
%endif # debug
export CFLAGS CXXFLAGS CPPFLAGS
@ -1559,6 +1570,9 @@ fi
%endif
%changelog
* Tue Mar 10 2020 Michal Schorm <mschorm@redhat.com> - 10.4.12-2
- Update the fix for building in the debug mode
* Thu Feb 06 2020 Michal Schorm <mschorm@redhat.com> - 10.4.12-1
- Rebase to 10.4.12