Skip to contentSkip to conversation

package/ntpsec: fix build on xtensa

PATCH In review Dario Binacchi 2 participants 2 messages Jul 27, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/ntpsec: fix build on xtensa

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

---
 package/ntpsec/ntpsec.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
package/ntpsec/ntpsec.mk +4 -1
index 661af788423c..70c993ba6b10 100644
@@ -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 \
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Dario,

Quoted 7 lines · On Sat, 27 Jul 2024 11:40:29 +0200 Dario Binacchi…

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

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot