Skip to contentSkip to conversation

package/netplug: fix musl build errors

PATCH New Bernd Kuhls 2 participants 2 messages May 29, 2016 – May 31, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/netplug: fix musl build errors

Fixes
http://autobuild.buildroot.net/results/02c/02c967a211cfb43dcb5119ea57a0cdef96e5880b/

---
v2: - simplified __assert_fail patch by adjusting the data types instead
of removing the function
- improved patch comment (Thomas)

 package/netplug/0002-musl.patch | 44 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 package/netplug/0002-musl.patch
package/netplug/0002-musl.patch new file +44 -0
new file mode 100644
index 0000000..fd86a19
@@ -0,0 +1,44 @@
+Fix musl build
+
+Upstream usage of __assert_fail failed to compile:
+
+ib.c:204:1: error: conflicting types for ?__assert_fail?
+ __assert_fail(const char *assertion, const char *file,
+ ^
+In file included from lib.c:21:0:
+/home/buildroot/buildroot/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/assert.h:19:6: note: previous declaration of ?__assert_fail? was here
+ void __assert_fail (const char *, const char *, int, const char *);
+      ^
+
+Change from unsigned int to int according to musl define.
+
+Add time.h to netplug.h to fix compile error due to missing header:
+
+netplug.h:77:5: error: unknown type name ?time_t?
+     time_t      lastchange;     /* timestamp of last state change */
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+
+diff -uNr netplug-1.2.9.2.org/lib.c netplug-1.2.9.2/lib.c
+--- netplug-1.2.9.2.org/lib.c	2008-12-23 00:36:23.000000000 +0100
++++ netplug-1.2.9.2/lib.c	2016-05-29 16:21:13.000000000 +0200
+@@ -202,7 +202,7 @@
+ 
+ void
+ __assert_fail(const char *assertion, const char *file,
+-              unsigned int line, const char *function)
++              int line, const char *function)
+ {
+     do_log(LOG_CRIT, "%s:%u: %s%sAssertion `%s' failed",
+            file, line,
+diff -uNr netplug-1.2.9.2.org/netplug.h netplug-1.2.9.2/netplug.h
+--- netplug-1.2.9.2.org/netplug.h	2008-12-23 00:36:23.000000000 +0100
++++ netplug-1.2.9.2/netplug.h	2016-05-29 16:22:01.000000000 +0200
+@@ -25,6 +25,7 @@
+ #include <sys/socket.h>
+ #include <linux/netlink.h>
+ #include <linux/rtnetlink.h>
++#include <time.h>
+ 
+ #define NP_SCRIPT NP_SCRIPT_DIR "/netplug"
+ 
Signature · 1 line
2.8.1
#1 lore raw

PATCH v2 1/1 package/netplug: fix musl build errors

Quoted 30 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Bernd" == Bernd Kuhls <[email protected]> writes:

Fixes
http://autobuild.buildroot.net/results/02c/02c967a211cfb43dcb5119ea57a0cdef96e5880b/

---
v2: - simplified __assert_fail patch by adjusting the data types instead
of removing the function
- improved patch comment (Thomas)

 package/netplug/0002-musl.patch | 44 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 package/netplug/0002-musl.patch
package/netplug/0002-musl.patch new file +9 -0
new file mode 100644
index 0000000..fd86a19
@@ -0,0 +1,44 @@
+Fix musl build
+
+Upstream usage of __assert_fail failed to compile:
+
+ib.c:204:1: error: conflicting types for ?__assert_fail?
+ __assert_fail(const char *assertion, const char *file,
+ ^
+In file included from lib.c:21:0:
+/home/buildroot/buildroot/output/host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/assert.h:19:6: note: previous declaration of ?__assert_fail? was here

package/netplug/0002-musl.patch line 19

Quoted 10 lines
package/netplug/0002-musl.patch new file +10 -0
+ void __assert_fail (const char *, const char *, int, const char *);
+      ^
+
+Change from unsigned int to int according to musl define.
+
+Add time.h to netplug.h to fix compile error due to missing header:
+
+netplug.h:77:5: error: unknown type name ?time_t?
+     time_t      lastchange;     /* timestamp of last state change */
+

I would prefer to see separate patches for the two different issues.

package/netplug/0002-musl.patch line 30

Quoted 11 lines
package/netplug/0002-musl.patch new file +11 -0
+Signed-off-by: Bernd Kuhls <[email protected]>
+
+diff -uNr netplug-1.2.9.2.org/lib.c netplug-1.2.9.2/lib.c
+--- netplug-1.2.9.2.org/lib.c	2008-12-23 00:36:23.000000000 +0100
++++ netplug-1.2.9.2/lib.c	2016-05-29 16:21:13.000000000 +0200
+@@ -202,7 +202,7 @@
+ 
+ void
+ __assert_fail(const char *assertion, const char *file,
+-              unsigned int line, const char *function)
++              int line, const char *function)

Hmm, the spec seems to say unsigned int:

https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA/baselib---assert-fail-1.html

Doesn't this then cause issues with !musl builds?

Signature · 1 line
Bye, Peter Korsgaard