Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca@lucaceresoli.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2] package/exim: Fix compilation error with musl
Date: Thu, 02 Jul 2015 18:09:28 +0200	[thread overview]
Message-ID: <55956238.8040902@lucaceresoli.net> (raw)
In-Reply-To: <1428848507-2117-2-git-send-email-bernd.kuhls@t-online.de>

Dear Bernd,

Bernd Kuhls wrote:
> Fixes
> smtp_in.c: In function ?smtp_start_session?:
> smtp_in.c:1976:36: error: invalid application of ?sizeof? to incomplete type ?struct options?
>       EXIM_SOCKLEN_T optlen = sizeof(struct ip_options) + MAX_IPOPTLEN;
>
> smtp_in.c misdetects the needed style for ip_options, only OPTSTYLE == 2 works.
> Since musl does not provide any macro[1] to detect it we need to pretend to be
> darwin in order to fix the compile bug.
>
> In order to do so we need the generated os.h before building start, therefore
> add some make subtargets to the configure step.
>

I confirm the bug, but I would prefer a slightly cleaner fix, see below.

> [1] http://wiki.musl-libc.org/wiki/FAQ#Q:_why_is_there_no_MUSL_macro_.3F
>
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
> ---
>   package/exim/exim.mk |   10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/package/exim/exim.mk b/package/exim/exim.mk
> index fcf2be5..d7c61db 100644
> --- a/package/exim/exim.mk
> +++ b/package/exim/exim.mk
> @@ -89,6 +89,13 @@ define EXIM_REMOVE_LIBNSL_FROM_MAKEFILE
>   endef
>   endif
>
> +ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
> +define EXIM_PRETEND_TO_BE_DARWIN_TO_FIX_IP_OPTIONS
> +	echo "#undef GLIBC_IP_OPTIONS" >> $(@D)/build-br/os.h
> +	echo "#define DARWIN_IP_OPTIONS" >> $(@D)/build-br/os.h

I'd rename to EXIM_TWEAK_IP_OPTIONS or similar, and use sed instead of
the two echos, but it's a matter of taste:

   $(SED) 's/#define GLIBC_IP_OPTIONS/#define DARWIN_IP_OPTIONS/' \
          $(@D)/OS/os.h-Linux

> +endef
> +endif
> +
>   define EXIM_CONFIGURE_TOOLCHAIN
>   	$(call exim-config-add,CC,$(TARGET_CC))
>   	$(call exim-config-add,CFLAGS,$(TARGET_CFLAGS))
> @@ -97,6 +104,9 @@ define EXIM_CONFIGURE_TOOLCHAIN
>   	$(call exim-config-add,HOSTCC,$(HOSTCC))
>   	$(call exim-config-add,HOSTCFLAGS,$(HOSTCFLAGS))
>   	$(EXIM_REMOVE_LIBNSL_FROM_MAKEFILE)
> +	$(TARGET_MAKE_ENV) build=br $(MAKE1) -C $(@D) configure
> +	$(TARGET_MAKE_ENV) build=br $(MAKE1) -C $(@D)/build-br config
> +	$(EXIM_PRETEND_TO_BE_DARWIN_TO_FIX_IP_OPTIONS)

Just patch $(@D)/OS/os.h-Linux, and you can remove the two $(MAKE1)
invocations.

-- 
Luca

  reply	other threads:[~2015-07-02 16:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-12 14:21 [Buildroot] [PATCH 1/2] package/exim: Adjust libnsl detection to include musl Bernd Kuhls
2015-04-12 14:21 ` [Buildroot] [PATCH 2/2] package/exim: Fix compilation error with musl Bernd Kuhls
2015-07-02 16:09   ` Luca Ceresoli [this message]
2015-04-12 16:54 ` [Buildroot] [PATCH 1/2] package/exim: Adjust libnsl detection to include musl Thomas Petazzoni
2015-06-30 17:45   ` Bernd Kuhls
2015-06-30 21:08 ` 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=55956238.8040902@lucaceresoli.net \
    --to=luca@lucaceresoli.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox