diff mbox series

[meta-oe] fluentbit: fix building with wasm support

Message ID 20241007200946.414276-1-patrick@subset.ch
State Under Review
Headers show
Series [meta-oe] fluentbit: fix building with wasm support | expand

Commit Message

patrick@subset.ch Oct. 7, 2024, 8:09 p.m. UTC
From: Patrick Wicki <patrick.wicki@siemens.com>

Add patch for the wasm runtime that fixes building for x86.

Signed-off-by: Patrick Wicki <patrick.wicki@siemens.com>
---
 ...d-cmake-try_run-when-cross-compiling.patch | 42 +++++++++++++++++++
 .../fluentbit/fluentbit_3.1.9.bb              |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch

Comments

Khem Raj Oct. 10, 2024, 7:58 p.m. UTC | #1
Hi Patrick

Thanks for the patch. There have been few iterations of the fluentbit
upgrade patch ( currently testing v4 in master-next )
can you rebase this patch on top of the latest master-next and resend
if it's still needed.

On Mon, Oct 7, 2024 at 1:10 PM Patrick Wicki via
lists.openembedded.org
<patrick.wicki=subset.ch@lists.openembedded.org> wrote:
>
> From: Patrick Wicki <patrick.wicki@siemens.com>
>
> Add patch for the wasm runtime that fixes building for x86.
>
> Signed-off-by: Patrick Wicki <patrick.wicki@siemens.com>
> ---
>  ...d-cmake-try_run-when-cross-compiling.patch | 42 +++++++++++++++++++
>  .../fluentbit/fluentbit_3.1.9.bb              |  1 +
>  2 files changed, 43 insertions(+)
>  create mode 100644 meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch
>
> diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch
> new file mode 100644
> index 000000000..419e85903
> --- /dev/null
> +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch
> @@ -0,0 +1,42 @@
> +From 5b6d274664f92a6c6083f4d27a1b1604a326f22c Mon Sep 17 00:00:00 2001
> +From: Patrick Wicki <patrick.wicki@siemens.com>
> +Date: Sat, 5 Oct 2024 21:36:12 +0200
> +Subject: [PATCH] wasm: avoid cmake try_run when cross-compiling for x86
> +
> +This fixes building the wasm micro runtime used when enabling wasm
> +support in fluentbit.
> +cmake try_run does not work when cross-compiling because the test program
> +cannot be executed:
> +
> +| CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
> +|    TEST_WRGSBASE_RESULT (advanced)
> +| For details see .../fluentbit/3.1.9/build/TryRunResults.cmake
> +|      Write linear memory base addr to x86 GS register disabled
> +| -- Configuring incomplete, errors occurred!
> +
> +Since we cannot run the test program, assume that the instruction is not
> +available and disable the option.
> +
> +This patch is no longer needed once fluentbit updates WAMR, as it's been
> +fixed in https://github.com/bytecodealliance/wasm-micro-runtime/pull/3066.
> +
> +Upstream-Status: Pending [https://github.com/fluent/fluent-bit/pull/8744]
> +
> +Signed-off-by: Patrick Wicki <patrick.wicki@siemens.com>
> +---
> + .../build-scripts/config_common.cmake                           | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/lib/wasm-micro-runtime-WAMR-1.3.0/build-scripts/config_common.cmake b/lib/wasm-micro-runtime-WAMR-1.3.0/build-scripts/config_common.cmake
> +index e73ebc85f..c2504e007 100644
> +--- a/lib/wasm-micro-runtime-WAMR-1.3.0/build-scripts/config_common.cmake
> ++++ b/lib/wasm-micro-runtime-WAMR-1.3.0/build-scripts/config_common.cmake
> +@@ -408,7 +408,7 @@ if (WAMR_BUILD_STATIC_PGO EQUAL 1)
> +   add_definitions (-DWASM_ENABLE_STATIC_PGO=1)
> +   message ("     AOT static PGO enabled")
> + endif ()
> +-if (WAMR_DISABLE_WRITE_GS_BASE EQUAL 1)
> ++if (WAMR_DISABLE_WRITE_GS_BASE EQUAL 1 OR CMAKE_CROSSCOMPILING)
> +   add_definitions (-DWASM_DISABLE_WRITE_GS_BASE=1)
> +   message ("     Write linear memory base addr to x86 GS register disabled")
> + elseif (WAMR_BUILD_TARGET STREQUAL "X86_64"
> diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb b/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb
> index e88b5e91a..9eccb8d0b 100644
> --- a/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb
> +++ b/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb
> @@ -19,6 +19,7 @@ SRCREV = "431fa79ae27edaef8d050a7af6f038f4400193a1"
>  SRC_URI = "\
>      git://github.com/fluent/fluent-bit.git;branch=3.1;protocol=https \
>      file://0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch \
> +    file://0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch \
>      file://0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch \
>  "
>
> --
> 2.46.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#112701): https://lists.openembedded.org/g/openembedded-devel/message/112701
> Mute This Topic: https://lists.openembedded.org/mt/108876258/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Patrick Wicki Oct. 17, 2024, 7:02 a.m. UTC | #2
Hi Khem,

thanks for the info. The patch is indeed still needed, I will resend
it.

On Thu, 2024-10-10 at 12:58 -0700, Khem Raj via lists.openembedded.org
wrote:
> Hi Patrick
> 
> Thanks for the patch. There have been few iterations of the fluentbit
> upgrade patch ( currently testing v4 in master-next )
> can you rebase this patch on top of the latest master-next and resend
> if it's still needed.
> 
> On Mon, Oct 7, 2024 at 1:10 PM Patrick Wicki via
> lists.openembedded.org
> <patrick.wicki=subset.ch@lists.openembedded.org> wrote:
> > 
> > From: Patrick Wicki <patrick.wicki@siemens.com>
> > 
> > Add patch for the wasm runtime that fixes building for x86.
> > 
> > Signed-off-by: Patrick Wicki <patrick.wicki@siemens.com>
> > ---
> >  ...d-cmake-try_run-when-cross-compiling.patch | 42
> > +++++++++++++++++++
> >  .../fluentbit/fluentbit_3.1.9.bb              |  1 +
> >  2 files changed, 43 insertions(+)
> >  create mode 100644 meta-oe/recipes-
> > extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-try_run-when-
> > cross-compiling.patch
> > 
> > diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0002-
> > wasm-avoid-cmake-try_run-when-cross-compiling.patch b/meta-
> > oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-
> > try_run-when-cross-compiling.patch
> > new file mode 100644
> > index 000000000..419e85903
> > --- /dev/null
> > +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-
> > cmake-try_run-when-cross-compiling.patch
> > @@ -0,0 +1,42 @@
> > +From 5b6d274664f92a6c6083f4d27a1b1604a326f22c Mon Sep 17 00:00:00
> > 2001
> > +From: Patrick Wicki <patrick.wicki@siemens.com>
> > +Date: Sat, 5 Oct 2024 21:36:12 +0200
> > +Subject: [PATCH] wasm: avoid cmake try_run when cross-compiling
> > for x86
> > +
> > +This fixes building the wasm micro runtime used when enabling wasm
> > +support in fluentbit.
> > +cmake try_run does not work when cross-compiling because the test
> > program
> > +cannot be executed:
> > +
> > +| CMake Error: try_run() invoked in cross-compiling mode, please
> > set the following cache variables appropriately:
> > +|    TEST_WRGSBASE_RESULT (advanced)
> > +| For details see .../fluentbit/3.1.9/build/TryRunResults.cmake
> > +|      Write linear memory base addr to x86 GS register disabled
> > +| -- Configuring incomplete, errors occurred!
> > +
> > +Since we cannot run the test program, assume that the instruction
> > is not
> > +available and disable the option.
> > +
> > +This patch is no longer needed once fluentbit updates WAMR, as
> > it's been
> > +fixed in
> > https://github.com/bytecodealliance/wasm-micro-runtime/pull/3066.
> > +
> > +Upstream-Status: Pending
> > [https://github.com/fluent/fluent-bit/pull/8744]
> > +
> > +Signed-off-by: Patrick Wicki <patrick.wicki@siemens.com>
> > +---
> > + .../build-scripts/config_common.cmake                           |
> > 2 +-
> > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > +
> > +diff --git a/lib/wasm-micro-runtime-WAMR-1.3.0/build-
> > scripts/config_common.cmake b/lib/wasm-micro-runtime-WAMR-
> > 1.3.0/build-scripts/config_common.cmake
> > +index e73ebc85f..c2504e007 100644
> > +--- a/lib/wasm-micro-runtime-WAMR-1.3.0/build-
> > scripts/config_common.cmake
> > ++++ b/lib/wasm-micro-runtime-WAMR-1.3.0/build-
> > scripts/config_common.cmake
> > +@@ -408,7 +408,7 @@ if (WAMR_BUILD_STATIC_PGO EQUAL 1)
> > +   add_definitions (-DWASM_ENABLE_STATIC_PGO=1)
> > +   message ("     AOT static PGO enabled")
> > + endif ()
> > +-if (WAMR_DISABLE_WRITE_GS_BASE EQUAL 1)
> > ++if (WAMR_DISABLE_WRITE_GS_BASE EQUAL 1 OR CMAKE_CROSSCOMPILING)
> > +   add_definitions (-DWASM_DISABLE_WRITE_GS_BASE=1)
> > +   message ("     Write linear memory base addr to x86 GS register
> > disabled")
> > + elseif (WAMR_BUILD_TARGET STREQUAL "X86_64"
> > diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb
> > b/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb
> > index e88b5e91a..9eccb8d0b 100644
> > --- a/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb
> > +++ b/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb
> > @@ -19,6 +19,7 @@ SRCREV =
> > "431fa79ae27edaef8d050a7af6f038f4400193a1"
> >  SRC_URI = "\
> >      git://github.com/fluent/fluent-
> > bit.git;branch=3.1;protocol=https \
> >     
> > file://0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch
> >  \
> > +   
> > file://0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch \
> >     
> > file://0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch
> >  \
> >  "
> > 
> > --
> > 2.46.2
> > 
> > 
> > 
> > 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#112779):
> https://lists.openembedded.org/g/openembedded-devel/message/112779
> Mute This Topic: https://lists.openembedded.org/mt/108876258/8009873
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe:
> https://lists.openembedded.org/g/openembedded-devel/unsub [
> patrick.wicki@subset.ch]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch
new file mode 100644
index 000000000..419e85903
--- /dev/null
+++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch
@@ -0,0 +1,42 @@ 
+From 5b6d274664f92a6c6083f4d27a1b1604a326f22c Mon Sep 17 00:00:00 2001
+From: Patrick Wicki <patrick.wicki@siemens.com>
+Date: Sat, 5 Oct 2024 21:36:12 +0200
+Subject: [PATCH] wasm: avoid cmake try_run when cross-compiling for x86
+
+This fixes building the wasm micro runtime used when enabling wasm
+support in fluentbit.
+cmake try_run does not work when cross-compiling because the test program
+cannot be executed:
+
+| CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
+|    TEST_WRGSBASE_RESULT (advanced)
+| For details see .../fluentbit/3.1.9/build/TryRunResults.cmake
+|      Write linear memory base addr to x86 GS register disabled
+| -- Configuring incomplete, errors occurred!
+
+Since we cannot run the test program, assume that the instruction is not
+available and disable the option.
+
+This patch is no longer needed once fluentbit updates WAMR, as it's been
+fixed in https://github.com/bytecodealliance/wasm-micro-runtime/pull/3066.
+
+Upstream-Status: Pending [https://github.com/fluent/fluent-bit/pull/8744]
+
+Signed-off-by: Patrick Wicki <patrick.wicki@siemens.com>
+---
+ .../build-scripts/config_common.cmake                           | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/wasm-micro-runtime-WAMR-1.3.0/build-scripts/config_common.cmake b/lib/wasm-micro-runtime-WAMR-1.3.0/build-scripts/config_common.cmake
+index e73ebc85f..c2504e007 100644
+--- a/lib/wasm-micro-runtime-WAMR-1.3.0/build-scripts/config_common.cmake
++++ b/lib/wasm-micro-runtime-WAMR-1.3.0/build-scripts/config_common.cmake
+@@ -408,7 +408,7 @@ if (WAMR_BUILD_STATIC_PGO EQUAL 1)
+   add_definitions (-DWASM_ENABLE_STATIC_PGO=1)
+   message ("     AOT static PGO enabled")
+ endif ()
+-if (WAMR_DISABLE_WRITE_GS_BASE EQUAL 1)
++if (WAMR_DISABLE_WRITE_GS_BASE EQUAL 1 OR CMAKE_CROSSCOMPILING)
+   add_definitions (-DWASM_DISABLE_WRITE_GS_BASE=1)
+   message ("     Write linear memory base addr to x86 GS register disabled")
+ elseif (WAMR_BUILD_TARGET STREQUAL "X86_64"
diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb b/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb
index e88b5e91a..9eccb8d0b 100644
--- a/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb
+++ b/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb
@@ -19,6 +19,7 @@  SRCREV = "431fa79ae27edaef8d050a7af6f038f4400193a1"
 SRC_URI = "\
     git://github.com/fluent/fluent-bit.git;branch=3.1;protocol=https \
     file://0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch \
+    file://0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch \
     file://0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch \
 "