All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/3] packages/exim: fix build failures
@ 2020-02-07 15:14 Luca Ceresoli
  2020-02-07 15:14 ` [Buildroot] [PATCH 1/3] package/exim: fix target build on some toolchains Luca Ceresoli
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Luca Ceresoli @ 2020-02-07 15:14 UTC (permalink / raw)
  To: buildroot

exim is failing on the autobuilders since the version bump to 4.93 (commit
6038c3232acfdb: "package/exim: bump version to 4.93.0.3").

Commit 2c692e81a844b30b ("package/exim: fix host build") fixed one failure
when building the host tools, but we still have a similar ("'for' loop
initial declarations are only allowed in C99 mode") one when cross-building
target files.

In patch 1 I applied a similar fix (add -std=c99), but more failures
started appearing later in the build process.

I have not completely understood the new failures, yet with a couple of
patches it is now building. This is done in patch 2 but I'm not sure it is
a correct solution.

Finally another failure appeared. It is yet another
for-loop-initial-declaration error, but happens later in the install
step. This is fixed in patch 3 adding another -std=c99.

I cannot work on this issue for the next few days, so here are my patches,
as-is, in case anybody wants to have a look before 2020.02.

Luca

Luca Ceresoli (3):
  package/exim: fix target build on some toolchains
  package/exim: fix various build failures
  package/exim: fix build error during install step

 ..._lock-fix-lstat-related-build-errors.patch | 50 +++++++++++++++++++
 .../exim/0006-sieve-fix-build-errors.patch    | 41 +++++++++++++++
 package/exim/exim.mk                          |  7 ++-
 3 files changed, 96 insertions(+), 2 deletions(-)
 create mode 100644 package/exim/0005-exim_lock-fix-lstat-related-build-errors.patch
 create mode 100644 package/exim/0006-sieve-fix-build-errors.patch

-- 
2.25.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/3] package/exim: fix target build on some toolchains
  2020-02-07 15:14 [Buildroot] [PATCH 0/3] packages/exim: fix build failures Luca Ceresoli
@ 2020-02-07 15:14 ` Luca Ceresoli
  2020-02-07 15:14 ` [Buildroot] [PATCH 2/3] package/exim: fix various build failures Luca Ceresoli
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Luca Ceresoli @ 2020-02-07 15:14 UTC (permalink / raw)
  To: buildroot

Building with the Sourcery CodeBench ARM 2014.05 the build fails with this
error:

  >>> exim_dbmbuild utility built

  /home/ceresoli/devel/buildroot/output/host/bin/arm-none-linux-gnueabi-gcc -DEXIM_DUMPDB exim_dbutil.c
  exim_dbutil.c: In function 'main':
  exim_dbutil.c:568:1: error: 'for' loop initial declarations are only allowed in C99 mode
   for (uschar * key = dbfn_scan(dbm, TRUE, &cursor);
   ^
  exim_dbutil.c:568:1: note: use option -std=c99 or -std=gnu99 to compile your code
  exim_dbutil.c:630:2: error: 'for' loop initial declarations are only allowed in C99 mode
    for (int i = 1; i <= wait->count; i++)
    ^
  exim_dbutil.c:642:6: error: 'for' loop initial declarations are only allowed in C99 mode
        for (int j = 0; j < MESSAGE_ID_LENGTH; j++)
        ^

Fix by enforcing C99. This completes commit
2c692e81a844b30b4d3161dfd9897b3265bb9279 ("package/exim: fix host build")
to also fix target builds.

Fixes: http://autobuild.buildroot.net/results/6b7e08090f5f0f2627cc3e89b349c2052b6e3116/

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 package/exim/exim.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/exim/exim.mk b/package/exim/exim.mk
index c07d6f919cb0..0ad9a8de8000 100644
--- a/package/exim/exim.mk
+++ b/package/exim/exim.mk
@@ -127,7 +127,8 @@ define EXIM_BUILD_CMDS
 		LNCC=$(HOSTCC) \
 		CFLAGS="-std=c99 $(HOST_CFLAGS)" \
 		LFLAGS="-fPIC $(HOST_LDFLAGS)"
-	$(TARGET_MAKE_ENV) build=br $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS)
+	$(TARGET_MAKE_ENV) build=br $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS) \
+		CFLAGS="-std=c99 $(TARGET_CFLAGS)"
 endef
 
 # Need to replicate the LFLAGS in install, as exim still wants to build
-- 
2.25.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/3] package/exim: fix various build failures
  2020-02-07 15:14 [Buildroot] [PATCH 0/3] packages/exim: fix build failures Luca Ceresoli
  2020-02-07 15:14 ` [Buildroot] [PATCH 1/3] package/exim: fix target build on some toolchains Luca Ceresoli
@ 2020-02-07 15:14 ` Luca Ceresoli
  2020-02-07 15:14 ` [Buildroot] [PATCH 3/3] package/exim: fix build error during install step Luca Ceresoli
  2020-02-08  8:02 ` [Buildroot] [PATCH 0/3] packages/exim: fix build failures Peter Korsgaard
  3 siblings, 0 replies; 7+ messages in thread
From: Luca Ceresoli @ 2020-02-07 15:14 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 ..._lock-fix-lstat-related-build-errors.patch | 50 +++++++++++++++++++
 .../exim/0006-sieve-fix-build-errors.patch    | 41 +++++++++++++++
 2 files changed, 91 insertions(+)
 create mode 100644 package/exim/0005-exim_lock-fix-lstat-related-build-errors.patch
 create mode 100644 package/exim/0006-sieve-fix-build-errors.patch

diff --git a/package/exim/0005-exim_lock-fix-lstat-related-build-errors.patch b/package/exim/0005-exim_lock-fix-lstat-related-build-errors.patch
new file mode 100644
index 000000000000..9da97b6720a1
--- /dev/null
+++ b/package/exim/0005-exim_lock-fix-lstat-related-build-errors.patch
@@ -0,0 +1,50 @@
+From bbcf4320134efd8a01ce5a02bb9af62019ca05f6 Mon Sep 17 00:00:00 2001
+From: Luca Ceresoli <luca@lucaceresoli.net>
+Date: Tue, 4 Feb 2020 15:57:48 +0100
+Subject: [PATCH] exim_lock: fix lstat-related build errors
+
+exim_lock fails to cross-compile with the Sourcery CodeBench ARM 2014.05
+toolchain due the a missing include of sys/types.h, needed for the
+constants used by fstat() and lstat().
+
+Discovered when cross-compiling with the Buildroot embedded Linux
+buildsystem.
+
+Fixes:
+
+  exim_lock.c:427:30: error: 'S_IFMT' undeclared (first use in this function)
+         if ((statbuf.st_mode & S_IFMT) == S_IFLNK)
+                                ^
+  exim_lock.c:427:30: note: each undeclared identifier is reported only once for each function it appears in
+  exim_lock.c:427:41: error: 'S_IFLNK' undeclared (first use in this function)
+         if ((statbuf.st_mode & S_IFMT) == S_IFLNK)
+                                           ^
+
+Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
+---
+ src/exim_lock.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/exim_lock.c b/src/exim_lock.c
+index 068216816054..cb140aff6436 100644
+--- a/src/exim_lock.c
++++ b/src/exim_lock.c
+@@ -13,6 +13,8 @@ Argument: the name of the lock file
+ Copyright (c) The Exim Maintainers 2016
+ */
+
++#define _XOPEN_SOURCE
++
+ #include "os.h"
+
+ #include <stdio.h>
+@@ -26,6 +28,7 @@ Copyright (c) The Exim Maintainers 2016
+ #include <unistd.h>
+ #include <utime.h>
+ #include <sys/utsname.h>
++#include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/file.h>
+ #include <pwd.h>
+--
+2.25.0
diff --git a/package/exim/0006-sieve-fix-build-errors.patch b/package/exim/0006-sieve-fix-build-errors.patch
new file mode 100644
index 000000000000..147dc2ff9b22
--- /dev/null
+++ b/package/exim/0006-sieve-fix-build-errors.patch
@@ -0,0 +1,41 @@
+From e9d0b5b022df172d3615e9e2875506c74e6d7cd1 Mon Sep 17 00:00:00 2001
+From: Luca Ceresoli <luca@lucaceresoli.net>
+Date: Wed, 5 Feb 2020 17:13:57 +0100
+Subject: [PATCH] sieve: fix build errors
+
+sieve fails to cross-compile with the Sourcery CodeBench ARM 2014.05
+toolchain with a huge number of errors, including:
+
+  .../sysroot/usr/include/arpa/nameser.h:115:2: error: unknown type name 'u_char'
+    const u_char *_msg, *_eom;
+    ^
+  .../sysroot/usr/include/arpa/nameser.h:474:1: error: unknown type name 'u_long'
+   u_long  ns_get32 (const u_char *) __THROW;
+   ^
+  .../sysroot/usr/include/arpa/nameser.h:475:31: error: expected ')' before '*' token
+   void  ns_put16 (u_int, u_char *) __THROW;
+                                 ^
+
+Discovered when cross-compiling with the Buildroot embedded Linux
+buildsystem.
+
+Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
+---
+ src/sieve.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/sieve.c b/src/sieve.c
+index 5e8d1e6f4776..9632f2d43810 100644
+--- a/src/sieve.c
++++ b/src/sieve.c
+@@ -12,6 +12,8 @@
+
+ /* Sieve mail filter. */
+
++#define _BSD_SOURCE
++
+ #include <ctype.h>
+ #include <errno.h>
+ #include <limits.h>
+--
+2.25.0
-- 
2.25.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 3/3] package/exim: fix build error during install step
  2020-02-07 15:14 [Buildroot] [PATCH 0/3] packages/exim: fix build failures Luca Ceresoli
  2020-02-07 15:14 ` [Buildroot] [PATCH 1/3] package/exim: fix target build on some toolchains Luca Ceresoli
  2020-02-07 15:14 ` [Buildroot] [PATCH 2/3] package/exim: fix various build failures Luca Ceresoli
@ 2020-02-07 15:14 ` Luca Ceresoli
  2020-02-08  8:02 ` [Buildroot] [PATCH 0/3] packages/exim: fix build failures Peter Korsgaard
  3 siblings, 0 replies; 7+ messages in thread
From: Luca Ceresoli @ 2020-02-07 15:14 UTC (permalink / raw)
  To: buildroot

exim builds some files during the 'make install' step, and these fail with
an error:

  lookups/lf_quote.c:49:3: error: 'for' loop initial declarations are only allowed in C99 mode
     for (int j = 0; j < vlength; j++)
     ^

Fix by passing the -std=c99 here, as it is already passed in the build
step.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 package/exim/exim.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/exim/exim.mk b/package/exim/exim.mk
index 0ad9a8de8000..e4b0bfc1b488 100644
--- a/package/exim/exim.mk
+++ b/package/exim/exim.mk
@@ -135,7 +135,9 @@ endef
 # something when installing...
 define EXIM_INSTALL_TARGET_CMDS
 	DESTDIR=$(TARGET_DIR) INSTALL_ARG="-no_chown -no_symlink" build=br \
-	  $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS) install
+	  $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS) \
+		CFLAGS="-std=c99 $(TARGET_CFLAGS)" \
+		install
 	chmod u+s $(TARGET_DIR)/usr/sbin/exim
 endef
 
-- 
2.25.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 0/3] packages/exim: fix build failures
  2020-02-07 15:14 [Buildroot] [PATCH 0/3] packages/exim: fix build failures Luca Ceresoli
                   ` (2 preceding siblings ...)
  2020-02-07 15:14 ` [Buildroot] [PATCH 3/3] package/exim: fix build error during install step Luca Ceresoli
@ 2020-02-08  8:02 ` Peter Korsgaard
  2020-02-10  9:01   ` Luca Ceresoli
  3 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2020-02-08  8:02 UTC (permalink / raw)
  To: buildroot

>>>>> "Luca" == Luca Ceresoli <luca@lucaceresoli.net> writes:

 > exim is failing on the autobuilders since the version bump to 4.93 (commit
 > 6038c3232acfdb: "package/exim: bump version to 4.93.0.3").

 > Commit 2c692e81a844b30b ("package/exim: fix host build") fixed one failure
 > when building the host tools, but we still have a similar ("'for' loop
 > initial declarations are only allowed in C99 mode") one when cross-building
 > target files.

 > In patch 1 I applied a similar fix (add -std=c99), but more failures
 > started appearing later in the build process.

 > I have not completely understood the new failures, yet with a couple of
 > patches it is now building. This is done in patch 2 but I'm not sure it is
 > a correct solution.

 > Finally another failure appeared. It is yet another
 > for-loop-initial-declaration error, but happens later in the install
 > step. This is fixed in patch 3 adding another -std=c99.

 > I cannot work on this issue for the next few days, so here are my patches,
 > as-is, in case anybody wants to have a look before 2020.02.

Thanks, the patches looks sensible to me. Did you submit them upstream?
We normally add a link to that in the patches.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 0/3] packages/exim: fix build failures
  2020-02-08  8:02 ` [Buildroot] [PATCH 0/3] packages/exim: fix build failures Peter Korsgaard
@ 2020-02-10  9:01   ` Luca Ceresoli
  2020-02-10  9:50     ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Luca Ceresoli @ 2020-02-10  9:01 UTC (permalink / raw)
  To: buildroot

Hi Peter,

On 08/02/20 09:02, Peter Korsgaard wrote:
>>>>>> "Luca" == Luca Ceresoli <luca@lucaceresoli.net> writes:
> 
>  > exim is failing on the autobuilders since the version bump to 4.93 (commit
>  > 6038c3232acfdb: "package/exim: bump version to 4.93.0.3").
> 
>  > Commit 2c692e81a844b30b ("package/exim: fix host build") fixed one failure
>  > when building the host tools, but we still have a similar ("'for' loop
>  > initial declarations are only allowed in C99 mode") one when cross-building
>  > target files.
> 
>  > In patch 1 I applied a similar fix (add -std=c99), but more failures
>  > started appearing later in the build process.
> 
>  > I have not completely understood the new failures, yet with a couple of
>  > patches it is now building. This is done in patch 2 but I'm not sure it is
>  > a correct solution.
> 
>  > Finally another failure appeared. It is yet another
>  > for-loop-initial-declaration error, but happens later in the install
>  > step. This is fixed in patch 3 adding another -std=c99.
> 
>  > I cannot work on this issue for the next few days, so here are my patches,
>  > as-is, in case anybody wants to have a look before 2020.02.
> 
> Thanks, the patches looks sensible to me. Did you submit them upstream?
> We normally add a link to that in the patches.

I still haven't sent them to upstream because I thought there could be a
better fix. I plan to send them within a few days after having another
look into it. After that I'm also sending v2 here with the
"Upstream-status" added.

-- 
Luca

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 0/3] packages/exim: fix build failures
  2020-02-10  9:01   ` Luca Ceresoli
@ 2020-02-10  9:50     ` Peter Korsgaard
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2020-02-10  9:50 UTC (permalink / raw)
  To: buildroot

>>>>> "Luca" == Luca Ceresoli <luca@lucaceresoli.net> writes:

Hi,

 >> Thanks, the patches looks sensible to me. Did you submit them upstream?
 >> We normally add a link to that in the patches.

 > I still haven't sent them to upstream because I thought there could be a
 > better fix. I plan to send them within a few days after having another
 > look into it. After that I'm also sending v2 here with the
 > "Upstream-status" added.

Ok, great - Thanks!

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-02-10  9:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07 15:14 [Buildroot] [PATCH 0/3] packages/exim: fix build failures Luca Ceresoli
2020-02-07 15:14 ` [Buildroot] [PATCH 1/3] package/exim: fix target build on some toolchains Luca Ceresoli
2020-02-07 15:14 ` [Buildroot] [PATCH 2/3] package/exim: fix various build failures Luca Ceresoli
2020-02-07 15:14 ` [Buildroot] [PATCH 3/3] package/exim: fix build error during install step Luca Ceresoli
2020-02-08  8:02 ` [Buildroot] [PATCH 0/3] packages/exim: fix build failures Peter Korsgaard
2020-02-10  9:01   ` Luca Ceresoli
2020-02-10  9:50     ` Peter Korsgaard

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.