diff mbox series

[1/1] package/ntpsec: fix build on xtensa

Message ID 20240727094029.2609733-1-dario.binacchi@amarulasolutions.com
State Changes Requested
Headers show
Series [1/1] package/ntpsec: fix build on xtensa | expand

Commit Message

Dario Binacchi July 27, 2024, 9:40 a.m. UTC
Fix the following build failure on xtensa:

Waf: Entering directory `/home/buildroot/instance-0/output-1/build/ntpsec-1.2.3/build/host'
[1/2] Processing ntpd/ntp_parser.y
[2/2] Compiling build/host/ntpd/ntp_parser.tab.c
gcc: error: unrecognized command-line option '-mlongcalls'
gcc: error: unrecognized command-line option '-mauto-litpools'

The 'longcalls' and 'auto-litpools' options are added to CFLAGS for
xtensa in package/Makefile.in, but as highlighted by the error message,
in this case, the options need to be removed.

Fixes:
 - http://autobuild.buildroot.org/results/9321a637f2c340ce8dcb24249676bb6c44d0dfc6

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 package/ntpsec/ntpsec.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni July 27, 2024, 2:13 p.m. UTC | #1
Hello Dario,

On Sat, 27 Jul 2024 11:40:29 +0200
Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:

> Fix the following build failure on xtensa:
> 
> Waf: Entering directory `/home/buildroot/instance-0/output-1/build/ntpsec-1.2.3/build/host'
> [1/2] Processing ntpd/ntp_parser.y
> [2/2] Compiling build/host/ntpd/ntp_parser.tab.c
> gcc: error: unrecognized command-line option '-mlongcalls'
> gcc: error: unrecognized command-line option '-mauto-litpools'

Thanks for the patch, but I'm pretty sure this is not the right fix.
You can see from the error message above that what is happening here is
that those flags, which are target CFLAGS, are passed to the host
compiler "gcc".

So your patch is not correct in several ways:

 - It will not solve the problem of other target CFLAGS used for other
   CPU architectures, which are also not supported by the host gcc
   compiler

 - It drops those target CFLAGS from the build of target code, which is
   not correct, as if some flags are present, there's a good reason for
   that.

So, the correct fix is to look in more details into the ntpsec build
system, and make sure it doesn't use target CFLAGS when building host
code.

Could you have a look into this?

Thanks a lot,

Thomas
diff mbox series

Patch

diff --git a/package/ntpsec/ntpsec.mk b/package/ntpsec/ntpsec.mk
index 661af788423c..70c993ba6b10 100644
--- a/package/ntpsec/ntpsec.mk
+++ b/package/ntpsec/ntpsec.mk
@@ -37,6 +37,9 @@  NTPSEC_DEPENDENCIES = \
 	libcap \
 	openssl
 
+NTPSEC_TARGET_CFLAGS = \
+	$(filter-out mlongcalls -mauto-litpools,$(TARGET_CFLAGS))
+
 # CC="$(HOSTCC)" is strange but needed to build some host tools, the
 # cross-compiler will properly be used to build target code thanks to
 # --cross-compiler
@@ -45,7 +48,7 @@  NTPSEC_CONF_OPTS = \
 	PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" \
 	--libdir=/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/ntp \
 	--cross-compiler="$(TARGET_CC)" \
-	--cross-cflags="$(TARGET_CFLAGS) -std=gnu99" \
+	--cross-cflags="$(NTSPEC_TARGET_CFLAGS) -std=gnu99" \
 	--cross-ldflags="$(TARGET_LDFLAGS)" \
 	--notests \
 	--enable-early-droproot \