mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-07-16 16:27:27 +00:00
bridge-utils: various build fixes (musl & CFLAGS)
bridge-utils suffers from a few problems: - doesn't build on musl - doesn't respect CFLAGS - build errors are silently ignored - doesn't support parallel make All of these are addressed with the included patches. Signed-off-by: André Draszik <git@andred.net> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
This commit is contained in:
committed by
Joe MacDonald
parent
9fb484ed57
commit
8b28f076f9
+69
@@ -0,0 +1,69 @@
|
|||||||
|
From 5e102b453e254d16af1f95053134f58348e0f83a Mon Sep 17 00:00:00 2001
|
||||||
|
From: root <git@andred.net>
|
||||||
|
Date: Wed, 20 Jul 2016 23:40:30 +0100
|
||||||
|
Subject: [PATCH 1/5] build: error out correctly if a submake fails
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Due to use of a for loop, return status from submake was always
|
||||||
|
ignored.
|
||||||
|
|
||||||
|
In the context of build-systems like OE this causes them to not
|
||||||
|
detect any errors and continue happily, resulting in a successful,
|
||||||
|
but incomplete, build.
|
||||||
|
|
||||||
|
Fix by having a nicer Makefile.in which now has rules for the
|
||||||
|
individual targets (directories) so that make itself can
|
||||||
|
figure out all the dependencies and build those targets as
|
||||||
|
needed rather than using a for loop to iterate over the
|
||||||
|
directories in a shell and thus loosing the return status of
|
||||||
|
the command inside the loop.
|
||||||
|
|
||||||
|
This has the added advantage that parallel builds work now.
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: André Draszik <git@andred.net>
|
||||||
|
---
|
||||||
|
Makefile.in | 18 ++++++++++++------
|
||||||
|
1 file changed, 12 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile.in b/Makefile.in
|
||||||
|
index 6028513..dab88bb 100644
|
||||||
|
--- a/Makefile.in
|
||||||
|
+++ b/Makefile.in
|
||||||
|
@@ -13,11 +13,11 @@ distdir = $(PACKAGE)-$(VERSION)
|
||||||
|
|
||||||
|
SUBDIRS=libbridge brctl doc
|
||||||
|
|
||||||
|
-all:
|
||||||
|
- for x in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$x ; done
|
||||||
|
+all: override ACTION=
|
||||||
|
+all: $(SUBDIRS)
|
||||||
|
|
||||||
|
-clean:
|
||||||
|
- for x in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$x clean ; done
|
||||||
|
+clean: override ACTION=clean
|
||||||
|
+clean: $(SUBDIRS)
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.log
|
||||||
|
@@ -30,6 +30,12 @@ maintainer-clean: distclean
|
||||||
|
rm -f libbridge/Makefile
|
||||||
|
rm -f doc/Makefile
|
||||||
|
|
||||||
|
-install:
|
||||||
|
- for x in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$x install; done
|
||||||
|
+install: override ACTION=install
|
||||||
|
+install: $(SUBDIRS)
|
||||||
|
|
||||||
|
+
|
||||||
|
+brctl: libbridge
|
||||||
|
+$(SUBDIRS):
|
||||||
|
+ $(MAKE) $(MFLAGS) -C $@ $(ACTION)
|
||||||
|
+
|
||||||
|
+.PHONY: $(SUBDIRS)
|
||||||
|
--
|
||||||
|
2.8.1
|
||||||
|
|
||||||
+64
@@ -0,0 +1,64 @@
|
|||||||
|
From 68fafc4ea10365ac2e74ab7c660d097696857677 Mon Sep 17 00:00:00 2001
|
||||||
|
From: root <git@andred.net>
|
||||||
|
Date: Wed, 20 Jul 2016 23:40:32 +0100
|
||||||
|
Subject: [PATCH 2/5] libbridge: fix some build-time warnings (fcntl.h)
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
There are build-time warnings at the moment when building
|
||||||
|
against musl, as the code here #include's the wrong file,
|
||||||
|
sys/fcntl.h instead of fcntl.h
|
||||||
|
|
||||||
|
In file included from libbridge_devif.c:26:0:
|
||||||
|
<sysroot>/usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Wcpp]
|
||||||
|
#warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
|
||||||
|
^~~~~~~
|
||||||
|
In file included from libbridge_if.c:23:0:
|
||||||
|
<sysroot>/usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Wcpp]
|
||||||
|
#warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
|
||||||
|
^~~~~~~
|
||||||
|
|
||||||
|
glibc headers silently redirect sys/fcntl.h to fcntl.h so the
|
||||||
|
issue is not seen there.
|
||||||
|
|
||||||
|
Let's fix the #include's to so as to use the correct ones
|
||||||
|
and silence the compiler.
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: André Draszik <git@andred.net>
|
||||||
|
---
|
||||||
|
libbridge/libbridge_devif.c | 2 +-
|
||||||
|
libbridge/libbridge_if.c | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libbridge/libbridge_devif.c b/libbridge/libbridge_devif.c
|
||||||
|
index 1e83925..2cf78f6 100644
|
||||||
|
--- a/libbridge/libbridge_devif.c
|
||||||
|
+++ b/libbridge/libbridge_devif.c
|
||||||
|
@@ -23,7 +23,7 @@
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
-#include <sys/fcntl.h>
|
||||||
|
+#include <fcntl.h>
|
||||||
|
|
||||||
|
#include "libbridge.h"
|
||||||
|
#include "libbridge_private.h"
|
||||||
|
diff --git a/libbridge/libbridge_if.c b/libbridge/libbridge_if.c
|
||||||
|
index 77d3f8a..9cf4bac 100644
|
||||||
|
--- a/libbridge/libbridge_if.c
|
||||||
|
+++ b/libbridge/libbridge_if.c
|
||||||
|
@@ -20,7 +20,7 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
-#include <sys/fcntl.h>
|
||||||
|
+#include <fcntl.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
#include "libbridge.h"
|
||||||
|
--
|
||||||
|
2.8.1
|
||||||
|
|
||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
From 2b9dc245f93ab27d7da42a16ddbb9212888006e4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: root <git@andred.net>
|
||||||
|
Date: Wed, 20 Jul 2016 23:40:33 +0100
|
||||||
|
Subject: [PATCH 3/5] bridge: fix some build-time warnings (errno.h)
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
There is a build-time warning at the moment when building
|
||||||
|
against musl, as the code here #include's the wrong file,
|
||||||
|
sys/errno.h instead of errno.h
|
||||||
|
|
||||||
|
In file included from brctl.c:22:0:
|
||||||
|
<sysroot>/usr/include/sys/errno.h:1:2: warning: #warning redirecting incorrect #include <sys/errno.h> to <errno.h> [-Wcpp]
|
||||||
|
#warning redirecting incorrect #include <sys/errno.h> to <errno.h>
|
||||||
|
^~~~~~~
|
||||||
|
|
||||||
|
glibc headers silently redirect sys/errno.h to errno.h so the
|
||||||
|
issue is not seen there.
|
||||||
|
|
||||||
|
Let's fix the #include's to so as to use the correct ones
|
||||||
|
and silence the compiler.
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: André Draszik <git@andred.net>
|
||||||
|
---
|
||||||
|
brctl/brctl.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/brctl/brctl.c b/brctl/brctl.c
|
||||||
|
index 46ca352..8855234 100644
|
||||||
|
--- a/brctl/brctl.c
|
||||||
|
+++ b/brctl/brctl.c
|
||||||
|
@@ -19,7 +19,7 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
-#include <sys/errno.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
|
||||||
|
#include "libbridge.h"
|
||||||
|
--
|
||||||
|
2.8.1
|
||||||
|
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
From c45b73829a8b8c7924df528baa7e16498f917288 Mon Sep 17 00:00:00 2001
|
||||||
|
From: root <git@andred.net>
|
||||||
|
Date: Wed, 20 Jul 2016 23:40:33 +0100
|
||||||
|
Subject: [PATCH 4/5] libbridge: add missing #include's (fix build against
|
||||||
|
musl)
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Fixes error like:
|
||||||
|
|
||||||
|
In file included from libbridge_devif.c:28:0:
|
||||||
|
libbridge.h:45:17: error: field 'max_age' has incomplete type
|
||||||
|
struct timeval max_age;
|
||||||
|
^~~~~~~
|
||||||
|
In file included from libbridge_devif.c:28:0:
|
||||||
|
libbridge.h:51:2: error: unknown type name 'u_int16_t'
|
||||||
|
u_int16_t root_port;
|
||||||
|
^~~~~~~~~
|
||||||
|
|
||||||
|
These types are not standard C but rather Posix,
|
||||||
|
for struct timeval see:
|
||||||
|
http://pubs.opengroup.org/onlinepubs/7908799/xsh/systime.h.html
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: André Draszik <git@andred.net>
|
||||||
|
---
|
||||||
|
libbridge/libbridge.h | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/libbridge/libbridge.h b/libbridge/libbridge.h
|
||||||
|
index 53ec869..b0727c1 100644
|
||||||
|
--- a/libbridge/libbridge.h
|
||||||
|
+++ b/libbridge/libbridge.h
|
||||||
|
@@ -20,6 +20,8 @@
|
||||||
|
#define _LIBBRIDGE_H
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
+#include <sys/time.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
#include <linux/in6.h>
|
||||||
|
#include <linux/if.h>
|
||||||
|
#include <linux/if_bridge.h>
|
||||||
|
--
|
||||||
|
2.8.1
|
||||||
|
|
||||||
+53
@@ -0,0 +1,53 @@
|
|||||||
|
From 7bc1932cabfafca8c68e18bd43e3d203c70d2dd8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: root <git@andred.net>
|
||||||
|
Date: Wed, 20 Jul 2016 23:40:33 +0100
|
||||||
|
Subject: [PATCH 5/5] build: don't ignore CFLAGS from environment
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
We need to take them into account so as to behave nicely towards
|
||||||
|
build environments which expect to be able to set them, e.g. for
|
||||||
|
optimisation flags, or debug options.
|
||||||
|
|
||||||
|
Therefore they need to be added to the compiler command line of
|
||||||
|
every source file, and in addition, the same CFLAGS that were
|
||||||
|
used during compilation must also always be used during linking!
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: André Draszik <git@andred.net>
|
||||||
|
---
|
||||||
|
brctl/Makefile.in | 2 +-
|
||||||
|
libbridge/Makefile.in | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/brctl/Makefile.in b/brctl/Makefile.in
|
||||||
|
index e1956d6..eff260c 100644
|
||||||
|
--- a/brctl/Makefile.in
|
||||||
|
+++ b/brctl/Makefile.in
|
||||||
|
@@ -34,7 +34,7 @@ install: $(PROGRAMS)
|
||||||
|
$(INSTALL) -m 755 $(PROGRAMS) $(DESTDIR)$(sbindir)
|
||||||
|
|
||||||
|
brctl: $(brctl_OBJECTS) ../libbridge/libbridge.a
|
||||||
|
- $(CC) $(LDFLAGS) $(brctl_OBJECTS) $(LIBS) -o brctl
|
||||||
|
+ $(CC) $(CFLAGS) $(LDFLAGS) $(brctl_OBJECTS) $(LIBS) -o brctl
|
||||||
|
|
||||||
|
%.o: %.c brctl.h
|
||||||
|
$(CC) $(CFLAGS) $(INCLUDE) -c $<
|
||||||
|
diff --git a/libbridge/Makefile.in b/libbridge/Makefile.in
|
||||||
|
index 20512c4..4e1cddc 100644
|
||||||
|
--- a/libbridge/Makefile.in
|
||||||
|
+++ b/libbridge/Makefile.in
|
||||||
|
@@ -5,7 +5,7 @@ AR=ar
|
||||||
|
RANLIB=@RANLIB@
|
||||||
|
|
||||||
|
CC=@CC@
|
||||||
|
-CFLAGS = -Wall -g $(KERNEL_HEADERS)
|
||||||
|
+CFLAGS = -Wall -g $(KERNEL_HEADERS) @CFLAGS@
|
||||||
|
|
||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
--
|
||||||
|
2.8.1
|
||||||
|
|
||||||
@@ -1,8 +1,13 @@
|
|||||||
require bridge-utils.inc
|
require bridge-utils.inc
|
||||||
|
|
||||||
SRC_URI += "file://kernel-headers.patch"
|
SRC_URI += "\
|
||||||
|
file://kernel-headers.patch \
|
||||||
PARALLEL_MAKE = ""
|
file://0001-build-error-out-correctly-if-a-submake-fails.patch \
|
||||||
|
file://0002-libbridge-fix-some-build-time-warnings-fcntl.h.patch \
|
||||||
|
file://0003-bridge-fix-some-build-time-warnings-errno.h.patch \
|
||||||
|
file://0004-libbridge-add-missing-include-s-fix-build-against-mu.patch \
|
||||||
|
file://0005-build-don-t-ignore-CFLAGS-from-environment.patch \
|
||||||
|
"
|
||||||
|
|
||||||
LIC_FILES_CHKSUM = "file://COPYING;md5=f9d20a453221a1b7e32ae84694da2c37"
|
LIC_FILES_CHKSUM = "file://COPYING;md5=f9d20a453221a1b7e32ae84694da2c37"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user