[PATCH] configs/meson: disable hexagon idef-parser for emscripten builds

Brian Cain posted 1 patch 3 weeks, 6 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260628190358.634435-1-brian.cain@oss.qualcomm.com
Maintainers: Kohei Tokunaga <ktokunaga.mail@gmail.com>
configs/meson/emscripten.txt | 3 +++
1 file changed, 3 insertions(+)
[PATCH] configs/meson: disable hexagon idef-parser for emscripten builds
Posted by Brian Cain 3 weeks, 6 days ago
The idef-parser is a native build tool that requires glib-2.0 on the
build machine. In emscripten cross builds, emconfigure sets
PKG_CONFIG_LIBDIR to emscripten's sysroot which prevents native
pkg-config from finding system-installed packages. Disable idef-parser
by default for emscripten since the wasm target does not need it.

Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
---
 configs/meson/emscripten.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/meson/emscripten.txt b/configs/meson/emscripten.txt
index 4230e88005f..c5c57e392a9 100644
--- a/configs/meson/emscripten.txt
+++ b/configs/meson/emscripten.txt
@@ -6,3 +6,6 @@ objc_args = ['-pthread']
 # configuration so explicitly add the flag here.
 c_link_args = ['-pthread','-sASYNCIFY=1','-sPROXY_TO_PTHREAD=1','-sFORCE_FILESYSTEM','-sALLOW_TABLE_GROWTH','-sTOTAL_MEMORY=2GB','-sWASM_BIGINT','-sEXPORT_ES6=1','-sASYNCIFY_IMPORTS=ffi_call_js','-sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction,TTY,FS']
 cpp_link_args = ['-pthread','-sASYNCIFY=1','-sPROXY_TO_PTHREAD=1','-sFORCE_FILESYSTEM','-sALLOW_TABLE_GROWTH','-sTOTAL_MEMORY=2GB','-sWASM_BIGINT','-sEXPORT_ES6=1','-sASYNCIFY_IMPORTS=ffi_call_js','-sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction,TTY,FS']
+
+[project options]
+hexagon_idef_parser = false
-- 
2.34.1

Re: [PATCH] configs/meson: disable hexagon idef-parser for emscripten builds
Posted by Pierrick Bouvier 3 weeks, 5 days ago
On 6/28/2026 12:03 PM, Brian Cain wrote:
> The idef-parser is a native build tool that requires glib-2.0 on the
> build machine. In emscripten cross builds, emconfigure sets
> PKG_CONFIG_LIBDIR to emscripten's sysroot which prevents native
> pkg-config from finding system-installed packages. Disable idef-parser
> by default for emscripten since the wasm target does not need it.
> 
> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> ---
>  configs/meson/emscripten.txt | 3 +++
>  1 file changed, 3 insertions(+)
> 

Already included in PR v5, but just in case:
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>

Regards,
Pierrick
Re: [PATCH] configs/meson: disable hexagon idef-parser for emscripten builds
Posted by Peter Maydell 3 weeks, 6 days ago
On Sun, 28 Jun 2026 at 20:05, Brian Cain <brian.cain@oss.qualcomm.com> wrote:
>
> The idef-parser is a native build tool that requires glib-2.0 on the
> build machine. In emscripten cross builds, emconfigure sets
> PKG_CONFIG_LIBDIR to emscripten's sysroot which prevents native
> pkg-config from finding system-installed packages.

This sounds like a bug in their cross build setup.

 Disable idef-parser
> by default for emscripten since the wasm target does not need it.
>
> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> ---
>  configs/meson/emscripten.txt | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/configs/meson/emscripten.txt b/configs/meson/emscripten.txt
> index 4230e88005f..c5c57e392a9 100644
> --- a/configs/meson/emscripten.txt
> +++ b/configs/meson/emscripten.txt
> @@ -6,3 +6,6 @@ objc_args = ['-pthread']
>  # configuration so explicitly add the flag here.
>  c_link_args = ['-pthread','-sASYNCIFY=1','-sPROXY_TO_PTHREAD=1','-sFORCE_FILESYSTEM','-sALLOW_TABLE_GROWTH','-sTOTAL_MEMORY=2GB','-sWASM_BIGINT','-sEXPORT_ES6=1','-sASYNCIFY_IMPORTS=ffi_call_js','-sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction,TTY,FS']
>  cpp_link_args = ['-pthread','-sASYNCIFY=1','-sPROXY_TO_PTHREAD=1','-sFORCE_FILESYSTEM','-sALLOW_TABLE_GROWTH','-sTOTAL_MEMORY=2GB','-sWASM_BIGINT','-sEXPORT_ES6=1','-sASYNCIFY_IMPORTS=ffi_call_js','-sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction,TTY,FS']
> +
> +[project options]
> +hexagon_idef_parser = false

We should have a comment here that briefly explains that we're doing
this to work around a bug in the cross build setup we use.

-- PMM
Re: [PATCH] configs/meson: disable hexagon idef-parser for emscripten builds
Posted by Brian Cain 3 weeks, 5 days ago
On Mon, Jun 29, 2026 at 4:39 AM Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Sun, 28 Jun 2026 at 20:05, Brian Cain <brian.cain@oss.qualcomm.com> wrote:
> >
> > The idef-parser is a native build tool that requires glib-2.0 on the
> > build machine. In emscripten cross builds, emconfigure sets
> > PKG_CONFIG_LIBDIR to emscripten's sysroot which prevents native
> > pkg-config from finding system-installed packages.
>
> This sounds like a bug in their cross build setup.
>
>  Disable idef-parser
> > by default for emscripten since the wasm target does not need it.
> >
> > Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> > ---
> >  configs/meson/emscripten.txt | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/configs/meson/emscripten.txt b/configs/meson/emscripten.txt
> > index 4230e88005f..c5c57e392a9 100644
> > --- a/configs/meson/emscripten.txt
> > +++ b/configs/meson/emscripten.txt
> > @@ -6,3 +6,6 @@ objc_args = ['-pthread']
> >  # configuration so explicitly add the flag here.
> >  c_link_args = ['-pthread','-sASYNCIFY=1','-sPROXY_TO_PTHREAD=1','-sFORCE_FILESYSTEM','-sALLOW_TABLE_GROWTH','-sTOTAL_MEMORY=2GB','-sWASM_BIGINT','-sEXPORT_ES6=1','-sASYNCIFY_IMPORTS=ffi_call_js','-sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction,TTY,FS']
> >  cpp_link_args = ['-pthread','-sASYNCIFY=1','-sPROXY_TO_PTHREAD=1','-sFORCE_FILESYSTEM','-sALLOW_TABLE_GROWTH','-sTOTAL_MEMORY=2GB','-sWASM_BIGINT','-sEXPORT_ES6=1','-sASYNCIFY_IMPORTS=ffi_call_js','-sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction,TTY,FS']
> > +
> > +[project options]
> > +hexagon_idef_parser = false
>
> We should have a comment here that briefly explains that we're doing
> this to work around a bug in the cross build setup we use.

Added a comment -
https://lore.kernel.org/qemu-devel/20260629131232.2487780-3-brian.cain@oss.qualcomm.com/

>
> -- PMM
Re: [PATCH] configs/meson: disable hexagon idef-parser for emscripten builds
Posted by Brian Cain 3 weeks, 6 days ago
On 6/28/2026 2:03 PM, Brian Cain wrote:
> The idef-parser is a native build tool that requires glib-2.0 on the
> build machine. In emscripten cross builds, emconfigure sets
> PKG_CONFIG_LIBDIR to emscripten's sysroot which prevents native
> pkg-config from finding system-installed packages. Disable idef-parser
> by default for emscripten since the wasm target does not need it.
>
> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> ---
>   configs/meson/emscripten.txt | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/configs/meson/emscripten.txt b/configs/meson/emscripten.txt
> index 4230e88005f..c5c57e392a9 100644
> --- a/configs/meson/emscripten.txt
> +++ b/configs/meson/emscripten.txt
> @@ -6,3 +6,6 @@ objc_args = ['-pthread']
>   # configuration so explicitly add the flag here.
>   c_link_args = ['-pthread','-sASYNCIFY=1','-sPROXY_TO_PTHREAD=1','-sFORCE_FILESYSTEM','-sALLOW_TABLE_GROWTH','-sTOTAL_MEMORY=2GB','-sWASM_BIGINT','-sEXPORT_ES6=1','-sASYNCIFY_IMPORTS=ffi_call_js','-sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction,TTY,FS']
>   cpp_link_args = ['-pthread','-sASYNCIFY=1','-sPROXY_TO_PTHREAD=1','-sFORCE_FILESYSTEM','-sALLOW_TABLE_GROWTH','-sTOTAL_MEMORY=2GB','-sWASM_BIGINT','-sEXPORT_ES6=1','-sASYNCIFY_IMPORTS=ffi_call_js','-sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction,TTY,FS']
> +
> +[project options]
> +hexagon_idef_parser = false


I also considered a change to `configure` to workaround the 
PKG_CONFIG_LIBDIR override (below) but I didn't like the idea of such a 
broad change.

So this one has narrow impact to just turn off the idef parser for 
hexagon for now and we can revisit if later if desired.


+    if test -n "$PKG_CONFIG_LIBDIR"; then
+      native_pc_path=$(env -u PKG_CONFIG_PATH -u PKG_CONFIG_LIBDIR \
+        pkg-config --variable pc_path pkg-config 2>/dev/null)
+      if test -n "$native_pc_path"; then
+        native_pc_meson=$(echo "$native_pc_path" | \
+          sed "s|^|['|; s|:|', '|g; s|$|']|")
+        echo "" >> $native
+        echo "[built-in options]" >> $native
+        echo "pkg_config_path = $native_pc_meson" >> $native
+      fi
+    fi



Re: [PATCH] configs/meson: disable hexagon idef-parser for emscripten builds
Posted by Kohei Tokunaga 3 weeks, 6 days ago
Hi Brian,

> The idef-parser is a native build tool that requires glib-2.0 on the
> build machine. In emscripten cross builds, emconfigure sets
> PKG_CONFIG_LIBDIR to emscripten's sysroot which prevents native
> pkg-config from finding system-installed packages. Disable idef-parser
> by default for emscripten since the wasm target does not need it.
>
> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> ---
>  configs/meson/emscripten.txt | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/configs/meson/emscripten.txt b/configs/meson/emscripten.txt
> index 4230e88005f..c5c57e392a9 100644
> --- a/configs/meson/emscripten.txt
> +++ b/configs/meson/emscripten.txt
> @@ -6,3 +6,6 @@ objc_args = ['-pthread']
>  # configuration so explicitly add the flag here.
>  c_link_args =
['-pthread','-sASYNCIFY=1','-sPROXY_TO_PTHREAD=1','-sFORCE_FILESYSTEM','-sALLOW_TABLE_GROWTH','-sTOTAL_MEMORY=2GB','-sWASM_BIGINT','-sEXPORT_ES6=1','-sASYNCIFY_IMPORTS=ffi_call_js','-sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction,TTY,FS']
>  cpp_link_args =
['-pthread','-sASYNCIFY=1','-sPROXY_TO_PTHREAD=1','-sFORCE_FILESYSTEM','-sALLOW_TABLE_GROWTH','-sTOTAL_MEMORY=2GB','-sWASM_BIGINT','-sEXPORT_ES6=1','-sASYNCIFY_IMPORTS=ffi_call_js','-sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction,TTY,FS']
> +
> +[project options]
> +hexagon_idef_parser = false

Thanks for catching this.

Reviewed-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>