summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Falkenberg2022-05-19 08:49:19 +0200
committerRobert Falkenberg2022-05-19 08:49:19 +0200
commitcd4e6d4b0d0512bb260015774ba4c5c678172a44 (patch)
tree8d33dc3f8674d9a1777ddbfb236aadf07d357e25
parent1f306c136ab1739e0ff3b84e68815c6f2eadad6a (diff)
downloadaur-cd4e6d4b0d0512bb260015774ba4c5c678172a44.tar.gz
add patches to support build with GCC 12.1.0
-rw-r--r--.SRCINFO13
-rw-r--r--0001-cmake-fix-build-for-cmake-option-BUILD_SHARED_LIBS-O.patch66
-rw-r--r--0002-add-missing-include-for-build-with-GCC-12.patch27
-rw-r--r--0003-adt-fsm-ignore-GCC-warning-for-template-specializati.patch53
-rw-r--r--0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch37
-rw-r--r--0005-cmake-gcc-disable-Werror-maybe-uninitialized-for-GCC.patch32
-rw-r--r--PKGBUILD25
7 files changed, 249 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 3dfbb6e789a2..294997916fc5 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,12 +1,13 @@
pkgbase = srsran-git
pkgdesc = Open source SDR LTE software suite from Software Radio Systems (SRS)
pkgver = 22.4.0.r0.gf2dff0b7a
- pkgrel = 1
+ pkgrel = 2
url = https://www.srsran.com
arch = x86_64
license = AGPL3
makedepends = cmake
makedepends = boost
+ makedepends = git
depends = fftw
depends = mbedtls
depends = boost-libs
@@ -28,6 +29,16 @@ pkgbase = srsran-git
conflicts = srsenb
options = !lto
source = git+https://github.com/srsran/srsRAN.git
+ source = 0001-cmake-fix-build-for-cmake-option-BUILD_SHARED_LIBS-O.patch
+ source = 0002-add-missing-include-for-build-with-GCC-12.patch
+ source = 0003-adt-fsm-ignore-GCC-warning-for-template-specializati.patch
+ source = 0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch
+ source = 0005-cmake-gcc-disable-Werror-maybe-uninitialized-for-GCC.patch
sha512sums = SKIP
+ sha512sums = cf684f173b53673ae2413b0c3a7261d24f1afd58e42727cdc594882b0367e470aa0416f4f4b675f773d9d5ef43cd21fbe9c97a3d67591bad559ea1352d593e8b
+ sha512sums = 0b690d3bb8a2a0009c24a9b68f6b0da2b202ba32c7d4dd71d0c102f510c7f50419099af7a1bc89ff94fd4f945bbfd08a211d4806e204cea479d9ae0220fc5eaf
+ sha512sums = 1115bfdf51d3026724535e8a847d2ec26c27281efb1063bf1e13e220aee2a1a051a83a0d38cb898aa42323f93c865d879132a085cd95f33a01f6365b4b2f1892
+ sha512sums = da931d9a7437510ce009c604161a052727ef7566d376c268f524f56449271a33e2dff5f8e807fcabfb144fccb36b4a125f4bfd77b4d9663e6e9364a855046dc3
+ sha512sums = a1ed2b6e57ed598a2e47e014a4941999962e5cc1c4677a08834844ffbc23d8dce76f25a1f4868e01976da14369a7550b550738eee68f460323b23238b7062685
pkgname = srsran-git
diff --git a/0001-cmake-fix-build-for-cmake-option-BUILD_SHARED_LIBS-O.patch b/0001-cmake-fix-build-for-cmake-option-BUILD_SHARED_LIBS-O.patch
new file mode 100644
index 000000000000..25b73564ba85
--- /dev/null
+++ b/0001-cmake-fix-build-for-cmake-option-BUILD_SHARED_LIBS-O.patch
@@ -0,0 +1,66 @@
+From c5d5d45574ecc3ab86347dbab8fc9d27d1815248 Mon Sep 17 00:00:00 2001
+From: Robert Falkenberg <robert.falkenberg@srs.io>
+Date: Tue, 10 May 2022 09:14:25 +0200
+Subject: [PATCH] cmake: fix build for cmake option BUILD_SHARED_LIBS=ON
+
+The cmake option BUILD_SHARED_LIBS (off by default) causes all
+libraries to be built as shared libraries if not unless explicitly
+stated otherwise.
+Since test-helper libraries do not export their symbols, linking
+fails if built as shared library.
+Therefore, this change explicitly configures these helpers as STATIC.
+---
+ srsenb/test/rrc/CMakeLists.txt | 2 +-
+ srsgnb/src/stack/mac/test/CMakeLists.txt | 4 ++--
+ srsgnb/src/stack/rrc/test/CMakeLists.txt | 2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/srsenb/test/rrc/CMakeLists.txt b/srsenb/test/rrc/CMakeLists.txt
+index 06ecb4221..fb6694fd4 100644
+--- a/srsenb/test/rrc/CMakeLists.txt
++++ b/srsenb/test/rrc/CMakeLists.txt
+@@ -6,7 +6,7 @@
+ # the distribution.
+ #
+
+-add_library(test_helpers test_helpers.cc)
++add_library(test_helpers STATIC test_helpers.cc)
+ target_link_libraries(test_helpers srsenb_rrc srsenb_common rrc_asn1 rrc_nr_asn1 s1ap_asn1 srsran_common enb_cfg_parser ${LIBCONFIGPP_LIBRARIES})
+
+ add_executable(rrc_meascfg_test rrc_meascfg_test.cc)
+diff --git a/srsgnb/src/stack/mac/test/CMakeLists.txt b/srsgnb/src/stack/mac/test/CMakeLists.txt
+index 6afaccc59..2441f5f8a 100644
+--- a/srsgnb/src/stack/mac/test/CMakeLists.txt
++++ b/srsgnb/src/stack/mac/test/CMakeLists.txt
+@@ -8,7 +8,7 @@
+
+ set_directory_properties(PROPERTIES LABELS "sched;nr")
+
+-add_library(sched_nr_test_suite sched_nr_common_test.cc sched_nr_ue_ded_test_suite.cc sched_nr_sim_ue.cc)
++add_library(sched_nr_test_suite STATIC sched_nr_common_test.cc sched_nr_ue_ded_test_suite.cc sched_nr_sim_ue.cc)
+ target_link_libraries(sched_nr_test_suite srsgnb_mac srsran_common rrc_nr_asn1)
+
+ add_executable(sched_nr_parallel_test sched_nr_parallel_test.cc)
+@@ -53,4 +53,4 @@ target_link_libraries(sched_nr_test
+ rrc_nr_asn1
+ srsran_common ${CMAKE_THREAD_LIBS_INIT}
+ ${Boost_LIBRARIES})
+-add_nr_test(sched_nr_test sched_nr_test)
+\ No newline at end of file
++add_nr_test(sched_nr_test sched_nr_test)
+diff --git a/srsgnb/src/stack/rrc/test/CMakeLists.txt b/srsgnb/src/stack/rrc/test/CMakeLists.txt
+index 103b1bb38..efca40807 100644
+--- a/srsgnb/src/stack/rrc/test/CMakeLists.txt
++++ b/srsgnb/src/stack/rrc/test/CMakeLists.txt
+@@ -6,7 +6,7 @@
+ # the distribution.
+ #
+
+-add_library(rrc_nr_test_helpers rrc_nr_test_helpers.cc)
++add_library(rrc_nr_test_helpers STATIC rrc_nr_test_helpers.cc)
+
+ add_executable(rrc_nr_test rrc_nr_test.cc)
+ target_link_libraries(rrc_nr_test srsgnb_rrc srsgnb_rrc_config_utils srsran_common rrc_nr_asn1 rrc_nr_test_helpers srsgnb_mac ${ATOMIC_LIBS})
+--
+2.36.1
+
diff --git a/0002-add-missing-include-for-build-with-GCC-12.patch b/0002-add-missing-include-for-build-with-GCC-12.patch
new file mode 100644
index 000000000000..4de48093e32a
--- /dev/null
+++ b/0002-add-missing-include-for-build-with-GCC-12.patch
@@ -0,0 +1,27 @@
+From 9687af766089e11005bdb50c53d37f6809409b2b Mon Sep 17 00:00:00 2001
+From: Robert Falkenberg <robert.falkenberg@srs.io>
+Date: Thu, 12 May 2022 06:42:15 +0200
+Subject: [PATCH] add missing include for build with GCC 12
+
+Related info: https://gcc.gnu.org/gcc-12/porting_to.html
+---
+ lib/include/srsran/srslog/bundled/fmt/core.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/lib/include/srsran/srslog/bundled/fmt/core.h b/lib/include/srsran/srslog/bundled/fmt/core.h
+index d676f27e5..04a85f295 100644
+--- a/lib/include/srsran/srslog/bundled/fmt/core.h
++++ b/lib/include/srsran/srslog/bundled/fmt/core.h
+@@ -8,7 +8,8 @@
+ #ifndef FMT_CORE_H_
+ #define FMT_CORE_H_
+
+-#include <cstdio> // std::FILE
++#include <array>
++#include <cstdio> // std::FILE
+ #include <cstring>
+ #include <functional>
+ #include <iterator>
+--
+2.36.1
+
diff --git a/0003-adt-fsm-ignore-GCC-warning-for-template-specializati.patch b/0003-adt-fsm-ignore-GCC-warning-for-template-specializati.patch
new file mode 100644
index 000000000000..b09a59833ad7
--- /dev/null
+++ b/0003-adt-fsm-ignore-GCC-warning-for-template-specializati.patch
@@ -0,0 +1,53 @@
+From aa9f844630d0627018c7ecb7008e309e1d04905e Mon Sep 17 00:00:00 2001
+From: Robert Falkenberg <robert.falkenberg@srs.io>
+Date: Fri, 13 May 2022 12:36:20 +0200
+Subject: [PATCH] adt,fsm: ignore GCC warning for template specialization w/wo
+ defaults for ReactFn or GuardFn
+
+---
+ lib/include/srsran/adt/fsm.h | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/lib/include/srsran/adt/fsm.h b/lib/include/srsran/adt/fsm.h
+index 1e00946d7..4583b1f19 100644
+--- a/lib/include/srsran/adt/fsm.h
++++ b/lib/include/srsran/adt/fsm.h
+@@ -332,6 +332,9 @@ public:
+ constexpr static void (Derived::*react_fn)(SrcState&, const Event&) = ReactFn;
+ constexpr static bool (Derived::*guard_fn)(SrcState&, const Event&) = GuardFn;
+
++ // ignore warning "never nullptr" for template specialization w/wo defaults for ReactFn or GuardFn
++ _Pragma("GCC diagnostic push"); // save current diagnostic config
++ _Pragma("GCC diagnostic ignored \"-Waddress\""); // ignore -Waddress
+ static bool react(derived_view* f, src_state_t& s, const event_t& ev)
+ {
+ if (guard_fn == nullptr or (f->*guard_fn)(s, ev)) {
+@@ -342,6 +345,7 @@ public:
+ }
+ return false;
+ }
++ _Pragma("GCC diagnostic pop"); // restore diagnostic config
+
+ template <typename SrcState2, typename Event2>
+ using is_match = std::is_same<type_list<SrcState2, Event2>, type_list<src_state_t, event_t> >;
+@@ -363,6 +367,9 @@ public:
+ constexpr static void (Derived::*react_fn)(const Event&) = ReactFn;
+ constexpr static bool (Derived::*guard_fn)(const Event&) = GuardFn;
+
++ // ignore warning "never nullptr" for template specialization w/wo defaults for ReactFn or GuardFn
++ _Pragma("GCC diagnostic push"); // save current diagnostic config
++ _Pragma("GCC diagnostic ignored \"-Waddress\""); // ignore -Waddress
+ template <typename SrcState>
+ static bool react(derived_view* f, SrcState& s, const event_t& ev)
+ {
+@@ -374,6 +381,7 @@ public:
+ }
+ return false;
+ }
++ _Pragma("GCC diagnostic pop"); // restore diagnostic config
+
+ template <typename SrcState2, typename Event2>
+ using is_match = std::is_same<Event2, event_t>;
+--
+2.36.1
+
diff --git a/0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch b/0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch
new file mode 100644
index 000000000000..7de6fdf0625b
--- /dev/null
+++ b/0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch
@@ -0,0 +1,37 @@
+From 0c9ba5b87ee246b772c9deb2993834f0b7fc088b Mon Sep 17 00:00:00 2001
+From: Robert Falkenberg <robert.falkenberg@srs.io>
+Date: Fri, 13 May 2022 16:47:52 +0200
+Subject: [PATCH] lib,asn1_utils: fix out of bounds access on zero-sized array
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+* fix error: ... offset 0 is out of the bounds [0, 0] [-Werror=array-bounds]
+* fix note: destination object of size 0 allocated by ‘operator new []’
+--> data_ = new T[cap_];
+---
+ lib/include/srsran/asn1/asn1_utils.h | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/lib/include/srsran/asn1/asn1_utils.h b/lib/include/srsran/asn1/asn1_utils.h
+index 87696d7b6..f1dcfcd74 100644
+--- a/lib/include/srsran/asn1/asn1_utils.h
++++ b/lib/include/srsran/asn1/asn1_utils.h
+@@ -193,8 +193,12 @@ public:
+ {
+ size_ = nof_items;
+ cap_ = nof_items;
+- data_ = new T[cap_];
+- std::copy(ptr, ptr + size_, data_);
++ if (ptr != NULL) {
++ data_ = new T[cap_];
++ std::copy(ptr, ptr + size_, data_);
++ } else {
++ data_ = NULL;
++ }
+ }
+ ~dyn_array()
+ {
+--
+2.36.1
+
diff --git a/0005-cmake-gcc-disable-Werror-maybe-uninitialized-for-GCC.patch b/0005-cmake-gcc-disable-Werror-maybe-uninitialized-for-GCC.patch
new file mode 100644
index 000000000000..e48bb01480bf
--- /dev/null
+++ b/0005-cmake-gcc-disable-Werror-maybe-uninitialized-for-GCC.patch
@@ -0,0 +1,32 @@
+From 21a4a675dd74167552e6c78de432cd627e395481 Mon Sep 17 00:00:00 2001
+From: Robert Falkenberg <robert.falkenberg@srs.io>
+Date: Tue, 17 May 2022 15:10:41 +0200
+Subject: [PATCH] cmake/gcc: disable [-Werror=maybe-uninitialized] for GCC >=
+ 12.1.0
+
+With GCC 12.1.0 there are numerous false-positive warnings on
+"maybe uninitialized" variables.
+---
+ CMakeLists.txt | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 664cadb94..694b6373a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -540,6 +540,12 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
+ endif()
+
++# GCC >= 12.1.0: Disable analysis on "maybe-uninitialized" variables because of the high false-positive rate
++if(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-maybe-uninitialized")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized")
++endif()
++
+ if(CMAKE_C_COMPILER_ID MATCHES "GNU")
+ # Increase inlining limit to allow gcc compilation on e.g. RPi2
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --param large-function-growth=1600")
+--
+2.36.1
+
diff --git a/PKGBUILD b/PKGBUILD
index c15f74cfe093..0327acbbea0b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,7 +5,7 @@ pkgbase=srsran-git
pkgname=$pkgbase
_pkgname=srsRAN
pkgver=22.4.0.r0.gf2dff0b7a
-pkgrel=1
+pkgrel=2
pkgdesc='Open source SDR LTE software suite from Software Radio Systems (SRS)'
arch=('x86_64')
url='https://www.srsran.com'
@@ -19,8 +19,18 @@ optdepends=('libuhd: for USRP support'
'zeromq: for ZeroMQ support')
provides=('srsue' 'srsenb' 'srsenb')
conflicts=('srslte' 'srsran' 'srsue' 'srsenb' 'srsenb')
-source=("git+https://github.com/srsran/srsRAN.git")
-sha512sums=('SKIP')
+source=("git+https://github.com/srsran/srsRAN.git"
+ "0001-cmake-fix-build-for-cmake-option-BUILD_SHARED_LIBS-O.patch"
+ "0002-add-missing-include-for-build-with-GCC-12.patch"
+ "0003-adt-fsm-ignore-GCC-warning-for-template-specializati.patch"
+ "0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch"
+ "0005-cmake-gcc-disable-Werror-maybe-uninitialized-for-GCC.patch")
+sha512sums=('SKIP'
+ 'cf684f173b53673ae2413b0c3a7261d24f1afd58e42727cdc594882b0367e470aa0416f4f4b675f773d9d5ef43cd21fbe9c97a3d67591bad559ea1352d593e8b'
+ '0b690d3bb8a2a0009c24a9b68f6b0da2b202ba32c7d4dd71d0c102f510c7f50419099af7a1bc89ff94fd4f945bbfd08a211d4806e204cea479d9ae0220fc5eaf'
+ '1115bfdf51d3026724535e8a847d2ec26c27281efb1063bf1e13e220aee2a1a051a83a0d38cb898aa42323f93c865d879132a085cd95f33a01f6365b4b2f1892'
+ 'da931d9a7437510ce009c604161a052727ef7566d376c268f524f56449271a33e2dff5f8e807fcabfb144fccb36b4a125f4bfd77b4d9663e6e9364a855046dc3'
+ 'a1ed2b6e57ed598a2e47e014a4941999962e5cc1c4677a08834844ffbc23d8dce76f25a1f4868e01976da14369a7550b550738eee68f460323b23238b7062685')
options=(!lto)
pkgver() {
@@ -29,6 +39,15 @@ pkgver() {
git describe --long --tags | sed 's/\(release_[0-9]\+_[0-9]\+\)\(-\)/\1_0\2/' | sed 's/\(0\+\)\([1-9]*[0-9]\)/\2/g' | sed 's/^\(release_\)\1*//' | sed 's/\([^-]*-g\)/r\1/;s/[-_]/./g'
}
+prepare() {
+ # apply patches for compatibility with GCC 12.1.0
+ patch --directory="${_pkgname}" -p1 -i "$srcdir/0001-cmake-fix-build-for-cmake-option-BUILD_SHARED_LIBS-O.patch"
+ patch --directory="${_pkgname}" -p1 -i "$srcdir/0002-add-missing-include-for-build-with-GCC-12.patch"
+ patch --directory="${_pkgname}" -p1 -i "$srcdir/0003-adt-fsm-ignore-GCC-warning-for-template-specializati.patch"
+ patch --directory="${_pkgname}" -p1 -i "$srcdir/0004-lib-asn1_utils-fix-out-of-bounds-access-on-zero-size.patch"
+ patch --directory="${_pkgname}" -p1 -i "$srcdir/0005-cmake-gcc-disable-Werror-maybe-uninitialized-for-GCC.patch"
+}
+
build() {
# clear compiler flags set by makepkg.conf
CFLAGS=""