Skip to contentSkip to conversation

package/bind: fix build with old host GCC since autoconf bump

PATCH In review Thomas Petazzoni via buildroot 1 participant 2 messages Aug 26 – Aug 27

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/bind: fix build with old host GCC since autoconf bump

Since the bump of autoconf to version 2.73 in Buildroot commit, the build of target bind fails if the host compiler is too old, because the bind build system tries to use -std=gnu23 when building host tools which isn't supported by older GCC releases, causing:

checking whether the C compiler works... no
configure: error: in '/home/thomas/autobuild/instance-2/output-1/build/bind-9.20.26':
configure: error: C compiler cannot create executables
See 'config.log' for more details
make: *** [package/pkg-generic.mk:263: /home/thomas/autobuild/instance-2/output-1/build/bind-9.20.26/.stamp_configured] Error 77

To fix this, we backport a number of patches from autoconf-archive, to fix the m4/ax_prog_cc_for_build.m4 macro file, so that it works with autoconf 2.73.

OpenEmbedded has a similar fix:
https://git.openembedded.org/openembedded-core/tree/meta/recipes-connectivity/bind/bind/0001-m4-Backport-ax_prog_cc_for_build.m4-macros.patch
but did not backport as carefully the autoconf-archive commits (and their commit message reverts to sudo).

The patches can be dropped when we update to a newer version of bind that itself has an updated copy of the m4/ax_prog_cc_for_build.m4 file.

Fixes:

https://autobuild.buildroot.net/results/13e07755101b7cae2f84eef173ef752f92842e71/

---
 ...uild-Properly-restore-ac_cv_c_compil.patch |  41 ++++++
 .../0002-Fix-typos-found-by-codespell.patch   |  38 +++++
 ...uild-Fix-BUILD_-EXE-OBJ-EXT-for-Auto.patch | 131 ++++++++++++++++++
 ...uild-Tweak-ac_cv_c_compiler_gnu-code.patch |  93 +++++++++++++
 ...uild-Fix-ac_cv_prog_cc_c-99-11-regre.patch |  57 ++++++++
 ...uild-Support-ac_-cv_-build_prog_cc_s.patch |  62 +++++++++
 6 files changed, 422 insertions(+)
 create mode 100644 package/bind/0001-ax_prog_cc_for_build-Properly-restore-ac_cv_c_compil.patch
 create mode 100644 package/bind/0002-Fix-typos-found-by-codespell.patch
 create mode 100644 package/bind/0003-ax_prog_cc_for_build-Fix-BUILD_-EXE-OBJ-EXT-for-Auto.patch
 create mode 100644 package/bind/0004-ax_prog_cc_for_build-Tweak-ac_cv_c_compiler_gnu-code.patch
 create mode 100644 package/bind/0005-ax_prog_cc_for_build-Fix-ac_cv_prog_cc_c-99-11-regre.patch
 create mode 100644 package/bind/0006-ax_prog_cc_for_build-Support-ac_-cv_-build_prog_cc_s.patch
package/bind/0001-ax_prog_cc_for_build-Properly-restore-ac_cv_c_compil.patch new file +41 -0
new file mode 100644
index 0000000000..23560a002e
@@ -0,0 +1,41 @@
+From 2755b093cd69fb980ecb22d905cc6658c895d44a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ondr=CC=8Cej=20Sury=CC=81?= <[email protected]>
+Date: Tue, 26 Apr 2022 15:24:18 +0200
+Subject: [PATCH] ax_prog_cc_for_build: Properly restore ac_cv_c_compiler_gnu
+
+The ac_cv_c_compiler_gnu wasn't properly restored to original
+state (f.e. yes), but value of the "save" variable was used:
+
+ac_cv_c_compiler_gnu=${ac_cv_c_compiler_gnu=saved_ac_cv_c_compiler_gnu}
+
+Additionally, we don't need to cache the saved_ac_cv_c_compiler_gnu
+and was_set_ac_cv_c_compiler_gnu, so remove the ac_cv_ from their names.
+
+This would not manifest on a single run, but any repeated run with cache
+file (./configure -C) would be broken.
+
+Upstream: https://github.com/autoconf-archive/autoconf-archive/commit/13018ae91007cfa1b1a3877db8ef5cb233af1ae6
+[Thomas: partial backport only. Most of the commit is already in bind,
+except the serial number update, which is needed for follow-up commits
+to apply cleanly]
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ m4/ax_prog_cc_for_build.m4 | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/m4/ax_prog_cc_for_build.m4 b/m4/ax_prog_cc_for_build.m4
+index f6518db..1db8d73 100644
+--- a/m4/ax_prog_cc_for_build.m4
++++ b/m4/ax_prog_cc_for_build.m4
+@@ -32,7 +32,7 @@
+ #   and this notice are preserved. This file is offered as-is, without any
+ #   warranty.
+ 
+-#serial 20
++#serial 21
+ 
+ AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
+ AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
+-- 
+2.55.0
+
package/bind/0002-Fix-typos-found-by-codespell.patch new file +38 -0
new file mode 100644
index 0000000000..1cbb5eac29
@@ -0,0 +1,38 @@
+From ce23f1b3db8be19ca74589958a9af56c3ee888d0 Mon Sep 17 00:00:00 2001
+From: Dimitri Papadopoulos
+ <[email protected]>
+Date: Mon, 25 Dec 2023 13:04:00 +0100
+Subject: [PATCH] Fix typos found by codespell
+
+Upstream: https://github.com/autoconf-archive/autoconf-archive/commit/7d383b7aea765a8bc557ec6e88461c6da2db034e
+[Thomas: partial backport, only changes to ax_prog_cc_for_build.m4 were kept]
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ m4/ax_prog_cc_for_build.m4 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/m4/ax_prog_cc_for_build.m4 b/m4/ax_prog_cc_for_build.m4
+index 1db8d73..2f44436 100644
+--- a/m4/ax_prog_cc_for_build.m4
++++ b/m4/ax_prog_cc_for_build.m4
+@@ -32,7 +32,7 @@
+ #   and this notice are preserved. This file is offered as-is, without any
+ #   warranty.
+ 
+-#serial 21
++#serial 22
+ 
+ AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
+ AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
+@@ -141,7 +141,7 @@ popdef([ac_cv_prog_gcc])dnl
+ popdef([ac_cv_prog_CPP])dnl
+ 
+ dnl restore global variables ac_ext, ac_cpp, ac_compile,
+-dnl ac_link, ac_compiler_gnu (dependant on the current
++dnl ac_link, ac_compiler_gnu (dependent on the current
+ dnl language after popping):
+ AC_LANG_POP([C])
+ 
+-- 
+2.55.0
+
package/bind/0003-ax_prog_cc_for_build-Fix-BUILD_-EXE-OBJ-EXT-for-Auto.patch new file +131 -0

131 lines not on this page · raw message

package/bind/0004-ax_prog_cc_for_build-Tweak-ac_cv_c_compiler_gnu-code.patch new file +93 -0

93 lines not on this page · raw message

package/bind/0005-ax_prog_cc_for_build-Fix-ac_cv_prog_cc_c-99-11-regre.patch new file +57 -0

57 lines not on this page · raw message

package/bind/0006-ax_prog_cc_for_build-Support-ac_-cv_-build_prog_cc_s.patch new file +62 -0

62 lines not on this page · raw message

Signature · 6 lines
2.55.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 24 lines · Thomas Petazzoni via buildroot

Since the bump of autoconf to version 2.73 in Buildroot commit, the build of target bind fails if the host compiler is too old, because the bind build system tries to use -std=gnu23 when building host tools which isn't supported by older GCC releases, causing:

checking whether the C compiler works... no
configure: error: in '/home/thomas/autobuild/instance-2/output-1/build/bind-9.20.26':
configure: error: C compiler cannot create executables
See 'config.log' for more details
make: *** [package/pkg-generic.mk:263: /home/thomas/autobuild/instance-2/output-1/build/bind-9.20.26/.stamp_configured] Error 77

To fix this, we backport a number of patches from autoconf-archive, to fix the m4/ax_prog_cc_for_build.m4 macro file, so that it works with autoconf 2.73.

OpenEmbedded has a similar fix:
https://git.openembedded.org/openembedded-core/tree/meta/recipes-connectivity/bind/bind/0001-m4-Backport-ax_prog_cc_for_build.m4-macros.patch
but did not backport as carefully the autoconf-archive commits (and their commit message reverts to sudo).

The patches can be dropped when we update to a newer version of bind that itself has an updated copy of the m4/ax_prog_cc_for_build.m4 file.

Quoted 6 lines

Fixes:

https://autobuild.buildroot.net/results/13e07755101b7cae2f84eef173ef752f92842e71/

Applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot