Skip to contentSkip to conversation

packages/exim: fix build failures

PATCH New Luca Ceresoli 2 participants 7 messages Feb 10, 2020 – Feb 11, 2020

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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_dbmbuild utility 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
index c07d6f919cb0..0ad9a8de8000 100644
@@ -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
#2 lore raw

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_dbmbuild utility 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.

Quoted 8 lines

---

Changes since v1: none.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

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
new file mode 100644
index 000000000000..a0a279fc43f5
@@ -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
#5 lore raw

PATCH v2 3/3 package/exim: fix build error during install step

In reply to Luca Ceresoli

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.

---
Changes since v1: none.

---
 package/exim/exim.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
package/exim/exim.mk +3 -1
index 0ad9a8de8000..e4b0bfc1b488 100644
@@ -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
#6 lore raw

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 mode

     for (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.

---
Changes since v1: none.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard