diff mbox series

[v4] package/fluent-bit: rework wasm handling

Message ID 20230724120442.191703-1-thomas@devoogdt.com
State Accepted
Headers show
Series [v4] package/fluent-bit: rework wasm handling | expand

Commit Message

Thomas Devoogdt July 24, 2023, 12:04 p.m. UTC
Fluent-bit isn't very great at supporting the various architectures,
so help a little bit by defining the WAMR_BUILD_TARGET ourselves.

Two failures for MIPS while executing ./utils/test-pkg:

- sourcery-mips64:
core/iwasm/common/arch/invokeNative_mips.s: Assembler messages:
core/iwasm/common/arch/invokeNative_mips.s:58: Error: opcode not supported on this processor: mips64r2 (mips64r2) `ldc1 $f12,0($sp)'
core/iwasm/common/arch/invokeNative_mips.s:59: Error: opcode not supported on this processor: mips64r2 (mips64r2) `ldc1 $f14,8($sp)'
make[4]: *** [src/wasm/CMakeFiles/vmlib-static.dir/build.make:495: src/wasm/CMakeFiles/vmlib-static.dir/__/__/lib/wasm-micro-runtime-WAMR-1.1.1/core/iwasm/common/arch/invokeNative_mips.s.o] Error 1
make[4]: *** Waiting for unfinished jobs....

- sourcery-mips:
core/iwasm/common/arch/invokeNative_mips.s: Assembler messages:
core/iwasm/common/arch/invokeNative_mips.s:58: Error: opcode not supported on this processor: mips32r2 (mips32r2) `ldc1 $f12,0($sp)'
core/iwasm/common/arch/invokeNative_mips.s:59: Error: opcode not supported on this processor: mips32r2 (mips32r2) `ldc1 $f14,8($sp)'
make[4]: *** [src/wasm/CMakeFiles/vmlib-static.dir/build.make:495: src/wasm/CMakeFiles/vmlib-static.dir/__/__/lib/wasm-micro-runtime-WAMR-1.1.1/core/iwasm/common/arch/invokeNative_mips.s.o] Error 1
make[4]: *** Waiting for unfinished jobs....

Which are fixed by setting the obscure flag "WAMR_BUILD_INVOKE_NATIVE_GENERAL".

See https://github.com/bytecodealliance/wasm-micro-runtime/issues/625 for more info:
“Hi, building the invokeNative_general.c explicitly is supported now, please pull the latest code and use

Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
---
v2: No change.
v3: No change.
v4: Restore the BR2_PACKAGE_FLUENT_BIT_WASM_ARCH_SUPPORTS KConfig.
---
 package/fluent-bit/Config.in     | 20 +++++++++++++-------
 package/fluent-bit/fluent-bit.mk | 12 +++++++++++-
 2 files changed, 24 insertions(+), 8 deletions(-)

Comments

Thomas Petazzoni July 25, 2023, 4:38 p.m. UTC | #1
On Mon, 24 Jul 2023 14:04:42 +0200
Thomas Devoogdt <thomas@devoogdt.com> wrote:

> Fluent-bit isn't very great at supporting the various architectures,
> so help a little bit by defining the WAMR_BUILD_TARGET ourselves.
> 
> Two failures for MIPS while executing ./utils/test-pkg:
> 
> - sourcery-mips64:
> core/iwasm/common/arch/invokeNative_mips.s: Assembler messages:
> core/iwasm/common/arch/invokeNative_mips.s:58: Error: opcode not supported on this processor: mips64r2 (mips64r2) `ldc1 $f12,0($sp)'
> core/iwasm/common/arch/invokeNative_mips.s:59: Error: opcode not supported on this processor: mips64r2 (mips64r2) `ldc1 $f14,8($sp)'
> make[4]: *** [src/wasm/CMakeFiles/vmlib-static.dir/build.make:495: src/wasm/CMakeFiles/vmlib-static.dir/__/__/lib/wasm-micro-runtime-WAMR-1.1.1/core/iwasm/common/arch/invokeNative_mips.s.o] Error 1
> make[4]: *** Waiting for unfinished jobs....
> 
> - sourcery-mips:
> core/iwasm/common/arch/invokeNative_mips.s: Assembler messages:
> core/iwasm/common/arch/invokeNative_mips.s:58: Error: opcode not supported on this processor: mips32r2 (mips32r2) `ldc1 $f12,0($sp)'
> core/iwasm/common/arch/invokeNative_mips.s:59: Error: opcode not supported on this processor: mips32r2 (mips32r2) `ldc1 $f14,8($sp)'
> make[4]: *** [src/wasm/CMakeFiles/vmlib-static.dir/build.make:495: src/wasm/CMakeFiles/vmlib-static.dir/__/__/lib/wasm-micro-runtime-WAMR-1.1.1/core/iwasm/common/arch/invokeNative_mips.s.o] Error 1
> make[4]: *** Waiting for unfinished jobs....
> 
> Which are fixed by setting the obscure flag "WAMR_BUILD_INVOKE_NATIVE_GENERAL".
> 
> See https://github.com/bytecodealliance/wasm-micro-runtime/issues/625 for more info:
> “Hi, building the invokeNative_general.c explicitly is supported now, please pull the latest code and use
> 
> Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>

Applied to master, thanks.

Thomas
diff mbox series

Patch

diff --git a/package/fluent-bit/Config.in b/package/fluent-bit/Config.in
index bfdea895b0..9ffde5b315 100644
--- a/package/fluent-bit/Config.in
+++ b/package/fluent-bit/Config.in
@@ -13,15 +13,21 @@  config BR2_PACKAGE_FLUENT_BIT
 
 if BR2_PACKAGE_FLUENT_BIT
 
+config BR2_PACKAGE_FLUENT_BIT_WASM_ARCH
+	string
+	default "AARCH64"    if BR2_aarch64 || BR2_aarch64be
+	default "ARC"        if BR2_arcle || BR2_arceb
+	default "ARM"        if BR2_arm || BR2_armeb
+	default "MIPS"       if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
+	default "RISCV32"    if BR2_riscv && BR2_RISCV_32
+	default "RISCV64"    if BR2_riscv && BR2_RISCV_64
+	default "X86_32"     if BR2_i386
+	default "X86_64"     if BR2_x86_64
+	default "XTENSA"     if BR2_xtensa
+
 config BR2_PACKAGE_FLUENT_BIT_WASM_ARCH_SUPPORTS
 	bool
-	# see lib/wasm-micro-runtime-WAMR-1.1.1/README.md#supported-architectures-and-platforms
-	default y if BR2_arc
-	default y if BR2_arm || BR2_armeb
-	default y if BR2_aarch64 || BR2_aarch64_be
-	default y if BR2_i386 || BR2_x86_64
-	default y if BR2_RISCV_64
-	default y if BR2_xtensa
+	default y if BR2_PACKAGE_FLUENT_BIT_WASM_ARCH != ""
 
 config BR2_PACKAGE_FLUENT_BIT_WASM
 	bool "wasm runtime support"
diff --git a/package/fluent-bit/fluent-bit.mk b/package/fluent-bit/fluent-bit.mk
index cd8f347768..1185860661 100644
--- a/package/fluent-bit/fluent-bit.mk
+++ b/package/fluent-bit/fluent-bit.mk
@@ -23,7 +23,17 @@  FLUENT_BIT_CONF_OPTS += \
 	-DFLB_BACKTRACE=No
 
 ifeq ($(BR2_PACKAGE_FLUENT_BIT_WASM),y)
-FLUENT_BIT_CONF_OPTS += -DFLB_WASM=Yes
+FLUENT_BIT_WAMR_ARCH = $(call qstrip,$(BR2_PACKAGE_FLUENT_BIT_WASM_ARCH))
+
+# https://github.com/bytecodealliance/wasm-micro-runtime/issues/625
+# Fix unknown opcode 'ldc1', seen on mips32r2 and mips64r2.
+ifeq ($(FLUENT_BIT_WAMR_ARCH),MIPS)
+FLUENT_BIT_CONF_OPTS += \
+	-DWAMR_BUILD_INVOKE_NATIVE_GENERAL=1
+endif
+
+FLUENT_BIT_CONF_OPTS += -DFLB_WASM=Yes \
+	-DWAMR_BUILD_TARGET=$(FLUENT_BIT_WAMR_ARCH)
 else
 FLUENT_BIT_CONF_OPTS += -DFLB_WASM=No
 endif