package/meson: fix blank entry in cross-compilation.conf
PATCH 1/1 package/meson: fix blank entry in cross-compilation.conf
Without this change, cross-compilation.conf seems to be generated with a blank cpu entry in the host_machine section. (Note: what meson calls host, buildroot calls target.)
The effect is that meson-based packages may fail to detect architectural features of the target CPU, like SSE support, and either fail to take advantage of them or just refuse to compile.
This change follows the convention used to emit the endian entry in that section, which comes from [92eca65ddf meson: Strip quotes from BR2_ENDIAN]. To verify: grep cpu ./output/host/etc/meson/cross-compilation.conf
--- package/meson/meson.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/meson/meson.mk +1 -1
@@ -14,7 +14,7 @@ HOST_MESON_DEPENDENCIES = host-ninja HOST_MESON_NEEDS_HOST_PYTHON = python3 HOST_MESON_TARGET_ENDIAN = $(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN))) -HOST_MESON_TARGET_CPU = $(GCC_TARGET_CPU) +HOST_MESON_TARGET_CPU = $(call qstrip,$(call LOWERCASE,$(GCC_TARGET_CPU))) # https://mesonbuild.com/Reference-tables.html#cpu-families ifeq ($(BR2_arcle)$(BR2_arceb),y)
Signature · 1 line
2.29.0
PATCH 1/1 package/meson: fix blank entry in cross-compilation.conf
Hello Derrick,
Quoted 11 lines · Derrick Lyndon Pallas
Without this change, cross-compilation.conf seems to be generated with a blank cpu entry in the
host_machinesection. (Note: what meson calls host, buildroot calls target.)The effect is that meson-based packages may fail to detect architectural features of the target CPU, like SSE support, and either fail to take advantage of them or just refuse to compile.
This change follows the convention used to emit the
endianentry in that section, which comes from [92eca65ddfmeson: Strip quotes fromBR2_ENDIAN]. To verify:grep cpu ./output/host/etc/meson/cross-compilation.conf
On my system (for a RPi4 configuration) already without your patch:
$ grep cpu host/etc/meson/cross-compilation.conf cpu_family ='aarch64' cpu = 'cortex-a72'
Quoted 11 lines
Signed-off-by Derrick Lyndon Pallas <[email protected]>--- package/meson/meson.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/meson/meson.mk +0
-0
package/meson/meson.mk HOST_MESON_DEPENDENCIES = host-ninja · line 17
Quoted 5 lines
package/meson/meson.mk +1
-1@@ -14,7 +14,7 @@ HOST_MESON_DEPENDENCIES = host-ninja HOST_MESON_NEEDS_HOST_PYTHON = python3 HOST_MESON_TARGET_ENDIAN = $(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN))) -HOST_MESON_TARGET_CPU = $(GCC_TARGET_CPU) +HOST_MESON_TARGET_CPU = $(call qstrip,$(call LOWERCASE,$(GCC_TARGET_CPU)))
GCC_TARGET_CPU comes from arch/arch.mk:
GCC_TARGET_CPU := $(call qstrip,$(BR2_GCC_TARGET_CPU))
Anything special with your configuration/build environment (which buildroot version)? What is the BR2_GCC_TARGET_CPU entry in your .config file?
Regards,
Peter
Quoted 3 lines
package/meson/meson.mk +0
-0# https://mesonbuild.com/Reference-tables.html#cpu-families ifeq ($(BR2_arcle)$(BR2_arceb),y)
PATCH 1/1 package/meson: fix blank entry in cross-compilation.conf
Thanks for looking Peter.
Quoted 6 lines · Peter Seiderer
On my system (for a RPi4 configuration) already without your patch:
$ grep cpu host/etc/meson/cross-compilation.conf cpu_family ='aarch64' cpu = 'cortex-a72'
Quoted 7 lines
GCC_TARGET_CPUcomes fromarch/arch.mk:
GCC_TARGET_CPU:= $(call qstrip,$(BR2_GCC_TARGET_CPU))Anything special with your configuration/build environment (which buildroot version)? What is the
BR2_GCC_TARGET_CPUentry in your .config file?
I've tried this on both the development branch and on 2020.08.1 and I get the same results. The target is an x86_64/silvermont. After taking a second look, the problem seems to be that arch/Config.in.x86 does not actually set BR2_GCC_TARGET_CPU; instead, it sets BR2_GCC_TARGET_ARCH with a value that might better described as BR2_GCC_TARGET_CPU. Thus, my config has
BR2_ARCH = x86_64 # because BR2_x86_64 BR2_GCC_TARGET_ARCH = silvermont # because BR2_x86_silvermont
Is the config variable misnamed for x86? Adding Thomas Petazzoni, since it looks like he did the original breakout of BR2_GCC_TARGET_ARCH and then later removed it from several archs (e.g. arm) in favor of cpu.
Or should there be a fallback from BR2_GCC_TARGET_CPU to BR2_GCC_TARGET_ARCH if the former does not exist?
Thanks, ~Derrick
Hello Derrick,
Le 24/10/2020 à 21:02, Derrick Pallas a écrit :
Quoted 26 lines
Thanks for looking Peter.
Quoted 6 lines · Peter Seiderer
On my system (for a RPi4 configuration) already without your patch:
$ grep cpu host/etc/meson/cross-compilation.conf cpu_family ='aarch64' cpu = 'cortex-a72'Quoted 7 lines
GCC_TARGET_CPUcomes fromarch/arch.mk:
GCC_TARGET_CPU:= $(call qstrip,$(BR2_GCC_TARGET_CPU))Anything special with your configuration/build environment (which buildroot version)? What is the
BR2_GCC_TARGET_CPUentry in your .config file?I've tried this on both the development branch and on 2020.08.1 and I get the same results. The target is an x86_64/silvermont. After taking a second look, the problem seems to be that
arch/Config.in.x86does not actually setBR2_GCC_TARGET_CPU; instead, it setsBR2_GCC_TARGET_ARCHwith a value that might better described asBR2_GCC_TARGET_CPU. Thus, my config hasBR2_ARCH =
x86_64# becauseBR2_x86_64BR2_GCC_TARGET_ARCH= silvermont # becauseBR2_x86_silvermont
Quoted 6 lines
Is the config variable misnamed for x86? Adding Thomas Petazzoni, since it looks like he did the original breakout of
BR2_GCC_TARGET_ARCHand then later removed it from several archs (e.g. arm) in favor of cpu.Or should there be a fallback from
BR2_GCC_TARGET_CPUtoBR2_GCC_TARGET_ARCHif the former does not exist?
I don't see any change with this patch applied.
Indeed, cpu is empty on x86_64 architecture:
[host_machine]
system = 'linux'cpu_family = 'x86_64'
cpu = ''
endian = 'little'
On aach64:
[host_machine]
system = 'linux'cpu_family = 'aarch64'
cpu = 'cortex-a53'
endian = 'little'
See meson documentation about cpu_family vs cpu:
https://mesonbuild.com/Cross-compilation.html#machine-entries
Yocto use TARGET_ARCH as cpu value:
https://github.com/openembedded/openembedded-core/blob/dunfell/meta/classes/meson.bbclass#L119
Did you try to use BR2_GCC_TARGET_ARCH as cpu value ? Did you notice any change/improvement ?
I not sure it's really annoying since Buildroot use a toolchain wrapper that provide -mcpu= or -march= flag on the gcc command line.
Best regards,
Romain
Quoted 6 lines
Thanks, ~Derrick
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot