* [Buildroot] [PATCH 1/2] package/exim: Adjust libnsl detection to include musl
@ 2015-04-12 14:21 Bernd Kuhls
2015-04-12 14:21 ` [Buildroot] [PATCH 2/2] package/exim: Fix compilation error with musl Bernd Kuhls
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Bernd Kuhls @ 2015-04-12 14:21 UTC (permalink / raw)
To: buildroot
Only (e)glibc provides libnsl, uclibc provides only a stub
Fixes compilation using this defconfig
BR2_arm=y
BR2_cortex_a7=y
BR2_STATIC_LIBS=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_PACKAGE_OPENSSL=y
BR2_PACKAGE_EXIM=y
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
package/exim/exim.mk | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/package/exim/exim.mk b/package/exim/exim.mk
index 0a70c42..fcf2be5 100644
--- a/package/exim/exim.mk
+++ b/package/exim/exim.mk
@@ -81,8 +81,9 @@ define EXIM_USE_DEFAULT_CONFIG_FILE_OPENSSL
endef
endif
-# this specific toolchain lacks libnsl
-ifeq ($(BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_2014_12),y)
+# only (e)glibc provides libnsl, remove -lnsl for all other toolchains
+# http://bugs.exim.org/show_bug.cgi?id=1564
+ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),)
define EXIM_REMOVE_LIBNSL_FROM_MAKEFILE
$(SED) 's/-lnsl//g' $(@D)/OS/Makefile-Linux
endef
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 2/2] package/exim: Fix compilation error with musl
2015-04-12 14:21 [Buildroot] [PATCH 1/2] package/exim: Adjust libnsl detection to include musl Bernd Kuhls
@ 2015-04-12 14:21 ` Bernd Kuhls
2015-07-02 16:09 ` Luca Ceresoli
2015-04-12 16:54 ` [Buildroot] [PATCH 1/2] package/exim: Adjust libnsl detection to include musl Thomas Petazzoni
2015-06-30 21:08 ` Thomas Petazzoni
2 siblings, 1 reply; 6+ messages in thread
From: Bernd Kuhls @ 2015-04-12 14:21 UTC (permalink / raw)
To: buildroot
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.
[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
+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)
endef
ifneq ($(call qstrip,$(BR2_PACKAGE_EXIM_CUSTOM_CONFIG_FILE)),)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/2] package/exim: Adjust libnsl detection to include musl
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-04-12 16:54 ` Thomas Petazzoni
2015-06-30 17:45 ` Bernd Kuhls
2015-06-30 21:08 ` Thomas Petazzoni
2 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2015-04-12 16:54 UTC (permalink / raw)
To: buildroot
Dear Bernd Kuhls,
On Sun, 12 Apr 2015 16:21:46 +0200, Bernd Kuhls wrote:
> Only (e)glibc provides libnsl, uclibc provides only a stub
True, but uClibc provides the functionality, no? Or is the stub
actually not working at runtime? Could you be a bit more specific here?
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/2] package/exim: Adjust libnsl detection to include musl
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
0 siblings, 0 replies; 6+ messages in thread
From: Bernd Kuhls @ 2015-06-30 17:45 UTC (permalink / raw)
To: buildroot
Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
@public.gmane.org> wrote in news:20150412185443.08512d17 at free-electrons.com:
> Dear Bernd Kuhls,
>
> On Sun, 12 Apr 2015 16:21:46 +0200, Bernd Kuhls wrote:
>> Only (e)glibc provides libnsl, uclibc provides only a stub
>
> True, but uClibc provides the functionality, no? Or is the stub
> actually not working at runtime? Could you be a bit more specific here?
Hi,
http://git.uclibc.org/uClibc/tree/libnsl/nsl.c
Uclibc provides only stub code, libnsl has no functionality there ;)
Regards, Bernd
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/2] package/exim: Adjust libnsl detection to include musl
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-04-12 16:54 ` [Buildroot] [PATCH 1/2] package/exim: Adjust libnsl detection to include musl Thomas Petazzoni
@ 2015-06-30 21:08 ` Thomas Petazzoni
2 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2015-06-30 21:08 UTC (permalink / raw)
To: buildroot
Dear Bernd Kuhls,
On Sun, 12 Apr 2015 16:21:46 +0200, Bernd Kuhls wrote:
> Only (e)glibc provides libnsl, uclibc provides only a stub
>
> Fixes compilation using this defconfig
>
> BR2_arm=y
> BR2_cortex_a7=y
> BR2_STATIC_LIBS=y
> BR2_TOOLCHAIN_EXTERNAL=y
> BR2_PACKAGE_OPENSSL=y
> BR2_PACKAGE_EXIM=y
>
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
> ---
> package/exim/exim.mk | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Applied after rebasing on master, thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 2/2] package/exim: Fix compilation error with musl
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
0 siblings, 0 replies; 6+ messages in thread
From: Luca Ceresoli @ 2015-07-02 16:09 UTC (permalink / raw)
To: buildroot
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-07-02 16:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox