Fix build for less common build directories names
PATCH 1/1 Fix build for less common build directories names
scripts/tracetool generates a C preprocessor macro from the name of the build directory. Any characters which are possible in a directory name but not allowed in a macro name must be substituted, otherwise builds will fail.
---
I had problems with a build directory of the form "host,variant". Is this fix needed for stable, too?
Regards
Stefan W.
scripts/tracetool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/tracetool.py +1 -1
@@ -70,7 +70,7 @@ def make_group_name(filename): if dirname == "": return "common" - return re.sub(r"/|-", "_", dirname) + return re.sub(r"[^A-Za-z0-9]", "_", dirname) def main(args): global _SCRIPT
Signature · 1 line
2.1.4
Quoted 10 lines · Stefan Weil
scripts/tracetoolgenerates a C preprocessor macro from the name of the build directory. Any characters which are possible in a directory name but not allowed in a macro name must be substituted, otherwise builds will fail.Signed-off-by Stefan Weil <[email protected]>---
I had problems with a build directory of the form "host,variant". Is this fix needed for stable, too?
Why does it need to care about the build directory name at all? Ideally builds should be entirely deterministically reproducible whatever the path to the source or build directory names is...
thanks
-- PMM
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Stefan Weil
scripts/tracetoolgenerates a C preprocessor macro from the name of the build directory. Any characters which are possible in a directory name but not allowed in a macro name must be substituted, otherwise builds will fail.Signed-off-by Stefan Weil <[email protected]>---
Quoted 6 lines
Quoted 2 lines
I had problems with a build directory of the form "host,variant". Is this fix needed for stable, too?
Why does it need to care about the build directory name at all? Ideally builds should be entirely deterministically reproducible whatever the path to the source or build directory names is...
It's trying to construct the relative path from the source directory to a trace-events file (inside the source directory). This is used so that block/trace-event macros have BLOCK in their name while net/trace-events have NET, etc.
It does not care about the build directory or source directory path per se. Therefore deterministic builds shouldn't be a problem if the code is working correctly ;).
Stefan
Quoted 8 lines · Stefan Hajnoczi
Quoted 3 lines
Why does it need to care about the build directory name at all? Ideally builds should be entirely deterministically reproducible whatever the path to the source or build directory names is...
It's trying to construct the relative path from the source directory to a trace-events file (inside the source directory). This is used so that
block/trace-eventmacros have BLOCK in their name whilenet/trace-eventshave NET, etc.
But Stefan (Weil) is right, it's actually including the path to the build directory if you're building with objdir!=srcdir. It should not need that.
Paolo
Quoted 22 lines · Stefan Weil
scripts/tracetoolgenerates a C preprocessor macro from the name of the build directory. Any characters which are possible in a directory name but not allowed in a macro name must be substituted, otherwise builds will fail.Signed-off-by Stefan Weil <[email protected]>---
I had problems with a build directory of the form "host,variant". Is this fix needed for stable, too?
Regards
Stefan W.scripts/tracetool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/tracetool.py +0
-0
scripts/tracetool.py def make_group_name(filename): · line 73
Quoted 5 lines
scripts/tracetool.py +1
-1@@ -70,7 +70,7 @@ def make_group_name(filename): if dirname == "": return "common" - return re.sub(r"/|-", "_", dirname) + return re.sub(r"[^A-Za-z0-9]", "_", dirname)
dirname should only contain QEMU source tree subdirectory paths (e.g. hw/net). How did you get a comma in there?
I tried an out-of-tree build in a directory called 'a,b' but it doesn't trigger the issue.
I'd like to understand how to reproduce the problem in case I missed something.
Stefan
Quoted 10 lines · Stefan Hajnoczi
dirname should only contain QEMU source tree subdirectory paths (e.g. hw/net). How did you get a comma in there?
I tried an out-of-tree build in a directory called 'a,b' but it doesn't trigger the issue.
I'd like to understand how to reproduce the problem in case I missed something.
Stefan
I can reproduce it like this from the QEMU base directory:
$ mkdir a,b $ cd a,b $ ../configure [...] $ make [...] make: *** [trace/generated-tracers.o] Error 1 $ head trace/generated-tracers.h /* This file is autogenerated by tracetool, do not edit. */
#ifndef TRACE_A,B_GENERATED_TRACERS_H
#define TRACE_A,B_GENERATED_TRACERS_H
Stefan
Quoted 24 lines · Stefan Weil
Quoted 10 lines · Stefan Hajnoczi
dirname should only contain QEMU source tree subdirectory paths (e.g. hw/net). How did you get a comma in there?
I tried an out-of-tree build in a directory called 'a,b' but it doesn't trigger the issue.
I'd like to understand how to reproduce the problem in case I missed something.
Stefan
I can reproduce it like this from the QEMU base directory:
$ mkdir a,b $ cd a,b $ ../configure [...] $ make [...] make: *** [trace/generated-tracers.o] Error 1 $ head trace/generated-tracers.h /* This file is autogenerated by tracetool, do not edit. */
Quoted 2 lines
#ifndef TRACE_A,B_GENERATED_TRACERS_H
#define TRACE_A,B_GENERATED_TRACERS_H
Interesting! I missed it because my a,b directory was not inside the source directory.
Stefan
Michael Tokarev
AppliedQuoted 4 lines · Stefan Weil
scripts/tracetoolgenerates a C preprocessor macro from the name of the build directory. Any characters which are possible in a directory name but not allowed in a macro name must be substituted, otherwise builds will fail.
Applied to -trivial, thank you!
/mjt
Quoted 7 lines · Michael Tokarev
Quoted 4 lines · Stefan Weil
scripts/tracetoolgenerates a C preprocessor macro from the name of the build directory. Any characters which are possible in a directory name but not allowed in a macro name must be substituted, otherwise builds will fail.Applied to -trivial, thank you!
Consensus on this and the other thread seemed to be that we should just fix the bug where tracetool is putting the build directory name into symbols rather than working around that...
thanks
-- PMM
Am 16.10.2016 um 21:04 schrieb Peter Maydell:
Quoted 9 lines · Michael Tokarev
Quoted 7 lines
Quoted 4 lines · Stefan Weil
scripts/tracetoolgenerates a C preprocessor macro from the name of the build directory. Any characters which are possible in a directory name but not allowed in a macro name must be substituted, otherwise builds will fail.Applied to -trivial, thank you!
Quoted 8 lines
Consensus on this and the other thread seemed to be that we should just fix the bug where tracetool is putting the build directory name into symbols rather than working around that...
thanks
-- PMM
IMHO the patch can be applied nevertheless, as it uses a clearer regular expression for characters allowed in macro names (not one that is specific for the current QEMU code).
Stefan
Quoted 15 lines · Stefan Weil
Am 16.10.2016 um 21:04 schrieb Peter Maydell:
Quoted 14 lines · Michael Tokarev
Quoted 7 lines
Quoted 4 lines · Stefan Weil
scripts/tracetoolgenerates a C preprocessor macro from the name of the build directory. Any characters which are possible in a directory name but not allowed in a macro name must be substituted, otherwise builds will fail.Applied to -trivial, thank you!
Consensus on this and the other thread seemed to be that we should just fix the bug where tracetool is putting the build directory name into symbols rather than working around that...
Quoted 6 lines
Quoted 2 lines
thanks
-- PMMIMHO the patch can be applied nevertheless, as it uses a clearer regular expression for characters allowed in macro names (not one that is specific for the current QEMU code).
So, what's the thing here?
Once again I hit this bug today, when my usual build environment doesn't work:
./trace/generated-tracers.h:3:15: error: extra tokens at end of #ifndef directive [-Werror]
#ifndef TRACE_.B64_GENERATED_TRACERS_H
^and this patch fixes the issue for me.
Thanks,
/mjt
Quoted 16 lines · Michael Tokarev
Quoted 15 lines · Stefan Weil
Am 16.10.2016 um 21:04 schrieb Peter Maydell:
Quoted 14 lines · Michael Tokarev
Quoted 7 lines
Quoted 4 lines · Stefan Weil
scripts/tracetoolgenerates a C preprocessor macro from the name of the build directory. Any characters which are possible in a directory name but not allowed in a macro name must be substituted, otherwise builds will fail.Applied to -trivial, thank you!
Consensus on this and the other thread seemed to be that we should just fix the bug where tracetool is putting the build directory name into symbols rather than working around that...
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
thanks
-- PMMIMHO the patch can be applied nevertheless, as it uses a clearer regular expression for characters allowed in macro names (not one that is specific for the current QEMU code).
So, what's the thing here?
I think we concluded that the underlying problem was a bit tricky to fix and we should apply this workaround in the meantime.
thanks
-- PMM