package/meson: fix cpu_family format
PATCH 1/1 package/meson: fix cpu_family format
From: James Hilliard <[email protected]>
Meson expects the cpu_family to be in a specific format for cross compilation, otherwise packages that use cpu_family detection may fail to build.
We also need to set needs_exe_wrapper = true to ensure that meson won't try and execute test binaries.
--- package/meson/cross-compilation.conf.in | 1 + package/meson/meson.mk | 43 ++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-)
package/meson/cross-compilation.conf.in +1 -0
@@ -11,6 +11,7 @@ strip = '@TARGET_CROSS at strip' pkgconfig = '@HOST_DIR@/usr/bin/pkg-config' [properties] +needs_exe_wrapper = true c_args = [@TARGET_CFLAGS@] c_link_args = [@TARGET_LDFLAGS@] cpp_args = [@TARGET_CXXFLAGS@]
package/meson/meson.mk +42 -1
55 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 1/1 package/meson: fix cpu_family format
Hi James,
Quoted 56 lines · james.hilliard1 at gmail.com writes:
From: James Hilliard <[email protected]>
Meson expects the
cpu_familyto be in a specific format for cross compilation, otherwise packages that usecpu_familydetection may fail to build.We also need to set
needs_exe_wrapper= true to ensure that meson won't try and execute test binaries.Signed-off-by James Hilliard <[email protected]>--- package/meson/cross-compilation.conf.in | 1 + package/meson/meson.mk | 43 ++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-)package/meson/cross-compilation.conf.in +1
-0@@ -11,6 +11,7 @@ strip = '@TARGET_CROSS at strip' pkgconfig = '@HOST_DIR@/usr/bin/pkg-config' [properties] +needs_exe_wrapper = true c_args = [@TARGET_CFLAGS@] c_link_args = [@TARGET_LDFLAGS@] cpp_args = [@TARGET_CXXFLAGS@]package/meson/meson.mk +21
-0@@ -16,6 +16,47 @@ HOST_MESON_NEEDS_HOST_PYTHON = python3 HOST_MESON_TARGET_ENDIAN = $(call LOWERCASE,$(BR2_ENDIAN)) HOST_MESON_TARGET_CPU = $(GCC_TARGET_CPU) +# https://mesonbuild.com/Reference-tables.html#cpu-families +ifeq ($(BR2_arcle),y) +HOST_MESON_TARGET_CPU_FAMILY = arc +else ifeq ($(BR2_arceb),y) +HOST_MESON_TARGET_CPU_FAMILY = arc +else ifeq ($(BR2_arm),y) +HOST_MESON_TARGET_CPU_FAMILY = arm +else ifeq ($(BR2_armeb),y) +HOST_MESON_TARGET_CPU_FAMILY = arm +else ifeq ($(BR2_aarch64),y) +HOST_MESON_TARGET_CPU_FAMILY = aarch64 +else ifeq ($(BR2_aarch64_be),y) +HOST_MESON_TARGET_CPU_FAMILY = aarch64 +else ifeq ($(BR2_i386),y) +HOST_MESON_TARGET_CPU_FAMILY = x86 +else ifeq ($(BR2_mips),y) +HOST_MESON_TARGET_CPU_FAMILY = mips +else ifeq ($(BR2_mipsel),y) +HOST_MESON_TARGET_CPU_FAMILY = mips +else ifeq ($(BR2_mips64),y) +HOST_MESON_TARGET_CPU_FAMILY = mips64
package/meson/meson.mk HOST_MESON_NEEDS_HOST_PYTHON = python3 · line 49
Quoted 10 lines
package/meson/meson.mk +10
-0+else ifeq ($(BR2_mips64el),y) +HOST_MESON_TARGET_CPU_FAMILY = mips64 +else ifeq ($(BR2_powerpc),y) +HOST_MESON_TARGET_CPU_FAMILY = ppc +else ifeq ($(BR2_powerpc64),y) +HOST_MESON_TARGET_CPU_FAMILY = ppc64 +else ifeq ($(BR2_powerpc64le),y) +HOST_MESON_TARGET_CPU_FAMILY = ppc64 +else ifeq ($(BR2_riscv),y) +HOST_MESON_TARGET_CPU_FAMILY = riscv32
Are you sure? Buildroot only supports riscv64 currently. See arch/Config.in.riscv.
baruch
Quoted 14 lines
package/meson/meson.mk +10
-0+else ifeq ($(BR2_sparc),y) +HOST_MESON_TARGET_CPU_FAMILY = sparc +else ifeq ($(BR2_sparc64),y) +HOST_MESON_TARGET_CPU_FAMILY = sparc64 +else ifeq ($(BR2_x86_64),y) +HOST_MESON_TARGET_CPU_FAMILY = x86_64 +else +HOST_MESON_TARGET_CPU_FAMILY = $(ARCH) +endif + HOST_MESON_SED_CFLAGS = $(if $(TARGET_CFLAGS),`printf '"%s"$(comma) ' $(TARGET_CFLAGS)`) HOST_MESON_SED_LDFLAGS = $(if $(TARGET_LDFLAGS),`printf '"%s"$(comma) ' $(TARGET_LDFLAGS)`) HOST_MESON_SED_CXXFLAGS = $(if $(TARGET_CXXFLAGS),`printf '"%s"$(comma) ' $(TARGET_CXXFLAGS)`)
package/meson/meson.mk HOST_MESON_SED_CXXFLAGS = $(if $(TARGET_CXXFLAGS),`printf '"%s"$(comma) ' $(TARG · line 70
Quoted 8 lines
package/meson/meson.mk +1
-1@@ -23,7 +64,7 @@ HOST_MESON_SED_CXXFLAGS = $(if $(TARGET_CXXFLAGS),`printf '"%s"$(comma) ' $(TARG define HOST_MESON_INSTALL_CROSS_CONF mkdir -p $(HOST_DIR)/etc/meson sed -e "s%@TARGET_CROSS@%$(TARGET_CROSS)%g" \ - -e "s%@TARGET_ARCH@%$(ARCH)%g" \ + -e "s%@TARGET_ARCH@%$(HOST_MESON_TARGET_CPU_FAMILY)%g" \ -e "s%@TARGET_CPU@%$(HOST_MESON_TARGET_CPU)%g" \ -e "s%@TARGET_ENDIAN@%$(HOST_MESON_TARGET_ENDIAN)%g" \ -e "s%@TARGET_CFLAGS@%$(HOST_MESON_SED_CFLAGS)%g" \
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
PATCH 1/1 package/meson: fix cpu_family format
Quoted 65 lines · Baruch Siach
Hi James,
Quoted 61 lines · james.hilliard1 at gmail.com writes:
From: James Hilliard <[email protected]>
Meson expects the
cpu_familyto be in a specific format for cross compilation, otherwise packages that usecpu_familydetection may fail to build.We also need to set
needs_exe_wrapper= true to ensure that meson won't try and execute test binaries.Signed-off-by James Hilliard <[email protected]>--- package/meson/cross-compilation.conf.in | 1 + package/meson/meson.mk | 43 ++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-)package/meson/cross-compilation.conf.in +1
-0@@ -11,6 +11,7 @@ strip = '@TARGET_CROSS at strip' pkgconfig = '@HOST_DIR@/usr/bin/pkg-config' [properties] +needs_exe_wrapper = true c_args = [@TARGET_CFLAGS@] c_link_args = [@TARGET_LDFLAGS@] cpp_args = [@TARGET_CXXFLAGS@]package/meson/meson.mk +26
-0@@ -16,6 +16,47 @@ HOST_MESON_NEEDS_HOST_PYTHON = python3 HOST_MESON_TARGET_ENDIAN = $(call LOWERCASE,$(BR2_ENDIAN)) HOST_MESON_TARGET_CPU = $(GCC_TARGET_CPU) +# https://mesonbuild.com/Reference-tables.html#cpu-families +ifeq ($(BR2_arcle),y) +HOST_MESON_TARGET_CPU_FAMILY = arc +else ifeq ($(BR2_arceb),y) +HOST_MESON_TARGET_CPU_FAMILY = arc +else ifeq ($(BR2_arm),y) +HOST_MESON_TARGET_CPU_FAMILY = arm +else ifeq ($(BR2_armeb),y) +HOST_MESON_TARGET_CPU_FAMILY = arm +else ifeq ($(BR2_aarch64),y) +HOST_MESON_TARGET_CPU_FAMILY = aarch64 +else ifeq ($(BR2_aarch64_be),y) +HOST_MESON_TARGET_CPU_FAMILY = aarch64 +else ifeq ($(BR2_i386),y) +HOST_MESON_TARGET_CPU_FAMILY = x86 +else ifeq ($(BR2_mips),y) +HOST_MESON_TARGET_CPU_FAMILY = mips +else ifeq ($(BR2_mipsel),y) +HOST_MESON_TARGET_CPU_FAMILY = mips +else ifeq ($(BR2_mips64),y) +HOST_MESON_TARGET_CPU_FAMILY = mips64 +else ifeq ($(BR2_mips64el),y) +HOST_MESON_TARGET_CPU_FAMILY = mips64 +else ifeq ($(BR2_powerpc),y) +HOST_MESON_TARGET_CPU_FAMILY = ppc +else ifeq ($(BR2_powerpc64),y)
Quoted 8 lines
package/meson/meson.mk HOST_MESON_NEEDS_HOST_PYTHON = python3 · line 49
Quoted 5 lines
package/meson/meson.mk +5
-0+HOST_MESON_TARGET_CPU_FAMILY = ppc64 +else ifeq ($(BR2_powerpc64le),y) +HOST_MESON_TARGET_CPU_FAMILY = ppc64 +else ifeq ($(BR2_riscv),y) +HOST_MESON_TARGET_CPU_FAMILY = riscv32Are you sure? Buildroot only supports riscv64 currently. See
arch/Config.in.riscv.
You're right, I was only looking for BR2_ARCH_IS_64 in arch/Config.in, is riscv the only arch where BR2_ARCH_IS_64 isn't set in arch/Config.in?
Quoted 31 lines
baruch
Quoted 14 lines
package/meson/meson.mk +10
-0+else ifeq ($(BR2_sparc),y) +HOST_MESON_TARGET_CPU_FAMILY = sparc +else ifeq ($(BR2_sparc64),y) +HOST_MESON_TARGET_CPU_FAMILY = sparc64 +else ifeq ($(BR2_x86_64),y) +HOST_MESON_TARGET_CPU_FAMILY = x86_64 +else +HOST_MESON_TARGET_CPU_FAMILY = $(ARCH) +endif + HOST_MESON_SED_CFLAGS = $(if $(TARGET_CFLAGS),`printf '"%s"$(comma) ' $(TARGET_CFLAGS)`) HOST_MESON_SED_LDFLAGS = $(if $(TARGET_LDFLAGS),`printf '"%s"$(comma) ' $(TARGET_LDFLAGS)`) HOST_MESON_SED_CXXFLAGS = $(if $(TARGET_CXXFLAGS),`printf '"%s"$(comma) ' $(TARGET_CXXFLAGS)`)package/meson/meson.mk HOST_MESON_SED_CXXFLAGS = $(if $(TARGET_CXXFLAGS),`printf '"%s"$(comma) ' $(TARG · line 70
Quoted 8 lines
package/meson/meson.mk +1
-1@@ -23,7 +64,7 @@ HOST_MESON_SED_CXXFLAGS = $(if $(TARGET_CXXFLAGS),`printf '"%s"$(comma) ' $(TARG define HOST_MESON_INSTALL_CROSS_CONF mkdir -p $(HOST_DIR)/etc/meson sed -e "s%@TARGET_CROSS@%$(TARGET_CROSS)%g" \ - -e "s%@TARGET_ARCH@%$(ARCH)%g" \ + -e "s%@TARGET_ARCH@%$(HOST_MESON_TARGET_CPU_FAMILY)%g" \ -e "s%@TARGET_CPU@%$(HOST_MESON_TARGET_CPU)%g" \ -e "s%@TARGET_ENDIAN@%$(HOST_MESON_TARGET_ENDIAN)%g" \ -e "s%@TARGET_CFLAGS@%$(HOST_MESON_SED_CFLAGS)%g" \--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
PATCH 1/1 package/meson: fix cpu_family format
Hi James,
Quoted 71 lines · James Hilliard
Quoted 62 lines · Baruch Siach
Quoted 61 lines · james.hilliard1 at gmail.com writes:
From: James Hilliard <[email protected]>
Meson expects the
cpu_familyto be in a specific format for cross compilation, otherwise packages that usecpu_familydetection may fail to build.We also need to set
needs_exe_wrapper= true to ensure that meson won't try and execute test binaries.Signed-off-by James Hilliard <[email protected]>--- package/meson/cross-compilation.conf.in | 1 + package/meson/meson.mk | 43 ++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-)package/meson/cross-compilation.conf.in +1
-0@@ -11,6 +11,7 @@ strip = '@TARGET_CROSS at strip' pkgconfig = '@HOST_DIR@/usr/bin/pkg-config' [properties] +needs_exe_wrapper = true c_args = [@TARGET_CFLAGS@] c_link_args = [@TARGET_LDFLAGS@] cpp_args = [@TARGET_CXXFLAGS@]package/meson/meson.mk +26
-0@@ -16,6 +16,47 @@ HOST_MESON_NEEDS_HOST_PYTHON = python3 HOST_MESON_TARGET_ENDIAN = $(call LOWERCASE,$(BR2_ENDIAN)) HOST_MESON_TARGET_CPU = $(GCC_TARGET_CPU) +# https://mesonbuild.com/Reference-tables.html#cpu-families +ifeq ($(BR2_arcle),y) +HOST_MESON_TARGET_CPU_FAMILY = arc +else ifeq ($(BR2_arceb),y) +HOST_MESON_TARGET_CPU_FAMILY = arc +else ifeq ($(BR2_arm),y) +HOST_MESON_TARGET_CPU_FAMILY = arm +else ifeq ($(BR2_armeb),y) +HOST_MESON_TARGET_CPU_FAMILY = arm +else ifeq ($(BR2_aarch64),y) +HOST_MESON_TARGET_CPU_FAMILY = aarch64 +else ifeq ($(BR2_aarch64_be),y) +HOST_MESON_TARGET_CPU_FAMILY = aarch64 +else ifeq ($(BR2_i386),y) +HOST_MESON_TARGET_CPU_FAMILY = x86 +else ifeq ($(BR2_mips),y) +HOST_MESON_TARGET_CPU_FAMILY = mips +else ifeq ($(BR2_mipsel),y) +HOST_MESON_TARGET_CPU_FAMILY = mips +else ifeq ($(BR2_mips64),y) +HOST_MESON_TARGET_CPU_FAMILY = mips64 +else ifeq ($(BR2_mips64el),y) +HOST_MESON_TARGET_CPU_FAMILY = mips64 +else ifeq ($(BR2_powerpc),y) +HOST_MESON_TARGET_CPU_FAMILY = ppc +else ifeq ($(BR2_powerpc64),y)Quoted 8 lines
package/meson/meson.mk HOST_MESON_NEEDS_HOST_PYTHON = python3 · line 49
Quoted 5 lines
package/meson/meson.mk +5
-0+HOST_MESON_TARGET_CPU_FAMILY = ppc64 +else ifeq ($(BR2_powerpc64le),y) +HOST_MESON_TARGET_CPU_FAMILY = ppc64 +else ifeq ($(BR2_riscv),y) +HOST_MESON_TARGET_CPU_FAMILY = riscv32Are you sure? Buildroot only supports riscv64 currently. See
arch/Config.in.riscv.
Quoted 3 lines
You're right, I was only looking for
BR2_ARCH_IS_64inarch/Config.in, is riscv the only arch whereBR2_ARCH_IS_64isn't set inarch/Config.in?
So it seems:
git grep 'select BR2_ARCH_IS_64' -- arch/arch/Config.in: select BR2_ARCH_IS_64arch/Config.in: select BR2_ARCH_IS_64arch/Config.in: select BR2_ARCH_IS_64arch/Config.in: select BR2_ARCH_IS_64arch/Config.in: select BR2_ARCH_IS_64arch/Config.in: select BR2_ARCH_IS_64arch/Config.in: select BR2_ARCH_IS_64arch/Config.in: select BR2_ARCH_IS_64arch/Config.in.riscv: select BR2_ARCH_IS_64
Not sure what the reason for that is. riscv is also special in that there is no support for its 32bit variant in Buildroot.
Mark?
baruch
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
package/meson/meson.mk +11
-1+else ifeq ($(BR2_sparc),y) +HOST_MESON_TARGET_CPU_FAMILY = sparc +else ifeq ($(BR2_sparc64),y) +HOST_MESON_TARGET_CPU_FAMILY = sparc64 +else ifeq ($(BR2_x86_64),y) +HOST_MESON_TARGET_CPU_FAMILY = x86_64 +else +HOST_MESON_TARGET_CPU_FAMILY = $(ARCH) +endif + HOST_MESON_SED_CFLAGS = $(if $(TARGET_CFLAGS),`printf '"%s"$(comma) ' $(TARGET_CFLAGS)`) HOST_MESON_SED_LDFLAGS = $(if $(TARGET_LDFLAGS),`printf '"%s"$(comma) ' $(TARGET_LDFLAGS)`) HOST_MESON_SED_CXXFLAGS = $(if $(TARGET_CXXFLAGS),`printf '"%s"$(comma) ' $(TARGET_CXXFLAGS)`)@@ -23,7 +64,7 @@ HOST_MESON_SED_CXXFLAGS = $(if $(TARGET_CXXFLAGS),`printf '"%s"$(comma) ' $(TARG define HOST_MESON_INSTALL_CROSS_CONF mkdir -p $(HOST_DIR)/etc/meson sed -e "s%@TARGET_CROSS@%$(TARGET_CROSS)%g" \ - -e "s%@TARGET_ARCH@%$(ARCH)%g" \ + -e "s%@TARGET_ARCH@%$(HOST_MESON_TARGET_CPU_FAMILY)%g" \ -e "s%@TARGET_CPU@%$(HOST_MESON_TARGET_CPU)%g" \ -e "s%@TARGET_ENDIAN@%$(HOST_MESON_TARGET_ENDIAN)%g" \ -e "s%@TARGET_CFLAGS@%$(HOST_MESON_SED_CFLAGS)%g" \
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH 1/1 package/meson: fix cpu_family format
Hello,
Quoted 12 lines · Baruch Siach
So it seems:
git grep 'select
BR2_ARCH_IS_64' --arch/arch/Config.in: selectBR2_ARCH_IS_64arch/Config.in: selectBR2_ARCH_IS_64arch/Config.in: selectBR2_ARCH_IS_64arch/Config.in: selectBR2_ARCH_IS_64arch/Config.in: selectBR2_ARCH_IS_64arch/Config.in: selectBR2_ARCH_IS_64arch/Config.in: selectBR2_ARCH_IS_64arch/Config.in: selectBR2_ARCH_IS_64arch/Config.in.riscv: selectBR2_ARCH_IS_64
All other architectures have separate top-level options for their 32-bit and 64-bit variants. I.e i386 vs x86-64, arm vs. arm64, mipsel vs. mipsel64, etc.
For RISC-V, since the kernel supports both 32-bit and 64-bit as a single architecture, we decided to do the same in Buildroot, and have a single top-level BR2_riscv option.
Quoted 2 lines
Not sure what the reason for that is. riscv is also special in that there is no support for its 32bit variant in Buildroot.
Mark has already sent patches adding support for RISC-V 32-bit, they are in patchwork, waiting for testing/review/merge.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 package/meson: fix cpu_family format
In reply to james.hilliard1 at gmail.comHello,
Quoted 3 lines · On Sun, 16 Dec 2018 15:13:15 +0800, james.hilliard1 at gmail.com wrote:
Meson expects the
cpu_familyto be in a specific format for cross compilation, otherwise packages that usecpu_familydetection may fail to build.
Could you be more specific than "may fail to build" ?
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 package/meson: fix cpu_family format
Quoted 8 lines · Thomas Petazzoni
Hello,
Quoted 3 lines · On Sun, 16 Dec 2018 15:13:15 +0800, james.hilliard1 at gmail.com wrote:
Meson expects the
cpu_familyto be in a specific format for cross compilation, otherwise packages that usecpu_familydetection may fail to build.
For example systemd-boot will fail to build due to
https://github.com/systemd/systemd/blob/06da5c63dd697ea4087e76c6d809b60b5780b87c/meson.build#L1384-L1401
requiring the correct meson cpu_family format.
Quoted 10 lines
Could you be more specific than "may fail to build" ?
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com