All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] netplug: add two patches to fix musl build issues
Date: Mon, 8 Aug 2016 19:59:34 +0200	[thread overview]
Message-ID: <20160808175934.GA32406@free.fr> (raw)
In-Reply-To: <1470430356-29349-1-git-send-email-thomas.petazzoni@free-electrons.com>

Thomas, All,

On 2016-08-05 22:52 +0200, Thomas Petazzoni spake thusly:
> This commit adds two patches to netplug that are needed for this package
> to build with musl:
> 
>  - One patch to add a missing header inclusion
>  - One patch to fix a conflicting prototype on __assert_fail().
> 
> Fixes:
> 
>   http://autobuild.buildroot.net/results/c2a5dfedba46cc8eb3d0c5c43f1f76fe0bb1805f/
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by:  "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  .../netplug/0002-add-missing-time-include.patch    | 20 +++++++++
>  package/netplug/0003-remove-assert-fail.patch      | 51 ++++++++++++++++++++++
>  2 files changed, 71 insertions(+)
>  create mode 100644 package/netplug/0002-add-missing-time-include.patch
>  create mode 100644 package/netplug/0003-remove-assert-fail.patch
> 
> diff --git a/package/netplug/0002-add-missing-time-include.patch b/package/netplug/0002-add-missing-time-include.patch
> new file mode 100644
> index 0000000..f204c92
> --- /dev/null
> +++ b/package/netplug/0002-add-missing-time-include.patch
> @@ -0,0 +1,20 @@
> +Add missing <time.h> include
> +
> +netplug.h uses time_t, so it must include <time.h>. This fixes a build
> +issue with the musl C library.
> +
> +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> +
> +Index: b/netplug.h
> +===================================================================
> +--- a/netplug.h
> ++++ b/netplug.h
> +@@ -20,7 +20,7 @@
> + #ifndef __netplug_h
> + #define __netplug_h
> + 
> +-
> ++#include <time.h>
> + #include <asm/types.h>
> + #include <sys/socket.h>
> + #include <linux/netlink.h>
> diff --git a/package/netplug/0003-remove-assert-fail.patch b/package/netplug/0003-remove-assert-fail.patch
> new file mode 100644
> index 0000000..635c462
> --- /dev/null
> +++ b/package/netplug/0003-remove-assert-fail.patch
> @@ -0,0 +1,51 @@
> +Remove __assert_fail()
> +
> +The netplug code uses the assert() macro in various places. In glibc
> +internally, assert() uses a function called __assert_fail() to print a
> +message and abort. Relying on internal glibc details, netplug
> +re-defines __assert_fail() in the hope that it will get called instead
> +of glibc internal version.
> +
> +This attempt:
> +
> + * Doesn't work with uClibc, which doesn't use any __assert_fail()
> +   function at all. It doesn't fail to build, but it is entirely
> +   useless.
> +
> + * Fails to build with musl, which also defines __assert_fail(), but
> +   with a different prototype.
> +
> +We simply remove the __assert_fail() implementation, so that the C
> +library implementation of assert() just does its normal work. The only
> +functionality lost is that the message is displayed on the standard
> +output rather than in netplug's logs (and this was only working with
> +glibc anyway).
> +
> +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> +
> +Index: b/lib.c
> +===================================================================
> +--- a/lib.c
> ++++ b/lib.c
> +@@ -199,21 +199,6 @@
> +     return x;
> + }
> + 
> +-
> +-void
> +-__assert_fail(const char *assertion, const char *file,
> +-              unsigned int line, const char *function)
> +-{
> +-    do_log(LOG_CRIT, "%s:%u: %s%sAssertion `%s' failed",
> +-           file, line,
> +-           function ? function : "",
> +-           function ? ": " : "",
> +-           assertion);
> +-
> +-    abort();
> +-}
> +-
> +-
> + /*
> +  * Local variables:
> +  * c-file-style: "stroustrup"
> -- 
> 2.7.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2016-08-08 17:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 20:52 [Buildroot] [PATCH] netplug: add two patches to fix musl build issues Thomas Petazzoni
2016-08-08 17:59 ` Yann E. MORIN [this message]
2016-08-08 21:48 ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160808175934.GA32406@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.