Skip to contentSkip to conversation

fluentbit: fix building with wasm support

PATCH Superseded [email protected] 4 participants 5 messages Oct 17, 2024 – Oct 21, 2024

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fluentbit: fix building with wasm support

From: Patrick Wicki <[email protected]>

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

---
 ...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
meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch new file +42 -0
new file mode 100644
index 000000000..419e85903
@@ -0,0 +1,42 @@
+From 5b6d274664f92a6c6083f4d27a1b1604a326f22c Mon Sep 17 00:00:00 2001
+From: Patrick Wicki <[email protected]>
+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 <[email protected]>
+---
+ .../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"
meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb +1 -0
index fc67236d3..d42a9a964 100644
@@ -21,6 +21,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 \
     ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0003-Disable-installing-systemd-service-file.patch', d)} \
 "
Signature · 1 line
2.47.0
#1 lore raw

it fails in configure -
https://valkyrie.yoctoproject.org/#/builders/81/builds/66/steps/14/logs/stdio

Quoted 84 lines · Patrick Wicki via lists.openembedded.org

From: Patrick Wicki <[email protected]>

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

---
 ...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
meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid-cmake-try_run-when-cross-compiling.patch new file +42 -0
new file mode 100644
index 000000000..419e85903
@@ -0,0 +1,42 @@
+From 5b6d274664f92a6c6083f4d27a1b1604a326f22c Mon Sep 17 00:00:00 2001
+From: Patrick Wicki <[email protected]>
+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 <[email protected]>
+---
+ .../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"
meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb +1 -1
index fc67236d3..d42a9a964 100644
@@ -21,6 +21,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 \
     ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0003-Disable-installing-systemd-service-file.patch', d)} \
 "
--

2.47.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#112961): https://lists.openembedded.org/g/openembedded-devel/message/112961
Mute This Topic: https://lists.openembedded.org/mt/109059531/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

I've been unable to reproduce this failure on my end unfortunately. In my understanding, the contents of the patched file should not even affect the build at all unless the "wasm" PACKAGECONFIG is enabled, which is not the case by default.

I'm open to suggestions. Otherwise, I think we can skip this patch and wait for upstream to update the WASM runtime, which should fix it too.

Quoted 126 lines · Khem Raj via lists.openembedded.org

it fails in configure -
https://valkyrie.yoctoproject.org/#/builders/81/builds/66/steps/14/logs/stdio

Quoted 96 lines · Patrick Wicki via lists.openembedded.org

From: Patrick Wicki <[email protected]>

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

---
 ...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

(quoted diff) +0 -0

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

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +0 -0

cmake-try_run-when-cross-compiling.patch

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +1 -0
@@ -0,0 +1,42 @@
+From 5b6d274664f92a6c6083f4d27a1b1604a326f22c Mon Sep 17 00:00:00

2001

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +3 -0
+From: Patrick Wicki <[email protected]>
+Date: Sat, 5 Oct 2024 21:36:12 +0200
+Subject: [PATCH] wasm: avoid cmake try_run when cross-compiling

for x86

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +4 -0
+
+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

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +3 -0
+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!
meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +2 -0
+
+Since we cannot run the test program, assume that the instruction

is not

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +3 -0
+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.

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +2 -0
+
+Upstream-Status: Pending

[https://github.com/fluent/fluent-bit/pull/8744]

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +4 -0
+
+Signed-off-by: Patrick Wicki <[email protected]>
+---
+ .../build-scripts/config_common.cmake                           |

2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +2 -0
+
+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"

meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb +0 -0
index fc67236d3..d42a9a964 100644
@@ -21,6 +21,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 \

Quoted 12 lines

file://0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch \
     ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0003-Disable-installing-systemd-service-file.patch', d)} \
 "
--
2.47.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#112969):
https://lists.openembedded.org/g/openembedded-devel/message/112969
Mute This Topic: https://lists.openembedded.org/mt/109059531/8009873
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-devel/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

The CMake failure which occurs during fluentbit do_configure, seems to be

| CMake Error at src/CMakeLists.txt:550 (install):
| install DIRECTORY given unknown argument "/etc/fluent-bit/".

which occurs inside "upstart" specific segment at https://github.com/fluent/fluent-bit/blob/v3.1.9/src/CMakeLists.txt#L550

I looked to me like the preceding condition on line 543:

elseif(IS_DIRECTORY /usr/share/upstart)

is not cross-compile friendly, and during the failed test, presumably the build host happened to have a /usr/share/upstart directory which caused the condition being evaluated as true.

I've now submitted a patch which should mitigate this issue, and also fixes potential for similar kind of issue with systemd init manager case, when the build host does not have systemd specific /lib/systemd/system directory.

-Niko

Quoted 138 lines · Patrick Wicki via lists.openembedded.org

I've been unable to reproduce this failure on my end unfortunately. In my understanding, the contents of the patched file should not even affect the build at all unless the "wasm" PACKAGECONFIG is enabled, which is not the case by default.

I'm open to suggestions. Otherwise, I think we can skip this patch and wait for upstream to update the WASM runtime, which should fix it too.

Quoted 103 lines · Khem Raj via lists.openembedded.org

it fails in configure -
https://valkyrie.yoctoproject.org/#/builders/81/builds/66/steps/14/logs/stdio

Quoted 97 lines · Patrick Wicki via lists.openembedded.org

From: Patrick Wicki <[email protected]>

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

---
  ...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

(quoted diff) +0 -0

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

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +0 -0

cmake-try_run-when-cross-compiling.patch

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +1 -0
@@ -0,0 +1,42 @@
+From 5b6d274664f92a6c6083f4d27a1b1604a326f22c Mon Sep 17 00:00:00

2001

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +3 -0
+From: Patrick Wicki <[email protected]>
+Date: Sat, 5 Oct 2024 21:36:12 +0200
+Subject: [PATCH] wasm: avoid cmake try_run when cross-compiling

for x86

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +4 -0
+
+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

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +3 -0
+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!
meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +2 -0
+
+Since we cannot run the test program, assume that the instruction

is not

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +3 -0
+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.

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +2 -0
+
+Upstream-Status: Pending

[https://github.com/fluent/fluent-bit/pull/8744]

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +4 -0
+
+Signed-off-by: Patrick Wicki <[email protected]>
+---
+ .../build-scripts/config_common.cmake                           |

2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm-avoid- new file +2 -0
+
+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"

meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb +0 -0
index fc67236d3..d42a9a964 100644
@@ -21,6 +21,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 \

Quoted 14 lines
Quoted 11 lines

file://0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch
 \
     ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '',
'file://0003-Disable-installing-systemd-service-file.patch', d)} \
 "
--
2.47.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#113076): https://lists.openembedded.org/g/openembedded-devel/message/113076
Mute This Topic: https://lists.openembedded.org/mt/109059531/3618471
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw

You are right. Creating /usr/share/upstart on my build host was enough to reproduce the issue.

Thanks for spotting (and fixing) this!
I will send a v3 that should apply on top of your patch.

Quoted 189 lines · Niko Mauno

The CMake failure which occurs during fluentbit do_configure, seems to be

   | CMake Error at src/CMakeLists.txt:550 (install):
   |   install DIRECTORY given unknown argument "/etc/fluent-bit/".

which occurs inside "upstart" specific segment at
https://github.com/fluent/fluent-bit/blob/v3.1.9/src/CMakeLists.txt#L550

I looked to me like the preceding condition on line 543:

    elseif(IS_DIRECTORY /usr/share/upstart)

is not cross-compile friendly, and during the failed test, presumably the build host happened to have a /usr/share/upstart directory which caused the condition being evaluated as true.

I've now submitted a patch which should mitigate this issue, and also fixes potential for similar kind of issue with systemd init manager case, when the build host does not have systemd specific /lib/systemd/system directory.

-Niko

Quoted 164 lines · Patrick Wicki via lists.openembedded.org

I've been unable to reproduce this failure on my end unfortunately. In
my understanding, the contents of the patched file should not even affect the build at all unless the "wasm" PACKAGECONFIG is enabled, which is not the case by default.

I'm open to suggestions. Otherwise, I think we can skip this patch and
wait for upstream to update the WASM runtime, which should fix it too.

Quoted 124 lines · Khem Raj via lists.openembedded.org

it fails in configure -
https://valkyrie.yoctoproject.org/#/builders/81/builds/66/steps/14/logs/stdio

Quoted 118 lines · Patrick Wicki via lists.openembedded.org

From: Patrick Wicki <[email protected]>

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

---
  ...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

(quoted diff) +0 -0

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

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm- new file +0 -0

avoid-
cmake-try_run-when-cross-compiling.patch

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm- new file +1 -0
@@ -0,0 +1,42 @@
+From 5b6d274664f92a6c6083f4d27a1b1604a326f22c Mon Sep 17

00:00:00
2001

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm- new file +3 -0
+From: Patrick Wicki <[email protected]>
+Date: Sat, 5 Oct 2024 21:36:12 +0200
+Subject: [PATCH] wasm: avoid cmake try_run when cross-

compiling
for x86

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm- new file +2 -0
+
+This fixes building the wasm micro runtime used when enabling

wasm

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm- new file +2 -0
+support in fluentbit.
+cmake try_run does not work when cross-compiling because the

test
program

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm- new file +3 -0
+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!

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm- new file +2 -0
+
+Since we cannot run the test program, assume that the

instruction
is not

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm- new file +3 -0
+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
.

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm- new file +2 -0
+
+Upstream-Status: Pending

[https://github.com/fluent/fluent-bit/pull/8744]

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm- new file +4 -0
+
+Signed-off-by: Patrick Wicki <[email protected]>
+---
+ .../build-

scripts/config_common.cmake                           | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)

meta-oe/recipes-extended/fluentbit/fluentbit/0002-wasm- new file +2 -0
+
+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"

(quoted diff) +0 -0

extended/fluentbit/fluentbit_3.1.9.bb b/meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb index fc67236d3..d42a9a964 100644

meta-oe/recipes-extended/fluentbit/fluentbit_3.1.9.bb +0 -0
@@ -21,6 +21,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 \
      ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', ' file://0003-Disable-installing-systemd-service-file.patch', d)}

Quoted 11 lines
Quoted 8 lines

\
  "
--
2.47.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#113076):
https://lists.openembedded.org/g/openembedded-devel/message/113076
Mute This Topic:
https://lists.openembedded.org/mt/109059531/3618471
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-devel/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-