From 66f16cde766a1034f66646d66b479092b62456a2513c7a90233ce133fe6589f8 Mon Sep 17 00:00:00 2001 From: Simon Lees Date: Fri, 21 Jan 2022 06:05:53 +0000 Subject: [PATCH] Accepting request 947856 from home:simotek:branches:devel:tools:building - Fix build with gcc12 (boo#1194815) * Adds fix-avoid-file-static-init.patch OBS-URL: https://build.opensuse.org/request/show/947856 OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=479 --- cmake.changes | 11 +++ cmake.spec | 4 +- fix-avoid-file-static-init.patch | 117 +++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 fix-avoid-file-static-init.patch diff --git a/cmake.changes b/cmake.changes index 6c676a2..d3bd55e 100644 --- a/cmake.changes +++ b/cmake.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jan 21 04:02:39 UTC 2022 - Simon Lees + +- Fix build with gcc12 (boo#1194815) + * Adds fix-avoid-file-static-init.patch + ------------------------------------------------------------------- Sat Dec 11 10:27:53 UTC 2021 - Andreas Stieger @@ -9,6 +15,11 @@ Sat Dec 11 10:27:53 UTC 2021 - Andreas Stieger * CMakeParseLibraryArchitecture: Fix parsing /lib/ implicit object path +------------------------------------------------------------------- +Tue Dec 7 11:05:24 UTC 2021 - Simon Lees + +- Changing something for a test + ------------------------------------------------------------------- Wed Dec 1 16:36:36 UTC 2021 - Christophe Giboudeaux diff --git a/cmake.spec b/cmake.spec index 4036043..277f5d3 100644 --- a/cmake.spec +++ b/cmake.spec @@ -1,7 +1,7 @@ # # spec file # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -55,6 +55,8 @@ Patch0: cmake-fix-ruby-test.patch # Search for python interpreters from newest to oldest rather then picking up /usr/bin/python as first choice Patch1: feature-suse-python-interp-search-order.patch Patch2: cmake-fix-png-include-dir.patch +# boo#1194815 fix from upstream fixes gcc12 builds +Patch3: fix-avoid-file-static-init.patch BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: pkgconfig diff --git a/fix-avoid-file-static-init.patch b/fix-avoid-file-static-init.patch new file mode 100644 index 0000000..7a6bfeb --- /dev/null +++ b/fix-avoid-file-static-init.patch @@ -0,0 +1,117 @@ +From 54510486bd2378cca7cbb8d4034174a29182ca24 Mon Sep 17 00:00:00 2001 +From: Brad King +Date: Thu, 20 Jan 2022 14:06:58 -0500 +Subject: [PATCH] Avoid file-level static initialization with std::vector + +Fixes: #23126 +--- + Source/cmFileAPIToolchains.cxx | 41 ++++++++++------------ + Tests/CMakeLib/testCTestBinPacker.cxx | 5 ++- + Tests/CMakeLib/testCTestResourceGroups.cxx | 2 +- + 3 files changed, 22 insertions(+), 26 deletions(-) + +diff --git a/Source/cmFileAPIToolchains.cxx b/Source/cmFileAPIToolchains.cxx +index b3540c97b2..fe2972fabf 100644 +--- a/Source/cmFileAPIToolchains.cxx ++++ b/Source/cmFileAPIToolchains.cxx +@@ -30,10 +30,6 @@ class Toolchains + cmFileAPI& FileAPI; + unsigned long Version; + +- static const std::vector CompilerVariables; +- static const std::vector CompilerImplicitVariables; +- static const ToolchainVariable SourceFileExtensionsVariable; +- + Json::Value DumpToolchains(); + Json::Value DumpToolchain(std::string const& lang); + Json::Value DumpToolchainVariables( +@@ -48,24 +44,6 @@ public: + Json::Value Dump(); + }; + +-const std::vector Toolchains::CompilerVariables{ +- { "path", "COMPILER", false }, +- { "id", "COMPILER_ID", false }, +- { "version", "COMPILER_VERSION", false }, +- { "target", "COMPILER_TARGET", false }, +-}; +- +-const std::vector Toolchains::CompilerImplicitVariables{ +- { "includeDirectories", "IMPLICIT_INCLUDE_DIRECTORIES", true }, +- { "linkDirectories", "IMPLICIT_LINK_DIRECTORIES", true }, +- { "linkFrameworkDirectories", "IMPLICIT_LINK_FRAMEWORK_DIRECTORIES", true }, +- { "linkLibraries", "IMPLICIT_LINK_LIBRARIES", true }, +-}; +- +-const ToolchainVariable Toolchains::SourceFileExtensionsVariable{ +- "sourceFileExtensions", "SOURCE_FILE_EXTENSIONS", true +-}; +- + Toolchains::Toolchains(cmFileAPI& fileAPI, unsigned long version) + : FileAPI(fileAPI) + , Version(version) +@@ -94,6 +72,25 @@ Json::Value Toolchains::DumpToolchains() + + Json::Value Toolchains::DumpToolchain(std::string const& lang) + { ++ static const std::vector CompilerVariables{ ++ { "path", "COMPILER", false }, ++ { "id", "COMPILER_ID", false }, ++ { "version", "COMPILER_VERSION", false }, ++ { "target", "COMPILER_TARGET", false }, ++ }; ++ ++ static const std::vector CompilerImplicitVariables{ ++ { "includeDirectories", "IMPLICIT_INCLUDE_DIRECTORIES", true }, ++ { "linkDirectories", "IMPLICIT_LINK_DIRECTORIES", true }, ++ { "linkFrameworkDirectories", "IMPLICIT_LINK_FRAMEWORK_DIRECTORIES", ++ true }, ++ { "linkLibraries", "IMPLICIT_LINK_LIBRARIES", true }, ++ }; ++ ++ static const ToolchainVariable SourceFileExtensionsVariable{ ++ "sourceFileExtensions", "SOURCE_FILE_EXTENSIONS", true ++ }; ++ + const auto& mf = + this->FileAPI.GetCMakeInstance()->GetGlobalGenerator()->GetMakefiles()[0]; + Json::Value toolchain = Json::objectValue; +diff --git a/Tests/CMakeLib/testCTestBinPacker.cxx b/Tests/CMakeLib/testCTestBinPacker.cxx +index abdbefb231..e419155665 100644 +--- a/Tests/CMakeLib/testCTestBinPacker.cxx ++++ b/Tests/CMakeLib/testCTestBinPacker.cxx +@@ -16,8 +16,7 @@ struct ExpectedPackResult + std::vector ExpectedBlockAllocations; + }; + +-static const std::vector expectedResults +-{ ++static const ExpectedPackResult expectedResults[] = { + /* clang-format off */ + { + { 2, 2, 2, 2 }, +@@ -215,7 +214,7 @@ struct AllocationComparison + bool Equal; + }; + +-static const std::vector comparisons{ ++static const AllocationComparison comparisons[] = { + /* clang-format off */ + { { 0, 1, "0" }, { 0, 1, "0" }, true }, + { { 0, 1, "0" }, { 1, 1, "0" }, false }, +diff --git a/Tests/CMakeLib/testCTestResourceGroups.cxx b/Tests/CMakeLib/testCTestResourceGroups.cxx +index c3532a68d7..b764c860c5 100644 +--- a/Tests/CMakeLib/testCTestResourceGroups.cxx ++++ b/Tests/CMakeLib/testCTestResourceGroups.cxx +@@ -15,7 +15,7 @@ struct ExpectedParseResult + ExpectedValue; + }; + +-static const std::vector expectedResults{ ++static const ExpectedParseResult expectedResults[] = { + /* clang-format off */ + { "threads:2", true, { + { { "threads", 2, 1 } }, +-- +GitLab +