packages/exim: fix build failures
v2 cover packages/exim: fix build failures
[changes since v1: added upstream status to patches]
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) for taget files.
Now new failures started appearing later in the build process. Patch 2 adds two patches to fix them. They have been sent to mainline exim:
https://bugs.exim.org/show_bug.cgi?id=2523
With that fixes, 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.
Now exim builds again... at least with the Sourcery CodeBench ARM 2014.05 toolchain.
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 | 51 +++++++++++++++++++ .../exim/0006-sieve-fix-build-errors.patch | 42 +++++++++++++++ package/exim/exim.mk | 7 ++- 3 files changed, 98 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
Signature · 1 line
2.25.0
PATCH v2 1/3 package/exim: fix target build on some toolchains
Building with the Sourcery CodeBench ARM 2014.05 the build fails with this error:
Quoted 1 line
Quoted 1 line
Quoted 1 line
exim_dbmbuildutility built
.../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.
---
Changes since v1: none.
--- package/exim/exim.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
package/exim/exim.mk +2 -1
@@ -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
Signature · 1 line
2.25.0
PATCH v2 1/3 package/exim: fix target build on some toolchains
Quoted 24 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Luca" == Luca Ceresoli <[email protected]> writes:
Building with the Sourcery CodeBench ARM 2014.05 the build fails with this error:
Quoted 1 line
Quoted 1 line
Quoted 1 line
exim_dbmbuildutility built.../buildroot/output/host/bin/arm-none-linux-gnueabi-gcc -DEXIM_DUMPDB
exim_dbutil.cexim_dbutil.c: In function 'main':
exim_dbutil.c:568:1: error: 'for' loop initial declarations are only allowed in C99 modefor (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.
Quoted 8 lines
Signed-off-by Luca Ceresoli <[email protected]>Cc Bernd Kuhls <[email protected]>---
Changes since v1: none.
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH v2 2/3 package/exim: fix various build failures
In reply to Luca Ceresoli---
Changes since v1:
- added Upstream-status to patches
--- ..._lock-fix-lstat-related-build-errors.patch | 51 +++++++++++++++++++ .../exim/0006-sieve-fix-build-errors.patch | 42 +++++++++++++++ 2 files changed, 93 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
package/exim/0005-exim_lock-fix-lstat-related-build-errors.patch new file +51 -0
@@ -0,0 +1,51 @@ +From bbcf4320134efd8a01ce5a02bb9af62019ca05f6 Mon Sep 17 00:00:00 2001 +From: Luca Ceresoli <[email protected]> +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 <[email protected]> +Upstream-status: https://bugs.exim.org/show_bug.cgi?id=2523 +--- + 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
package/exim/0006-sieve-fix-build-errors.patch new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.25.0
PATCH v2 2/3 package/exim: fix various build failures
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Luca" == Luca Ceresoli <[email protected]> writes:
Signed-off-by Luca Ceresoli <[email protected]>Cc Bernd Kuhls <[email protected]>---
Changes since v1:
- added Upstream-status to patches
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH v2 3/3 package/exim: fix build error during install step
In reply to Luca Ceresoliexim 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.
---
Changes since v1: none.
--- package/exim/exim.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
package/exim/exim.mk +3 -1
@@ -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
Signature · 1 line
2.25.0
PATCH v2 3/3 package/exim: fix build error during install step
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Luca" == Luca Ceresoli <[email protected]> writes:
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 modefor (int j = 0; j < vlength; j++) ^
Quoted 8 lines
Fix by passing the -std=c99 here, as it is already passed in the build step.
Signed-off-by Luca Ceresoli <[email protected]>Cc Bernd Kuhls <[email protected]>---
Changes since v1: none.
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard