* [Buildroot] [PATCH] package/dhcpdump: fix build at -O2
@ 2018-12-27 15:10 Thomas Petazzoni
2018-12-28 10:52 ` Thomas Petazzoni
2019-01-18 13:13 ` Peter Korsgaard
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2018-12-27 15:10 UTC (permalink / raw)
To: buildroot
Since commit aa556e2035c023d4328185a46e15df532e566067
("utils/genrandconfig: test with BR2_OPTIMIZE_2=y"), we are doing
builds at -O2 instead of -Os. This has unveiled an issue in the
strsep.c file:
strsep.c:65:23: error: register name not specified for 'delim'
register const char *delim;
This strsep.c compatibility code is compiled in if HAVE_STRSEP is not
defined, but dhcpdump does not use any kind of configure script to
detect the availability of strsep(). Therefore by default, it gets
compiled in, and the "register" specifier used for some variable
declarations in strsep.c cause build issues at -O2.
A previous commit in Buildroot from
c2a7f0d6051f71f3bb9d83b574d70814339e4b95 ("dhcpdump: Fix strsep()
feature test"), attempted to fix this problem by changing the test on
HAVE_STRSEP by a test on _BSD_SOURCE.
Unfortunately, _BSD_SOURCE is not meant to be tested: it's a feature
macro that is meant to be *defined* by some code to tell the C library
headers to expose (or not) some given functionality.
So instead, we basically revert commit
c2a7f0d6051f71f3bb9d83b574d70814339e4b95 by dropping the patch, and
pass -DHAVE_STRSEP in the CFLAGS when building dhcpdump.
Fixes:
http://autobuild.buildroot.net/results/7231170d3d3e3637f02382c1a0a96009b0527618/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
.../0002-fix-strsep-feature-test.patch | 27 -------------------
package/dhcpdump/dhcpdump.mk | 5 +++-
2 files changed, 4 insertions(+), 28 deletions(-)
delete mode 100644 package/dhcpdump/0002-fix-strsep-feature-test.patch
diff --git a/package/dhcpdump/0002-fix-strsep-feature-test.patch b/package/dhcpdump/0002-fix-strsep-feature-test.patch
deleted file mode 100644
index 06bab947c0..0000000000
--- a/package/dhcpdump/0002-fix-strsep-feature-test.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Use the official _BSD_SOURCE feature test macro instead of the meaningless
-HAVE_STRSEP macro in order to detect the availability of strsep().
-
-This allows toolchains supporting strsep() to use it instead of the custom
-implementation from dhcpdump, which also avoids the following error with some
-toolchains:
-
- In file included from dhcpdump.c:30:0:
- dhcpdump.c: At top level:
- strsep.c:65:23: error: register name not specified for ?delim?
- register const char *delim;
- ^
-
-Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
-
-diff -Nrdup dhcpdump-1.8.orig/dhcpdump.c dhcpdump-1.8/dhcpdump.c
---- dhcpdump-1.8.orig/dhcpdump.c 2008-06-24 05:26:52.000000000 +0200
-+++ dhcpdump-1.8/dhcpdump.c 2011-05-31 19:22:15.987388498 +0200
-@@ -26,7 +26,7 @@
- #include <regex.h>
- #include "dhcp_options.h"
-
--#ifndef HAVE_STRSEP
-+#ifndef _BSD_SOURCE
- #include "strsep.c"
- #endif
-
diff --git a/package/dhcpdump/dhcpdump.mk b/package/dhcpdump/dhcpdump.mk
index 96f231962d..2413812880 100644
--- a/package/dhcpdump/dhcpdump.mk
+++ b/package/dhcpdump/dhcpdump.mk
@@ -15,8 +15,11 @@ ifeq ($(BR2_STATIC_LIBS),y)
DHCPDUMP_LIBS += `$(STAGING_DIR)/usr/bin/pcap-config --static --additional-libs`
endif
+# glibc, uclibc and musl have strsep()
+DHCPDUMP_CFLAGS = $(TARGET_CFLAGS) -DHAVE_STRSEP
+
define DHCPDUMP_BUILD_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CC="$(TARGET_CC) $(TARGET_CFLAGS) \
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CC="$(TARGET_CC) $(DHCPDUMP_CFLAGS) \
-D_GNU_SOURCE" LIBS="$(DHCPDUMP_LIBS)"
endef
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] package/dhcpdump: fix build at -O2
2018-12-27 15:10 [Buildroot] [PATCH] package/dhcpdump: fix build at -O2 Thomas Petazzoni
@ 2018-12-28 10:52 ` Thomas Petazzoni
2019-01-18 13:13 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2018-12-28 10:52 UTC (permalink / raw)
To: buildroot
Hello,
On Thu, 27 Dec 2018 16:10:11 +0100, Thomas Petazzoni wrote:
> Since commit aa556e2035c023d4328185a46e15df532e566067
> ("utils/genrandconfig: test with BR2_OPTIMIZE_2=y"), we are doing
> builds at -O2 instead of -Os. This has unveiled an issue in the
> strsep.c file:
>
> strsep.c:65:23: error: register name not specified for 'delim'
> register const char *delim;
>
> This strsep.c compatibility code is compiled in if HAVE_STRSEP is not
> defined, but dhcpdump does not use any kind of configure script to
> detect the availability of strsep(). Therefore by default, it gets
> compiled in, and the "register" specifier used for some variable
> declarations in strsep.c cause build issues at -O2.
>
> A previous commit in Buildroot from
> c2a7f0d6051f71f3bb9d83b574d70814339e4b95 ("dhcpdump: Fix strsep()
> feature test"), attempted to fix this problem by changing the test on
> HAVE_STRSEP by a test on _BSD_SOURCE.
>
> Unfortunately, _BSD_SOURCE is not meant to be tested: it's a feature
> macro that is meant to be *defined* by some code to tell the C library
> headers to expose (or not) some given functionality.
>
> So instead, we basically revert commit
> c2a7f0d6051f71f3bb9d83b574d70814339e4b95 by dropping the patch, and
> pass -DHAVE_STRSEP in the CFLAGS when building dhcpdump.
>
> Fixes:
>
> http://autobuild.buildroot.net/results/7231170d3d3e3637f02382c1a0a96009b0527618/
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
> .../0002-fix-strsep-feature-test.patch | 27 -------------------
> package/dhcpdump/dhcpdump.mk | 5 +++-
> 2 files changed, 4 insertions(+), 28 deletions(-)
> delete mode 100644 package/dhcpdump/0002-fix-strsep-feature-test.patch
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] package/dhcpdump: fix build at -O2
2018-12-27 15:10 [Buildroot] [PATCH] package/dhcpdump: fix build at -O2 Thomas Petazzoni
2018-12-28 10:52 ` Thomas Petazzoni
@ 2019-01-18 13:13 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2019-01-18 13:13 UTC (permalink / raw)
To: buildroot
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:
> Since commit aa556e2035c023d4328185a46e15df532e566067
> ("utils/genrandconfig: test with BR2_OPTIMIZE_2=y"), we are doing
> builds at -O2 instead of -Os. This has unveiled an issue in the
> strsep.c file:
> strsep.c:65:23: error: register name not specified for 'delim'
> register const char *delim;
> This strsep.c compatibility code is compiled in if HAVE_STRSEP is not
> defined, but dhcpdump does not use any kind of configure script to
> detect the availability of strsep(). Therefore by default, it gets
> compiled in, and the "register" specifier used for some variable
> declarations in strsep.c cause build issues at -O2.
> A previous commit in Buildroot from
> c2a7f0d6051f71f3bb9d83b574d70814339e4b95 ("dhcpdump: Fix strsep()
> feature test"), attempted to fix this problem by changing the test on
> HAVE_STRSEP by a test on _BSD_SOURCE.
> Unfortunately, _BSD_SOURCE is not meant to be tested: it's a feature
> macro that is meant to be *defined* by some code to tell the C library
> headers to expose (or not) some given functionality.
> So instead, we basically revert commit
> c2a7f0d6051f71f3bb9d83b574d70814339e4b95 by dropping the patch, and
> pass -DHAVE_STRSEP in the CFLAGS when building dhcpdump.
> Fixes:
> http://autobuild.buildroot.net/results/7231170d3d3e3637f02382c1a0a96009b0527618/
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Committed to 2018.02.x and 2018.11.x, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-18 13:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-27 15:10 [Buildroot] [PATCH] package/dhcpdump: fix build at -O2 Thomas Petazzoni
2018-12-28 10:52 ` Thomas Petazzoni
2019-01-18 13:13 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox