Qemu and gobject-introspection fixes
cover Qemu and gobject-introspection fixes
First of all, sorry this took so long!
This series is an accumulation of several conversations between Thomas, Yann, and myself. The basics are this:
- GOI fails to build with the corei7 architecture because calling qemu results in qemu trying to use instructions that may not exist on the host processor. This causes a core dump.
- OpenEmbedded gets around this issue by adding options to qemu on certain CPU and architecture combinations, Corei7 being one of those architectures.
- As discussed with Thomas, a new string "BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS" in qemu/Config.in.host is added, which we then sed to g-ir-scanner.in.
In addition, I was anonyed that there were so many shellcheck issues with the various wrappers, and Yann was annoyed that the wrappers were calling to bash when they didn't need to do so, so those are also fixed in this patch series.
And last (but not least), Yann noticed a latent bug in g-ir-scanner-qemuwrapper. If GIR_EXTRA_LIBS_PATH is empty, then the LD_LIBRARY_PATH is prepended with a colon, so that is also fixed.
This will lead the way to NodeJS 14 which is one step closer to removing Python2!
Tested in a CentOS7 docker container:
andes-nds32 [ 1/45]: SKIPPED
arm-aarch64 [ 2/45]: OK
bootlin-aarch64-glibc [ 3/45]: OK
bootlin-arcle-hs38-uclibc [ 4/45]: SKIPPED
bootlin-armv5-uclibc [ 5/45]: SKIPPED
bootlin-armv7-glibc [ 6/45]: OK
bootlin-armv7m-uclibc [ 7/45]: SKIPPED
bootlin-armv7-musl [ 8/45]: SKIPPED
bootlin-m68k-5208-uclibc [ 9/45]: SKIPPED
bootlin-m68k-68040-uclibc [10/45]: SKIPPED
bootlin-microblazeel-uclibc [11/45]: SKIPPED
bootlin-mipsel32r6-glibc [12/45]: OK
bootlin-mipsel-uclibc [13/45]: SKIPPED
bootlin-nios2-glibc [14/45]: OK
bootlin-openrisc-uclibc [15/45]: SKIPPED
bootlin-powerpc64le-power8-glibc [16/45]: OK
bootlin-powerpc-e500mc-uclibc [17/45]: SKIPPED
bootlin-riscv32-glibc [18/45]: OK
bootlin-riscv64-glibc [19/45]: OK
bootlin-riscv64-musl [20/45]: SKIPPED
bootlin-sh4-uclibc [21/45]: SKIPPED
bootlin-sparc64-glibc [22/45]: OK
bootlin-sparc-uclibc [23/45]: SKIPPED
bootlin-x86-64-glibc [24/45]: OK
bootlin-x86-64-musl [25/45]: SKIPPED
bootlin-x86-64-uclibc [26/45]: SKIPPED
bootlin-xtensa-uclibc [27/45]: SKIPPED
br-arm-basic [28/45]: SKIPPED
br-arm-full-nothread [29/45]: SKIPPED
br-arm-full-static [30/45]: SKIPPED
br-i386-pentium4-full [31/45]: SKIPPED
br-i386-pentium-mmx-musl [32/45]: SKIPPED
br-mips64-n64-full [33/45]: SKIPPED
br-mips64r6-el-hf-glibc [34/45]: SKIPPED
br-powerpc-603e-basic-cpp [35/45]: SKIPPED
br-powerpc64-power7-glibc [36/45]: OK
linaro-aarch64-be [37/45]: SKIPPED
linaro-aarch64 [38/45]: OK
linaro-arm [39/45]: OK
sourcery-arm-armv4t [40/45]: SKIPPED
sourcery-arm [41/45]: SKIPPED
sourcery-arm-thumb2 [42/45]: SKIPPED
sourcery-mips64 [43/45]: SKIPPED
sourcery-mips [44/45]: OK
sourcery-nios2 [45/45]: OKAdam Duskett (7):
g-ir-scanner-qemuwrapper.in: Fix latent bug in LD_LIBRARY_PATH string g-ir-scanner-qemuwrapper.in: Fix shellcheck warnings, switch to sh g-ir-scanner.in: Fix shellcheck warnings, switch to sh g-ir-scanner-lddwrapper.in: Fix shellcheck warnings, switch to sh g-ir-compiler.in: Fix shellcheck warnings, switch to sh package/qemu: add BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS string package/gobject-introspection: Add QEMU_USERMODE_ARGS support
.../gobject-introspection/g-ir-compiler.in | 4 ++-- .../g-ir-scanner-lddwrapper.in | 4 ++-- .../g-ir-scanner-qemuwrapper.in | 19 ++++++++++++------- package/gobject-introspection/g-ir-scanner.in | 12 ++++++------ .../gobject-introspection.mk | 2 ++ package/qemu/Config.in.host | 4 ++++ 6 files changed, 28 insertions(+), 17 deletions(-)
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/7 g-ir-scanner-qemuwrapper.in: Fix latent bug in
If GIR_EXTRA_LIBS_PATH is empty, the LD_LIBRARY_PATH variable is ":.libs:$(dirname $0)/../lib:$(dirname $0)/../../lib".
As discussed with Yann Morin, add a new variable, "GOI_LIBRARY_PATH" and prepend ${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:} to the path to fix the above bug.
--- package/gobject-introspection/g-ir-scanner-qemuwrapper.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
package/gobject-introspection/g-ir-scanner-qemuwrapper.in +2 -1
@@ -4,10 +4,11 @@ # is older than the target kernel. # Use a modules directory which does not exist so we don't load random things # which may then get deleted (or their dependencies) and potentially segfault +GOI_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:}.libs:$(dirname "$0")/../lib:$(dirname "$0")/../../lib" GIO_MODULE_DIR=$(dirname $0)/../lib/gio/modules-dummy \ @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ -L $(dirname $0)/../../ \ --E LD_LIBRARY_PATH=${GIR_EXTRA_LIBS_PATH}:.libs:$(dirname $0)/../lib:$(dirname $0)/../../lib \ +-E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \ "$@" if [[ $? -ne 0 ]]; then
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH/master 1/7] g-ir-scanner-qemuwrapper.in: Fix latent bug in
Hello Adam,
Thanks for this patch series!
Quoted 8 lines · On Fri, 3 Sep 2021 09:20:21 -0700 Adam Duskett <[email protected]> wrote:
If
GIR_EXTRA_LIBS_PATHis empty, theLD_LIBRARY_PATHvariable is ":.libs:$(dirname $0)/../lib:$(dirname $0)/../../lib".As discussed with Yann Morin, add a new variable, "
GOI_LIBRARY_PATH" and prepend ${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:} to the path to fix the above bug.Signed-off-by Adam Duskett <[email protected]>
The commit title should have a prefix of package/gobject-introspection/g-ir-scanner-qemuwrapper.in, and also a description that isn't cut of in the middle.
These details can be fixed when applying, no need to resend for that.
Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Arnout Vandecappelle
AppliedRe: [Buildroot] [PATCH/master 1/7] g-ir-scanner-qemuwrapper.in: Fix latent bug in
In reply to Adam DuskettApplied to master, thanks.
I've tried to fix the summary line.
Quoted 17 lines · Adam Duskett
If
GIR_EXTRA_LIBS_PATHis empty, theLD_LIBRARY_PATHvariable is ":.libs:$(dirname $0)/../lib:$(dirname $0)/../../lib".As discussed with Yann Morin, add a new variable, "
GOI_LIBRARY_PATH" and prepend ${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:} to the path to fix the above bug.Signed-off-by Adam Duskett <[email protected]>--- package/gobject-introspection/g-ir-scanner-qemuwrapper.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)package/gobject-introspection/g-ir-scanner-qemuwrapper.in +0
-0
package/gobject-introspection/g-ir-scanner-qemuwrapper.in line 7
Quoted 4 lines
package/gobject-introspection/g-ir-scanner-qemuwrapper.in +1
-0@@ -4,10 +4,11 @@ # is older than the target kernel. # Use a modules directory which does not exist so we don't load random things # which may then get deleted (or their dependencies) and potentially segfault +GOI_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:}.libs:$(dirname "$0")/../lib:$(dirname "$0")/../../lib"
Since the comment above is not related to this assignment, I moved the
assignment above the comment.
I haven't tested the result so I hope I made no mistakes :-)
Regards,
Arnout
package/gobject-introspection/g-ir-scanner-qemuwrapper.in line 14
Quoted 9 lines
package/gobject-introspection/g-ir-scanner-qemuwrapper.in +1
-1GIO_MODULE_DIR=$(dirname $0)/../lib/gio/modules-dummy \ @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ -L $(dirname $0)/../../ \ --E LD_LIBRARY_PATH=${GIR_EXTRA_LIBS_PATH}:.libs:$(dirname $0)/../lib:$(dirname $0)/../../lib \ +-E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \ "$@" if [[ $? -ne 0 ]]; then
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/7 g-ir-scanner-qemuwrapper.in: Fix shellcheck warnings, switch to sh
In reply to Adam Duskett - Add double quotes to prevent globbing and word splitting.
- Add indentations of continuation lines.
- Disable SC2181 and SC2016 as we explicitly do not want the variables expanded in the echo.
--- .../g-ir-scanner-qemuwrapper.in | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
package/gobject-introspection/g-ir-scanner-qemuwrapper.in +9 -7
@@ -1,18 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -# Pass -r to qemu-user as to trick glibc into not errorings out if the host kernel +# Pass -r to qemu-user as to trick glibc into not erroring out if the host kernel # is older than the target kernel. # Use a modules directory which does not exist so we don't load random things # which may then get deleted (or their dependencies) and potentially segfault GOI_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:}.libs:$(dirname "$0")/../lib:$(dirname "$0")/../../lib" -GIO_MODULE_DIR=$(dirname $0)/../lib/gio/modules-dummy \ +GIO_MODULE_DIR="$(dirname "$0")/../lib/gio/modules-dummy" \ @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ --L $(dirname $0)/../../ \ --E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \ -"$@" + -L "$(dirname "$0")/../../" \ + -E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \ + "$@" -if [[ $? -ne 0 ]]; then +# shellcheck disable=SC2181 +if [ $? -ne 0 ]; then echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help." + # shellcheck disable=SC2016 echo 'Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"' exit 1 fi
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH/master 2/7] g-ir-scanner-qemuwrapper.in: Fix shellcheck warnings, switch to sh
Quoted 26 lines · Adam Duskett
- Add double quotes to prevent globbing and word splitting.
- Add indentations of continuation lines.
- Disable SC2181 and SC2016 as we explicitly do not want the variables expanded in the echo.Signed-off-by Adam Duskett <[email protected]>--- .../g-ir-scanner-qemuwrapper.in | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)package/gobject-introspection/g-ir-scanner-qemuwrapper.in +3
-3@@ -1,18 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -# Pass -r to qemu-user as to trick glibc into not errorings out if the host kernel +# Pass -r to qemu-user as to trick glibc into not erroring out if the host kernel # is older than the target kernel. # Use a modules directory which does not exist so we don't load random things # which may then get deleted (or their dependencies) and potentially segfault GOI_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:}.libs:$(dirname "$0")/../lib:$(dirname "$0")/../../lib" -GIO_MODULE_DIR=$(dirname $0)/../lib/gio/modules-dummy \ +GIO_MODULE_DIR="$(dirname "$0")/../lib/gio/modules-dummy" \
package/gobject-introspection/g-ir-scanner-qemuwrapper.in line 14
Quoted 10 lines
package/gobject-introspection/g-ir-scanner-qemuwrapper.in +4
-4@QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ --L $(dirname $0)/../../ \ --E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \ -"$@" + -L "$(dirname "$0")/../../" \ + -E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \ + "$@" -if [[ $? -ne 0 ]]; then +# shellcheck disable=SC2181
Instead of adding an exception, we could just do the right thing:
if ! @QEMU_USER@ -r ... \
... \
then
...But since I wasn't going to test this change, I left it as is.
Regards,
Arnout
package/gobject-introspection/g-ir-scanner-qemuwrapper.in line 20
Quoted 7 lines
package/gobject-introspection/g-ir-scanner-qemuwrapper.in +2
-0+if [ $? -ne 0 ]; then echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help." + # shellcheck disable=SC2016 echo 'Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"' exit 1 fi
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH/master 2/7] g-ir-scanner-qemuwrapper.in: Fix shellcheck warnings, switch to sh
Arnout, All,
On 2021-09-11 20:57 +0200, Arnout Vandecappelle spake thusly:
Quoted 40 lines · Adam Duskett
Quoted 26 lines
- Add double quotes to prevent globbing and word splitting.
- Add indentations of continuation lines.
- Disable SC2181 and SC2016 as we explicitly do not want the variables expanded in the echo.Signed-off-by Adam Duskett <[email protected]>--- .../g-ir-scanner-qemuwrapper.in | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)package/gobject-introspection/g-ir-scanner-qemuwrapper.in +3
-3@@ -1,18 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -# Pass -r to qemu-user as to trick glibc into not errorings out if the host kernel +# Pass -r to qemu-user as to trick glibc into not erroring out if the host kernel # is older than the target kernel. # Use a modules directory which does not exist so we don't load random things # which may then get deleted (or their dependencies) and potentially segfault GOI_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:}.libs:$(dirname "$0")/../lib:$(dirname "$0")/../../lib" -GIO_MODULE_DIR=$(dirname $0)/../lib/gio/modules-dummy \ +GIO_MODULE_DIR="$(dirname "$0")/../lib/gio/modules-dummy" \package/gobject-introspection/g-ir-scanner-qemuwrapper.in line 14
Quoted 10 lines
package/gobject-introspection/g-ir-scanner-qemuwrapper.in +4
-4@QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ --L $(dirname $0)/../../ \ --E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \ -"$@" + -L "$(dirname "$0")/../../" \ + -E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \ + "$@" -if [[ $? -ne 0 ]]; then +# shellcheck disable=SC2181Instead of adding an exception, we could just do the right thing:
Quoted 6 lines
if ! @QEMU_USER@ -r ... \ ... \ then ...But since I wasn't going to test this change, I left it as is.
I also considered it when Adam and I discussed this patch on IRC, but I side with him to keep the code as-is, but forgot to explain why so that he could add that to the commit log.
So for the posterity, here is my reasonning:
Continuation lines in a condition are ugly and make an if-then-else condition harder to grok, so we prefer adding an SC2181 exception as it leaves the code more readable.
Regards,
Yann E. MORIN.
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/7 g-ir-scanner.in: Fix shellcheck warnings, switch to sh
In reply to Adam Duskett--- package/gobject-introspection/g-ir-scanner.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
package/gobject-introspection/g-ir-scanner.in +6 -6
@@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh # These environment variables are empty by default, and as such ccompiler.py # defaults to either using the system tools (CC, CXX, and CPP) or leaving
@@ -15,8 +15,8 @@ export LDFLAGS="${LDFLAGS:-@TARGET_LDFLAGS@}" export GI_SCANNER_DISABLE_CACHE=1 -${HOST_DIR}/bin/g-ir-scanner \ ---lib-dirs-envvar=GIR_EXTRA_LIBS_PATH \ ---use-binary-wrapper=$(dirname $0)/g-ir-scanner-qemuwrapper \ ---use-ldd-wrapper=$(dirname $0)/g-ir-scanner-lddwrapper \ ---add-include-path=$(dirname $0)/../share/gir-1.0 "$@" +"${HOST_DIR}"/bin/g-ir-scanner \ + --lib-dirs-envvar=GIR_EXTRA_LIBS_PATH \ + --use-binary-wrapper="$(dirname "$0")"/g-ir-scanner-qemuwrapper \ + --use-ldd-wrapper="$(dirname "$0")"/g-ir-scanner-lddwrapper \ + --add-include-path="$(dirname "$0")"/../share/gir-1.0 "$@"
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Arnout Vandecappelle
AppliedRe: [Buildroot] [PATCH/master 3/7] g-ir-scanner.in: Fix shellcheck warnings, switch to sh
Quoted 1 line · Adam Duskett
Signed-off-by Adam Duskett <[email protected]>
Applied to master, thanks.
... And now I notice that I forgot to add the package/gobject-introspection/
prefix to the previous patch. I added it here and will hopefully remember to do it for the following ones.
Regards,
Arnout
Quoted 19 lines
--- package/gobject-introspection/g-ir-scanner.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)package/gobject-introspection/g-ir-scanner.in +1
-1@@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh # These environment variables are empty by default, and as such ccompiler.py # defaults to either using the system tools (CC, CXX, and CPP) or leaving@@ -15,8 +15,8 @@ export LDFLAGS="${LDFLAGS:-@TARGET_LDFLAGS@}" export GI_SCANNER_DISABLE_CACHE=1
package/gobject-introspection/g-ir-scanner.in export LDFLAGS="${LDFLAGS:-@TARGET_LDFLAGS@}" · line 22
Quoted 10 lines
package/gobject-introspection/g-ir-scanner.in +5
-5-${HOST_DIR}/bin/g-ir-scanner \ ---lib-dirs-envvar=GIR_EXTRA_LIBS_PATH \ ---use-binary-wrapper=$(dirname $0)/g-ir-scanner-qemuwrapper \ ---use-ldd-wrapper=$(dirname $0)/g-ir-scanner-lddwrapper \ ---add-include-path=$(dirname $0)/../share/gir-1.0 "$@" +"${HOST_DIR}"/bin/g-ir-scanner \ + --lib-dirs-envvar=GIR_EXTRA_LIBS_PATH \ + --use-binary-wrapper="$(dirname "$0")"/g-ir-scanner-qemuwrapper \ + --use-ldd-wrapper="$(dirname "$0")"/g-ir-scanner-lddwrapper \ + --add-include-path="$(dirname "$0")"/../share/gir-1.0 "$@"
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 4/7 g-ir-scanner-lddwrapper.in: Fix shellcheck warnings, switch to sh
In reply to Adam Duskett--- package/gobject-introspection/g-ir-scanner-lddwrapper.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
package/gobject-introspection/g-ir-scanner-lddwrapper.in +2 -2
@@ -1,3 +1,3 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -${HOST_DIR}/sbin/prelink-rtld --root=$(dirname $0)/../../ "$@" +"${HOST_DIR}"/sbin/prelink-rtld --root="$(dirname "$0")/../../" "$@"
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Arnout Vandecappelle
AppliedRe: [Buildroot] [PATCH/master 4/7] g-ir-scanner-lddwrapper.in: Fix shellcheck warnings, switch to sh
Quoted 1 line · Adam Duskett
Signed-off-by Adam Duskett <[email protected]>
Applied to master, thanks.
Regards,
Arnout
Quoted 10 lines
--- package/gobject-introspection/g-ir-scanner-lddwrapper.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)package/gobject-introspection/g-ir-scanner-lddwrapper.in +0
-0
package/gobject-introspection/g-ir-scanner-lddwrapper.in line 3
Quoted 5 lines
package/gobject-introspection/g-ir-scanner-lddwrapper.in +2
-2@@ -1,3 +1,3 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -${HOST_DIR}/sbin/prelink-rtld --root=$(dirname $0)/../../ "$@" +"${HOST_DIR}"/sbin/prelink-rtld --root="$(dirname "$0")/../../" "$@"
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 5/7 g-ir-compiler.in: Fix shellcheck warnings, switch to sh
In reply to Adam Duskett--- package/gobject-introspection/g-ir-compiler.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
package/gobject-introspection/g-ir-compiler.in +2 -2
@@ -1,3 +1,3 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -$(dirname $0)/g-ir-scanner-qemuwrapper $(dirname $0)/g-ir-compiler.real "$@" +"$(dirname "$0")"/g-ir-scanner-qemuwrapper "$(dirname "$0")"/g-ir-compiler.real "$@"
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Arnout Vandecappelle
AppliedRe: [Buildroot] [PATCH/master 5/7] g-ir-compiler.in: Fix shellcheck warnings, switch to sh
Quoted 1 line · Adam Duskett
Signed-off-by Adam Duskett <[email protected]>
Applied to master, thanks.
Regards,
Arnout
Quoted 10 lines
--- package/gobject-introspection/g-ir-compiler.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)package/gobject-introspection/g-ir-compiler.in +0
-0
package/gobject-introspection/g-ir-compiler.in line 3
Quoted 5 lines
package/gobject-introspection/g-ir-compiler.in +2
-2@@ -1,3 +1,3 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -$(dirname $0)/g-ir-scanner-qemuwrapper $(dirname $0)/g-ir-compiler.real "$@" +"$(dirname "$0")"/g-ir-scanner-qemuwrapper "$(dirname "$0")"/g-ir-compiler.real "$@"
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 6/7 package/qemu: add BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS string
In reply to Adam DuskettFor specific architectures, running qemu in user mode without any additional options may fail if the host processor does not have the necessary instructions to properly run qemu in user mode, which results in the following error:
"qemu: uncaught target signal 4 (Illegal instruction) - core dumped"
CoreI7 is one such architecture that has had consistent auto-build failures.
Add a new string in qemu/Config.in.host: BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS. The default for the Corei7 architecture is directly from the OpenEmbedded project found in meta/conf/machine/include/x86/tune-corei7.inc:
"-cpu Nehalem,check=false." Other architectures may be added to this string at a later date if other failures occure.
--- package/qemu/Config.in.host | 4 ++++ 1 file changed, 4 insertions(+)
package/qemu/Config.in.host +4 -0
@@ -73,6 +73,10 @@ config BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE the running host kernel, you may run into invalid system calls, which may yield surprising effects. +config BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS + string + default "-cpu Nehalem,check=false" if BR2_x86_corei7 + config BR2_PACKAGE_HOST_QEMU_VDE2 bool "VDE2 support" help
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH/master 6/7] package/qemu: add BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS string
Hello Adam,
Quoted 7 lines · On Fri, 3 Sep 2021 09:20:26 -0700 Adam Duskett <[email protected]> wrote:
For specific architectures, running qemu in user mode without any additional options may fail if the host processor does not have the necessary instructions to properly run qemu in user mode, which results in the following error:
"qemu: uncaught target signal 4 (Illegal instruction) - core dumped"CoreI7 is one such architecture that has had consistent auto-build failures.
Quoted 7 lines
Add a new string in qemu/Config.in.host:
BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS. The default for the Corei7 architecture is directly from the OpenEmbedded project found in meta/conf/machine/include/x86/tune-corei7.inc:
"-cpu Nehalem,check=false." Other architectures may be added to this string at a later date if other failures occure.Signed-off-by Adam Duskett <[email protected]>
So on the principle, I'm obviously OK as this is something I have suggested. However, what bothers me here is that we are handling only the Core i7 case, because it caused some issue in the autobuilder.
What is qemu doing when no -cpu is provided? Does it emulate the host CPU in this case? If so, then it is going to be wrong in a lot of other cases than Core i7, no?
Or put differently, shouldn't we essentially have a value for BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS for pretty much all CPU architectures that we want to support for this use-case ?
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH/master 6/7] package/qemu: add BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS string
Hey Thomas;
As briefly discussed on IRC, this is mostly due to x86 discrepancies, however, as I do not have access to * every * CPU
that buildroot + GOI supports, it's better to commit these changes now, and if others find issues with their CPU/GOI
builds, they can submit a patch far easier thanks to this patch series!
Adam
Quoted 33 lines · Thomas Petazzoni
Hello Adam,
Quoted 7 lines · On Fri, 3 Sep 2021 09:20:26 -0700 Adam Duskett <[email protected]> wrote:
For specific architectures, running qemu in user mode without any additional options may fail if the host processor does not have the necessary instructions to properly run qemu in user mode, which results in the following error:
"qemu: uncaught target signal 4 (Illegal instruction) - core dumped"CoreI7 is one such architecture that has had consistent auto-build failures.
Quoted 7 lines
Add a new string in qemu/Config.in.host:
BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS. The default for the Corei7 architecture is directly from the OpenEmbedded project found in meta/conf/machine/include/x86/tune-corei7.inc:
"-cpu Nehalem,check=false." Other architectures may be added to this string at a later date if other failures occure.Signed-off-by Adam Duskett <[email protected]>So on the principle, I'm obviously OK as this is something I have suggested. However, what bothers me here is that we are handling only the Core i7 case, because it caused some issue in the autobuilder.
What is qemu doing when no -cpu is provided? Does it emulate the host CPU in this case? If so, then it is going to be wrong in a lot of other cases than Core i7, no?
Or put differently, shouldn't we essentially have a value for
BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGSfor pretty much all CPU architectures that we want to support for this use-case ?
Quoted 5 lines
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH/master 6/7] package/qemu: add BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS string
Quoted 7 lines · Adam Duskett
Hey Thomas;
As briefly discussed on IRC, this is mostly due to x86 discrepancies, however, as I do not have access to * every * CPU
that buildroot + GOI supports, it's better to commit these changes now, and if others find issues with their CPU/GOI
builds, they can submit a patch far easier thanks to this patch series!
I still think Thomas is right: we should have a mapping for each architecture
option to the Qemu emulation option that corresponds to it.
In an ideal world, we would have BR2_ARCH_QEMU_CPU that is set inarch/Config.in.* for all (sub)architectures.
However, I doubt that anyone is going to take the time to do that (and test it,
without even knowing how to test it because *most* code will run just fine when the wrong -cpu option is used).
So, the pragmatic approach is to use this patch.
Therefore, applied to master, thanks.
Regards,
Arnout
Quoted 43 lines
Adam
Quoted 33 lines · Thomas Petazzoni
Hello Adam,
Quoted 7 lines · On Fri, 3 Sep 2021 09:20:26 -0700 Adam Duskett <[email protected]> wrote:
For specific architectures, running qemu in user mode without any additional options may fail if the host processor does not have the necessary instructions to properly run qemu in user mode, which results in the following error:
"qemu: uncaught target signal 4 (Illegal instruction) - core dumped"CoreI7 is one such architecture that has had consistent auto-build failures.
Quoted 7 lines
Add a new string in qemu/Config.in.host:
BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS. The default for the Corei7 architecture is directly from the OpenEmbedded project found in meta/conf/machine/include/x86/tune-corei7.inc:
"-cpu Nehalem,check=false." Other architectures may be added to this string at a later date if other failures occure.Signed-off-by Adam Duskett <[email protected]>So on the principle, I'm obviously OK as this is something I have suggested. However, what bothers me here is that we are handling only the Core i7 case, because it caused some issue in the autobuilder.
What is qemu doing when no -cpu is provided? Does it emulate the host CPU in this case? If so, then it is going to be wrong in a lot of other cases than Core i7, no?
Or put differently, shouldn't we essentially have a value for
BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGSfor pretty much all CPU architectures that we want to support for this use-case ?Quoted 5 lines
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Quoted 5 lines
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH/master 6/7] package/qemu: add BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS string
Quoted 11 lines · Arnout Vandecappelle
Quoted 7 lines · Adam Duskett
Hey Thomas;
As briefly discussed on IRC, this is mostly due to x86 discrepancies, however, as I do not have access to * every * CPU
that buildroot + GOI supports, it's better to commit these changes now, and if others find issues with their CPU/GOI
builds, they can submit a patch far easier thanks to this patch series!
Quoted 5 lines
I still think Thomas is right: we should have a mapping for each architecture
option to the Qemu emulation option that corresponds to it.In an ideal world, we would have
BR2_ARCH_QEMU_CPUthat is set inarch/Config.in.*for all (sub)architectures.
And even better: a qemu wrapper would make sure that the correct cpu option is
*always* passed to qemu.
Dream on...
Regards,
Arnout
Quoted 5 lines
However, I doubt that anyone is going to take the time to do that (and test it,
without even knowing how to test it because *most* code will run just fine when the wrong -cpu option is used).
Quoted 55 lines
So, the pragmatic approach is to use this patch.
Therefore, applied to master, thanks.
Regards,
ArnoutQuoted 48 lines
Adam
Quoted 33 lines · Thomas Petazzoni
Hello Adam,
Quoted 7 lines · On Fri, 3 Sep 2021 09:20:26 -0700 Adam Duskett <[email protected]> wrote:
For specific architectures, running qemu in user mode without any additional options may fail if the host processor does not have the necessary instructions to properly run qemu in user mode, which results in the following error:
"qemu: uncaught target signal 4 (Illegal instruction) - core dumped"CoreI7 is one such architecture that has had consistent auto-build failures.
Quoted 7 lines
Add a new string in qemu/Config.in.host:
BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS. The default for the Corei7 architecture is directly from the OpenEmbedded project found in meta/conf/machine/include/x86/tune-corei7.inc:
"-cpu Nehalem,check=false." Other architectures may be added to this string at a later date if other failures occure.Signed-off-by Adam Duskett <[email protected]>So on the principle, I'm obviously OK as this is something I have suggested. However, what bothers me here is that we are handling only the Core i7 case, because it caused some issue in the autobuilder.
What is qemu doing when no -cpu is provided? Does it emulate the host CPU in this case? If so, then it is going to be wrong in a lot of other cases than Core i7, no?
Or put differently, shouldn't we essentially have a value for
BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGSfor pretty much all CPU architectures that we want to support for this use-case ?Quoted 5 lines
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 7/7 package/gobject-introspection: Add QEMU_USERMODE_ARGS support
In reply to Adam DuskettNow that the qemu package has the BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS string, the gobject-introspection g-ir-scanner-qemuwrapper script can pass that string to qemu.
Add the QEMU_USERMODE_ARGS to g-ir-scanner-qemuwrapper.in and unconditionally sed @QEMU_USERMODE_ARGS@ with BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS.
Fixes:
http://autobuild.buildroot.org/results/2e9dbc0d36600c09fa9e59ab1b1903c9f40661e8
--- package/gobject-introspection/g-ir-scanner-qemuwrapper.in | 2 ++ package/gobject-introspection/gobject-introspection.mk | 2 ++ 2 files changed, 4 insertions(+)
package/gobject-introspection/g-ir-scanner-qemuwrapper.in +2 -0
@@ -5,8 +5,10 @@ # Use a modules directory which does not exist so we don't load random things # which may then get deleted (or their dependencies) and potentially segfault GOI_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:}.libs:$(dirname "$0")/../lib:$(dirname "$0")/../../lib" +QEMU_USERMODE_ARGS="@QEMU_USERMODE_ARGS@" GIO_MODULE_DIR="$(dirname "$0")/../lib/gio/modules-dummy" \ @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ + ${QEMU_USERMODE_ARGS:+${QEMU_USERMODE_ARGS}} \ -L "$(dirname "$0")/../../" \ -E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \ "$@"
package/gobject-introspection/gobject-introspection.mk +2 -0
@@ -84,6 +84,8 @@ define GOBJECT_INTROSPECTION_INSTALL_PRE_WRAPPERS $(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper $(SED) "s%@QEMU_USER@%$(QEMU_USER)%g" \ $(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper + $(SED) "s%@QEMU_USERMODE_ARGS@%$(call qstrip,$(BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS))%g" \ + $(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper $(SED) "s%@TOOLCHAIN_HEADERS_VERSION@%$(BR2_TOOLCHAIN_HEADERS_AT_LEAST)%g" \ $(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH/master 7/7] package/gobject-introspection: Add QEMU_USERMODE_ARGS support
Quoted 21 lines · Adam Duskett
Now that the qemu package has the
BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGSstring, the gobject-introspection g-ir-scanner-qemuwrapper script can pass that string to qemu.Add the
QEMU_USERMODE_ARGSto g-ir-scanner-qemuwrapper.in and unconditionally sed @QEMU_USERMODE_ARGS@ withBR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS.Fixes:
http://autobuild.buildroot.org/results/2e9dbc0d36600c09fa9e59ab1b1903c9f40661e8Signed-off-by Adam Duskett <[email protected]>--- package/gobject-introspection/g-ir-scanner-qemuwrapper.in | 2 ++ package/gobject-introspection/gobject-introspection.mk | 2 ++ 2 files changed, 4 insertions(+)package/gobject-introspection/g-ir-scanner-qemuwrapper.in +0
-0
package/gobject-introspection/g-ir-scanner-qemuwrapper.in line 11
Quoted 7 lines
package/gobject-introspection/g-ir-scanner-qemuwrapper.in +2
-0@@ -5,8 +5,10 @@ # Use a modules directory which does not exist so we don't load random things # which may then get deleted (or their dependencies) and potentially segfault GOI_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:}.libs:$(dirname "$0")/../lib:$(dirname "$0")/../../lib" +QEMU_USERMODE_ARGS="@QEMU_USERMODE_ARGS@" GIO_MODULE_DIR="$(dirname "$0")/../lib/gio/modules-dummy" \ @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ + ${QEMU_USERMODE_ARGS:+${QEMU_USERMODE_ARGS}} \
I'm surprised this doesn't trigger SC2086... But actually, there's no need for
the additional variable, right? If you put @QEMU_USERMODE_ARGS@ here directly, it should do the right thing:
- if empty, it just expands to
qemu-user-x86_64 -r 5.10.1 \
\
-L ...- if set to "-cpu Nehalem,check=false" it expands to
qemu-user-x86_64 -r 5.10.1 \
-cpu Nehalem,check=false \
-L ... So I changed that and I'm doing a test build before pushing to be sure it works
as expected.
Regards,
Arnout
Quoted 9 lines
package/gobject-introspection/g-ir-scanner-qemuwrapper.in +0
-0-L "$(dirname "$0")/../../" \ -E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \ "$@"package/gobject-introspection/gobject-introspection.mk +0
-0
package/gobject-introspection/gobject-introspection.mk define GOBJECT_INTROSPECTION_INSTALL_PRE_WRAPPERS · line 91
Quoted 8 lines
package/gobject-introspection/gobject-introspection.mk +2
-0@@ -84,6 +84,8 @@ define GOBJECT_INTROSPECTION_INSTALL_PRE_WRAPPERS $(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper $(SED) "s%@QEMU_USER@%$(QEMU_USER)%g" \ $(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper + $(SED) "s%@QEMU_USERMODE_ARGS@%$(call qstrip,$(BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS))%g" \ + $(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper $(SED) "s%@TOOLCHAIN_HEADERS_VERSION@%$(BR2_TOOLCHAIN_HEADERS_AT_LEAST)%g" \ $(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 19 lines · On Fri, 3 Sep 2021 09:20:20 -0700 Adam Duskett <[email protected]> wrote:
First of all, sorry this took so long!
This series is an accumulation of several conversations between Thomas, Yann, and myself. The basics are this:
- GOI fails to build with the corei7 architecture because calling qemu results in qemu trying to use instructions that may not exist on the host processor. This causes a core dump.
- OpenEmbedded gets around this issue by adding options to qemu on certain CPU and architecture combinations, Corei7 being one of those architectures.
- As discussed with Thomas, a new string "
BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS" in qemu/Config.in.host is added, which we then sed to g-ir-scanner.in.In addition, I was anonyed that there were so many shellcheck issues with the various wrappers, and Yann was annoyed that the wrappers were calling to bash when they didn't need to do so, so those are also fixed in this patch series.
Quoted 6 lines
And last (but not least), Yann noticed a latent bug in g-ir-scanner-qemuwrapper. If
GIR_EXTRA_LIBS_PATHis empty, then theLD_LIBRARY_PATHis prepended with a colon, so that is also fixed.This will lead the way to NodeJS 14 which is one step closer to removing Python2!
Thanks a lot for all this work! Could you remind me what's the relationship between this and NodeJS 14 ?
Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hey Thomas;
NodeJS14 ALSO requires a qemu wrapper to compile, so this work is necessary to allows NodeJS14 to
not crash when compiling against a corei7 target.
Adam
Quoted 33 lines · Thomas Petazzoni
Quoted 19 lines · On Fri, 3 Sep 2021 09:20:20 -0700 Adam Duskett <[email protected]> wrote:
First of all, sorry this took so long!
This series is an accumulation of several conversations between Thomas, Yann, and myself. The basics are this:
- GOI fails to build with the corei7 architecture because calling qemu results in qemu trying to use instructions that may not exist on the host processor. This causes a core dump.
- OpenEmbedded gets around this issue by adding options to qemu on certain CPU and architecture combinations, Corei7 being one of those architectures.
- As discussed with Thomas, a new string "
BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS" in qemu/Config.in.host is added, which we then sed to g-ir-scanner.in.In addition, I was anonyed that there were so many shellcheck issues with the various wrappers, and Yann was annoyed that the wrappers were calling to bash when they didn't need to do so, so those are also fixed in this patch series.
Quoted 6 lines
And last (but not least), Yann noticed a latent bug in g-ir-scanner-qemuwrapper. If
GIR_EXTRA_LIBS_PATHis empty, then theLD_LIBRARY_PATHis prepended with a colon, so that is also fixed.This will lead the way to NodeJS 14 which is one step closer to removing Python2!
Thanks a lot for all this work! Could you remind me what's the relationship between this and NodeJS 14 ?
Quoted 7 lines
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Adam,
Quoted 3 lines · On Fri, 3 Sep 2021 16:09:35 -0700 Adam Duskett <[email protected]> wrote:
NodeJS14 ALSO requires a qemu wrapper to compile, so this work is necessary to allows NodeJS14 to
not crash when compiling against a corei7 target.
Ah, OK. So there's no relationship between NodeJS and GOI, but it's NodeJS that needs a qemu wrapper. OK makes sense!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot