Skip to contentSkip to conversation

collectd: Fix build with glibc 2.30

PATCH In review Khem Raj 2 participants 5 messages Jul 27, 2019 – Jul 28, 2019

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 collectd: Fix build with glibc 2.30

---
 .../0001-Remove-including-sys-sysctl.h.patch  | 81 +++++++++++++++++++
 .../collectd/collectd_5.8.1.bb                |  1 +
 2 files changed, 82 insertions(+)
 create mode 100644 meta-oe/recipes-extended/collectd/collectd/0001-Remove-including-sys-sysctl.h.patch
meta-oe/recipes-extended/collectd/collectd/0001-Remove-including-sys-sysctl.h.patch new file +81 -0
new file mode 100644
index 0000000000..450cdd0e5f
@@ -0,0 +1,81 @@
+From e06c1b4259533ef7a396da841cbf950baccd8c11 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 27 Jul 2019 12:20:22 -0700
+Subject: [PATCH] Remove including sys/sysctl.h
+
+Glibc 2.30 has added deprecation notice and collectd detects it as
+warning
+
+Fixes
+sys/sysctl.h:21:2: error: "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror,-W#warnings]
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/contextswitch.c | 4 ----
+ src/memory.c        | 3 ---
+ src/swap.c          | 3 ---
+ src/uuid.c          | 4 ----
+ 4 files changed, 14 deletions(-)
+
+diff --git a/src/contextswitch.c b/src/contextswitch.c
+index 461fb0a..75d42ae 100644
+--- a/src/contextswitch.c
++++ b/src/contextswitch.c
+@@ -26,10 +26,6 @@
+ #include "common.h"
+ #include "plugin.h"
+ 
+-#ifdef HAVE_SYS_SYSCTL_H
+-#include <sys/sysctl.h>
+-#endif
+-
+ #if HAVE_SYSCTLBYNAME
+ /* no global variables */
+ /* #endif HAVE_SYSCTLBYNAME */
+diff --git a/src/memory.c b/src/memory.c
+index e49fe84..41996d5 100644
+--- a/src/memory.c
++++ b/src/memory.c
+@@ -28,9 +28,6 @@
+ #include "common.h"
+ #include "plugin.h"
+ 
+-#ifdef HAVE_SYS_SYSCTL_H
+-#include <sys/sysctl.h>
+-#endif
+ #ifdef HAVE_SYS_VMMETER_H
+ #include <sys/vmmeter.h>
+ #endif
+diff --git a/src/swap.c b/src/swap.c
+index 78f05c5..2488a5b 100644
+--- a/src/swap.c
++++ b/src/swap.c
+@@ -49,9 +49,6 @@
+ #if HAVE_SYS_PARAM_H
+ #include <sys/param.h>
+ #endif
+-#if HAVE_SYS_SYSCTL_H
+-#include <sys/sysctl.h>
+-#endif
+ #if HAVE_SYS_DKSTAT_H
+ #include <sys/dkstat.h>
+ #endif
+diff --git a/src/uuid.c b/src/uuid.c
+index 1cb9027..1c6cdc6 100644
+--- a/src/uuid.c
++++ b/src/uuid.c
+@@ -29,10 +29,6 @@
+ #include "common.h"
+ #include "plugin.h"
+ 
+-#if HAVE_SYS_SYSCTL_H
+-#include <sys/sysctl.h>
+-#endif
+-
+ #define UUID_RAW_LENGTH 16
+ #define UUID_PRINTABLE_COMPACT_LENGTH (UUID_RAW_LENGTH * 2)
+ #define UUID_PRINTABLE_NORMAL_LENGTH (UUID_PRINTABLE_COMPACT_LENGTH + 4)
+-- 
+2.22.0
+
meta-oe/recipes-extended/collectd/collectd_5.8.1.bb +1 -0
index 6dff18c16b..ed8b8a5d2b 100644
@@ -14,6 +14,7 @@ SRC_URI = "http://collectd.org/files/collectd-${PV}.tar.bz2 \
            file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch \
            file://0005-Disable-new-gcc8-warnings.patch \
            file://0006-libcollectdclient-Fix-string-overflow-errors.patch \
+           file://0001-Remove-including-sys-sysctl.h.patch \
            "
 SRC_URI[md5sum] = "bfce96c42cede5243028510bcc57c1e6"
 SRC_URI[sha256sum] = "e796fda27ce06377f491ad91aa286962a68c2b54076aa77a29673d53204453da"
Signature · 1 line
2.22.0
author
#1 lore raw

PATCH 2/2 pegtl: Fix build with clang/libc++

---
 .../0001-add-missing-virtual-dtors.patch      | 72 +++++++++++++++++++
 meta-oe/recipes-extended/pegtl/pegtl_2.1.4.bb |  4 +-
 2 files changed, 75 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-extended/pegtl/pegtl/0001-add-missing-virtual-dtors.patch
meta-oe/recipes-extended/pegtl/pegtl/0001-add-missing-virtual-dtors.patch new file +72 -0
new file mode 100644
index 0000000000..829c8ae5cb
@@ -0,0 +1,72 @@
+From 2c7cc8c669e513154e98762d6ed7c6d1bf338505 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 27 Jul 2019 12:54:49 -0700
+Subject: [PATCH] add missing virtual dtors
+
+Fixes clang warnings
+/usr/include/c++/v1/memory:3710:5: error: destructor called on non-final 'examples::null_json' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-abstract-non-virtual-dtor]
+__data_.second().~_Tp();
+^
+
+Signed-off-by: Khem Raj <[email protected]>
+Upstream-Status: Submitted [https://github.com/taocpp/PEGTL/pull/181]
+---
+ src/example/pegtl/json_classes.hpp | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/src/example/pegtl/json_classes.hpp b/src/example/pegtl/json_classes.hpp
+index 7227870c..9ea66ce7 100644
+--- a/src/example/pegtl/json_classes.hpp
++++ b/src/example/pegtl/json_classes.hpp
+@@ -58,6 +58,7 @@ namespace examples
+          : json_base( json_type::ARRAY )
+       {
+       }
++      virtual ~array_json() {}
+ 
+       std::vector< std::shared_ptr< json_base > > data;
+ 
+@@ -83,6 +84,7 @@ namespace examples
+            data( in_data )
+       {
+       }
++      virtual ~boolean_json() {}
+ 
+       bool data;
+ 
+@@ -99,7 +101,7 @@ namespace examples
+          : json_base( json_type::NULL_ )
+       {
+       }
+-
++      virtual ~null_json() {}
+       virtual void stream( std::ostream& o ) const override
+       {
+          o << "null";
+@@ -114,6 +116,7 @@ namespace examples
+            data( in_data )
+       {
+       }
++      virtual ~number_json() {}
+ 
+       long double data;
+ 
+@@ -179,6 +182,7 @@ namespace examples
+            data( in_data )
+       {
+       }
++      virtual ~string_json() {}
+ 
+       std::string data;
+ 
+@@ -195,6 +199,7 @@ namespace examples
+          : json_base( json_type::OBJECT )
+       {
+       }
++      virtual ~object_json() {}
+ 
+       std::map< std::string, std::shared_ptr< json_base > > data;
+ 
+-- 
+2.22.0
+
meta-oe/recipes-extended/pegtl/pegtl_2.1.4.bb +3 -1
index f41eef2a01..5cea295c5a 100644
@@ -4,7 +4,9 @@ LICENSE="MIT"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=80cb066ab204c7fe022f1cfe0c2c6818"
 
 SRCREV = "776fa4a1e8bda860008524f6dd9473967c8375b1"
-SRC_URI = "git://[email protected]/taocpp/PEGTL.git;protocol=https;branch=master"
+SRC_URI = "git://[email protected]/taocpp/PEGTL.git;protocol=https;branch=master \
+           file://0001-add-missing-virtual-dtors.patch \
+          "
 
 inherit cmake
 
Signature · 1 line
2.22.0
#2 lore raw
In reply to Khem Raj

meta-oe/recipes-extended/collectd/collectd/0001-Remove-including-sys-sysctl.h.patch line 10

Quoted 7 lines · Khem Raj

...

meta-oe/recipes-extended/collectd/collectd/0001-Remove-including-sys-sysctl.h.patch new file +5 -0
+Glibc 2.30 has added deprecation notice and collectd detects it as
+warning
+
+Fixes
+sys/sysctl.h:21:2: error: "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror,-W#warnings]
...

This package accumulates patches in OE that could be avoided by configuring with --disable-werror instead.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
author
#3 lore raw
Quoted 10 lines · Adrian Bunk

meta-oe/recipes-extended/collectd/collectd/0001-Remove-including-sys-sysctl.h.patch line 10

Quoted 7 lines · Khem Raj

...

meta-oe/recipes-extended/collectd/collectd/0001-Remove-including-sys-sysctl.h.patch new file +5 -0
+Glibc 2.30 has added deprecation notice and collectd detects it as
+warning
+
+Fixes
+sys/sysctl.h:21:2: error: "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror,-W#warnings]
...

This package accumulates patches in OE that could be avoided by configuring with --disable-werror instead.

thats true but it would mask these issues by disabling werror and we wont be doing submissions like https://github.com/collectd/collectd/pull/3234, I would like us to fix things upstream instead of masking them.

Quoted 4 lines

cu
Adrian

#4 lore raw
Quoted 13 lines · Khem Raj
Quoted 10 lines · Adrian Bunk

meta-oe/recipes-extended/collectd/collectd/0001-Remove-including-sys-sysctl.h.patch line 10

Quoted 7 lines · Khem Raj

...

meta-oe/recipes-extended/collectd/collectd/0001-Remove-including-sys-sysctl.h.patch new file +5 -0
+Glibc 2.30 has added deprecation notice and collectd detects it as
+warning
+
+Fixes
+sys/sysctl.h:21:2: error: "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror,-W#warnings]
...

This package accumulates patches in OE that could be avoided by configuring with --disable-werror instead.

Quoted 2 lines

thats true but it would mask these issues by disabling werror and we wont be doing submissions like https://github.com/collectd/collectd/pull/3234,

With what range of glibc versions has this submission been verified?

Putting !defined(__GLIBC__) into source files is usually wrong, and in this case it is unclear what happens with ancient glibc versions.

Note that --disable-werror would do the right thing will all glibc versions past, present and future since the file will no longer be included without any patch needed once the header is actually gone.

Quoted 1 line

I would like us to fix things upstream instead of masking them.

Status quo is that people look at harmless issues like this one in the tiny subset of packages where -Werror is used, but noone seems to care about serious runtime problems like implicit function declarations in other packages.

And looking at the huge number of questionable patches in OE I don't agree that it would in general be a good idea to apply fixes for random issues in OE before they have been applied upstream - there are plenty examples in the open source world where downstreams "fixing" issues in upstream software caused problems, including major security issues (I remember Debian/Ubuntu releases shipping a patched openssl generating predictable private keys due to a bogus Debian "fix" for a Valgrind warning).

Reality is often more complicated, but in general downstream distributions should try to avoid touching the upstream code and aim at shipping unpatched upstream sources whenever possible.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed