ninjatool: quote dollars in variables
PATCH 1/1 ninjatool: quote dollars in variables
Otherwise, dollars (such as in the special $ORIGIN rpath) are eaten by Make.
--- scripts/ninjatool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/ninjatool.py +2 -1
@@ -834,7 +834,8 @@ class Ninja2Make(NinjaParserEventsWithVars): self.print() for targets in self.build_vars: for name, value in self.build_vars[targets].items(): - self.print('%s: private .var.%s := %s' % (targets, name, value)) + self.print('%s: private .var.%s := %s' % + (targets, name, value.replace('$', '$$'))) self.print() if not self.seen_default: default_targets = sorted(self.all_outs - self.all_ins, key=natural_sort_key)
Signature · 1 line
2.26.2
Quoted 3 lines · Paolo Bonzini
Otherwise, dollars (such as in the special $ORIGIN rpath) are eaten by Make.
Incidentally, why are we using rpath anyway? I'm pretty sure the old build system didn't need it, and it's one of those features I have mentally filed away under "liable to confusing and non-portable weirdness"...
thanks
-- PMM
Il mer 26 ago 2020, 21:34 Peter Maydell <[email protected]> ha scritto:
Quoted 10 lines · Paolo Bonzini
Quoted 3 lines
Otherwise, dollars (such as in the special $ORIGIN rpath) are eaten by Make.
Incidentally, why are we using rpath anyway? I'm pretty sure the old build system didn't need it, and it's one of those features I have mentally filed away under "liable to confusing and non-portable weirdness"...
It's only done in the build tree, to allow running against uninstalled shared_library. Installed binaries have no rpath (distros don't want it anyway). QEMU doesn't need it since it has no shared library yet.
Paolo
Quoted 1 line
Quoted 14 lines · Paolo Bonzini
Il mer 26 ago 2020, 21:34 Peter Maydell <[email protected]> ha scritto:
Quoted 10 lines · Paolo Bonzini
Quoted 3 lines
Otherwise, dollars (such as in the special $ORIGIN rpath) are eaten by Make.
Incidentally, why are we using rpath anyway? I'm pretty sure the old build system didn't need it, and it's one of those features I have mentally filed away under "liable to confusing and non-portable weirdness"...
Quoted 4 lines
It's only done in the build tree, to allow running against uninstalled
shared_library. Installed binaries have no rpath (distros don't want it anyway). QEMU doesn't need it since it has no shared library yet.
Its an obscure example, but we use it in scripts/oss-fuzz/build.sh to build a qemu-fuzz binary(qemu-system with some bells and whistles) that is portable between containers and can be deployed on oss-fuzz. The other option is to build a static binary, which AFAIK is not supported for softmmu builds.
I guess this is a prime example of "confusing and non-portable weirdness".
In defense, it wasn't our idea. The oss-fuzz documentation suggests it:
https://google.github.io/oss-fuzz/further-reading/fuzzer-environment/#runtime-dependencies
Quoted 3 lines
Paolo
Quoted 1 line
Le 26/08/2020 à 21:01, Paolo Bonzini a écrit :
Quoted 15 lines
Otherwise, dollars (such as in the special $ORIGIN rpath) are eaten by Make.
Reported-by Laurent Vivier <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- scripts/ninjatool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)scripts/ninjatool.py +0
-0
scripts/ninjatool.py class Ninja2Make(NinjaParserEventsWithVars): · line 841
Quoted 9 lines
scripts/ninjatool.py +2
-1@@ -834,7 +834,8 @@ class Ninja2Make(NinjaParserEventsWithVars): self.print() for targets in self.build_vars: for name, value in self.build_vars[targets].items(): - self.print('%s: private .var.%s := %s' % (targets, name, value)) + self.print('%s: private .var.%s := %s' % + (targets, name, value.replace('$', '$$'))) self.print() if not self.seen_default: default_targets = sorted(self.all_outs - self.all_ins, key=natural_sort_key)
This actually fixes the '-Wl,-rpath,$ORIGIN/', but doesn't fix the crash with statically linked binaries.
Could we simply remove the the '-Wl,-rpath,$ORIGIN/' in the case of "-static" build?
Thanks,
Laurent
Il gio 27 ago 2020, 09:33 Laurent Vivier <[email protected]> ha scritto:
Quoted 3 lines
This actually fixes the '-Wl,-rpath,$ORIGIN/', but doesn't fix the crash with statically linked binaries.
I will try to reproduce when I am back; it works for Peter so there must be something different in the setup.
In any case, if needed we can both momentarily hack around it in Makefiles, and fix it for good in Meson.
Paolo
Quoted 7 lines
Could we simply remove the the '-Wl,-rpath,$ORIGIN/' in the case of "-static" build?
Thanks,
Laurent
Found; https://github.com/mesonbuild/Meson/issues/5191.
(With the fix there's no rpath at all in the QEMU build process).
Let's ask for a backport to 0.55.2.
Paolo
Il gio 27 ago 2020, 10:22 Paolo Bonzini <[email protected]> ha scritto:
Quoted 24 lines
Il gio 27 ago 2020, 09:33 Laurent Vivier <[email protected]> ha scritto:
Quoted 3 lines
This actually fixes the '-Wl,-rpath,$ORIGIN/', but doesn't fix the crash with statically linked binaries.
I will try to reproduce when I am back; it works for Peter so there must be something different in the setup.
In any case, if needed we can both momentarily hack around it in Makefiles, and fix it for good in Meson.
Paolo
Quoted 7 lines
Could we simply remove the the '-Wl,-rpath,$ORIGIN/' in the case of "-static" build?
Thanks,
Laurent
... and actually it's fixed in 0.55.1. We can therefore just update the submodule and declare 0.55.1 the minimum required version for QEMU.
Paolo
Il gio 27 ago 2020, 11:10 Paolo Bonzini <[email protected]> ha scritto:
Quoted 34 lines
Found; https://github.com/mesonbuild/Meson/issues/5191.
(With the fix there's no rpath at all in the QEMU build process).
Let's ask for a backport to 0.55.2.
Paolo
Il gio 27 ago 2020, 10:22 Paolo Bonzini <[email protected]> ha scritto:
Quoted 24 lines
Il gio 27 ago 2020, 09:33 Laurent Vivier <[email protected]> ha scritto:
Quoted 3 lines
This actually fixes the '-Wl,-rpath,$ORIGIN/', but doesn't fix the crash with statically linked binaries.
I will try to reproduce when I am back; it works for Peter so there must be something different in the setup.
In any case, if needed we can both momentarily hack around it in Makefiles, and fix it for good in Meson.
Paolo
Quoted 7 lines
Could we simply remove the the '-Wl,-rpath,$ORIGIN/' in the case of "-static" build?
Thanks,
Laurent
Quoted 2 lines · Paolo Bonzini
... and actually it's fixed in 0.55.1. We can therefore just update the submodule and declare 0.55.1 the minimum required version for QEMU.
Oh, I meant to ask -- if 0.56 is the one that gets rid of the warnings about unstable-keyval backwards compatibility issues, is there a reason our submodule version is 0.55 rather than 0.56 ?
thanks
-- PMM
Il gio 27 ago 2020, 12:08 Peter Maydell <[email protected]> ha scritto:
Quoted 9 lines · Paolo Bonzini
Quoted 2 lines
... and actually it's fixed in 0.55.1. We can therefore just update the
submodule and declare 0.55.1 the minimum required version for QEMU.
Oh, I meant to ask -- if 0.56 is the one that gets rid of the warnings about unstable-keyval backwards compatibility issues, is there a reason our submodule version is 0.55 rather than 0.56 ?
Because 0.56 has not been released yet, it's what the master branch will be.
Paolo
Quoted 4 lines
thanks
-- PMM
Le 27/08/2020 à 11:14, Paolo Bonzini a écrit :
Quoted 3 lines
... and actually it's fixed in 0.55.1. We can therefore just update the submodule and declare 0.55.1 the minimum required version for QEMU.
Updating the meson submodule to 0.55.1 has fixed the problem for me.
Thanks,
Laurent