I need help with this thing. Now it works like this:
make -j9
ninja: error: '/work/src/qemu/up/up-trace-qmp-commands/build/qapi/qapi-commands-authz.trace-events', needed by 'trace/trace-events-all', missing and no known rule to make it
make[1]: *** [Makefile:162: run-ninja] Error 1
make[1]: Leaving directory '/work/src/qemu/up/up-trace-qmp-commands/build'
make: *** [GNUmakefile:11: all] Error 2
OK, let's try to make it by hand:
make qapi/qapi-commands-authz.trace-events
changing dir to build for make "qapi/qapi-commands-authz.trace-events"...
make[1]: Entering directory '/work/src/qemu/up/up-trace-qmp-commands/build'
GIT ui/keycodemapdb meson tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc capstone slirp
[1/1] Generating shared QAPI source files with a custom command
make[1]: Leaving directory '/work/src/qemu/up/up-trace-qmp-commands/build'
It works! So meson doesn't understand that absolute path is the same
as relative.. But I failed to make it the correct way :(
And after it, just run "make" again and it build the whole project.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
meson.build | 1 +
qapi/meson.build | 4 +++-
trace/meson.build | 10 +++++++---
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/meson.build b/meson.build
index f45ecf31bd..20d32fd20d 100644
--- a/meson.build
+++ b/meson.build
@@ -38,6 +38,7 @@ qemu_icondir = get_option('datadir') / 'icons'
config_host_data = configuration_data()
genh = []
+qapi_trace_events = []
target_dirs = config_host['TARGET_DIRS'].split()
have_linux_user = false
diff --git a/qapi/meson.build b/qapi/meson.build
index c0c49c15e4..333ca60583 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -114,7 +114,9 @@ foreach module : qapi_all_modules
'qapi-events-@0@.h'.format(module),
'qapi-commands-@0@.c'.format(module),
'qapi-commands-@0@.h'.format(module),
+ 'qapi-commands-@0@.trace-events'.format(module),
]
+ qapi_trace_events += ['qapi-commands-@0@.trace-events'.format(module)]
endif
if module.endswith('-target')
qapi_specific_outputs += qapi_module_outputs
@@ -126,7 +128,7 @@ endforeach
qapi_files = custom_target('shared QAPI source files',
output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs,
input: [ files('qapi-schema.json') ],
- command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ],
+ command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@', '--add-trace-points' ],
depend_files: [ qapi_inputs, qapi_gen_depends ])
# Now go through all the outputs and add them to the right sourceset.
diff --git a/trace/meson.build b/trace/meson.build
index 573dd699c6..77e44fa68d 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -2,10 +2,14 @@
specific_ss.add(files('control-target.c'))
trace_events_files = []
-foreach dir : [ '.' ] + trace_events_subdirs
- trace_events_file = meson.project_source_root() / dir / 'trace-events'
+foreach path : [ '.' ] + trace_events_subdirs + qapi_trace_events
+ if path.contains('trace-events')
+ trace_events_file = meson.project_build_root() / 'qapi' / path
+ else
+ trace_events_file = meson.project_source_root() / path / 'trace-events'
+ endif
trace_events_files += [ trace_events_file ]
- group_name = dir == '.' ? 'root' : dir.underscorify()
+ group_name = path == '.' ? 'root' : path.underscorify()
group = '--group=' + group_name
fmt = '@0@-' + group_name + '.@1@'
--
2.31.1
Il mar 21 dic 2021, 20:35 Vladimir Sementsov-Ogievskiy <
vsementsov@virtuozzo.com> ha scritto:
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -2,10 +2,14 @@
specific_ss.add(files('control-target.c'))
trace_events_files = []
-foreach dir : [ '.' ] + trace_events_subdirs
- trace_events_file = meson.project_source_root() / dir / 'trace-events'
+foreach path : [ '.' ] + trace_events_subdirs + qapi_trace_events
+ if path.contains('trace-events')
+ trace_events_file = meson.project_build_root() / 'qapi' / path
Just using "trace_events_file = 'qapi' / path" might work, since the build
is nonrecursive.
If it doesn't, use the custom target object, possibly indexing it as
ct[index]. You can use a dictionary to store the custom targets and find
them from the "path" variable.
Paolo
>
>
23.12.2021 01:11, Paolo Bonzini wrote:
> Il mar 21 dic 2021, 20:35 Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com <mailto:vsementsov@virtuozzo.com>> ha scritto:
>
> --- a/trace/meson.build
> +++ b/trace/meson.build
> @@ -2,10 +2,14 @@
> specific_ss.add(files('control-target.c'))
>
> trace_events_files = []
> -foreach dir : [ '.' ] + trace_events_subdirs
> - trace_events_file = meson.project_source_root() / dir / 'trace-events'
> +foreach path : [ '.' ] + trace_events_subdirs + qapi_trace_events
> + if path.contains('trace-events')
> + trace_events_file = meson.project_build_root() / 'qapi' / path
>
>
>
> Just using "trace_events_file = 'qapi' / path" might work, since the build is nonrecursive.
This say:
ninja: error: '../trace/qapi/qapi-commands-authz.trace-events', needed by 'trace/trace-events-all', missing and no known rule to make it
make[1]: *** [Makefile:162: run-ninja] Error 1
make[1]: Leaving directory '/work/src/qemu/up/up-trace-qmp-commands/build'
make: *** [GNUmakefile:11: all] Error 2
so, it consider the path relative to current "trace" directory.
>
> If it doesn't, use the custom target object, possibly indexing it as ct[index]. You can use a dictionary to store the custom targets and find them from the "path" variable.
>
O! Great thanks! Magic. The following hack works:
diff --git a/meson.build b/meson.build
index 20d32fd20d..c42a76a14c 100644
--- a/meson.build
+++ b/meson.build
@@ -39,6 +39,7 @@ qemu_icondir = get_option('datadir') / 'icons'
config_host_data = configuration_data()
genh = []
qapi_trace_events = []
+qapi_trace_events_targets = {}
target_dirs = config_host['TARGET_DIRS'].split()
have_linux_user = false
diff --git a/qapi/meson.build b/qapi/meson.build
index 333ca60583..d4de04459d 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -139,6 +139,9 @@ foreach output : qapi_util_outputs
if output.endswith('.h')
genh += qapi_files[i]
endif
+ if output.endswith('.trace-events')
+ qapi_trace_events_targets += {output: qapi_files[i]}
+ endif
util_ss.add(qapi_files[i])
i = i + 1
endforeach
@@ -147,6 +150,9 @@ foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
if output.endswith('.h')
genh += qapi_files[i]
endif
+ if output.endswith('.trace-events')
+ qapi_trace_events_targets += {output: qapi_files[i]}
+ endif
specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i])
i = i + 1
endforeach
diff --git a/trace/meson.build b/trace/meson.build
index 77e44fa68d..daa24c3a2d 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -4,7 +4,7 @@ specific_ss.add(files('control-target.c'))
trace_events_files = []
foreach path : [ '.' ] + trace_events_subdirs + qapi_trace_events
if path.contains('trace-events')
- trace_events_file = meson.project_build_root() / 'qapi' / path
+ trace_events_file = qapi_trace_events_targets[path]
else
trace_events_file = meson.project_source_root() / path / 'trace-events'
endif
--
Best regards,
Vladimir
23.12.2021 12:33, Vladimir Sementsov-Ogievskiy wrote:
> 23.12.2021 01:11, Paolo Bonzini wrote:
>> Il mar 21 dic 2021, 20:35 Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com <mailto:vsementsov@virtuozzo.com>> ha scritto:
>>
>> --- a/trace/meson.build
>> +++ b/trace/meson.build
>> @@ -2,10 +2,14 @@
>> specific_ss.add(files('control-target.c'))
>>
>> trace_events_files = []
>> -foreach dir : [ '.' ] + trace_events_subdirs
>> - trace_events_file = meson.project_source_root() / dir / 'trace-events'
>> +foreach path : [ '.' ] + trace_events_subdirs + qapi_trace_events
>> + if path.contains('trace-events')
>> + trace_events_file = meson.project_build_root() / 'qapi' / path
>>
>>
>>
>> Just using "trace_events_file = 'qapi' / path" might work, since the build is nonrecursive.
>
> This say:
>
> ninja: error: '../trace/qapi/qapi-commands-authz.trace-events', needed by 'trace/trace-events-all', missing and no known rule to make it
> make[1]: *** [Makefile:162: run-ninja] Error 1
> make[1]: Leaving directory '/work/src/qemu/up/up-trace-qmp-commands/build'
> make: *** [GNUmakefile:11: all] Error 2
>
>
> so, it consider the path relative to current "trace" directory.
>
>>
>> If it doesn't, use the custom target object, possibly indexing it as ct[index]. You can use a dictionary to store the custom targets and find them from the "path" variable.
>>
>
> O! Great thanks! Magic. The following hack works:
>
> diff --git a/meson.build b/meson.build
> index 20d32fd20d..c42a76a14c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -39,6 +39,7 @@ qemu_icondir = get_option('datadir') / 'icons'
> config_host_data = configuration_data()
> genh = []
> qapi_trace_events = []
> +qapi_trace_events_targets = {}
>
> target_dirs = config_host['TARGET_DIRS'].split()
> have_linux_user = false
> diff --git a/qapi/meson.build b/qapi/meson.build
> index 333ca60583..d4de04459d 100644
> --- a/qapi/meson.build
> +++ b/qapi/meson.build
> @@ -139,6 +139,9 @@ foreach output : qapi_util_outputs
> if output.endswith('.h')
> genh += qapi_files[i]
> endif
> + if output.endswith('.trace-events')
> + qapi_trace_events_targets += {output: qapi_files[i]}
> + endif
> util_ss.add(qapi_files[i])
> i = i + 1
> endforeach
> @@ -147,6 +150,9 @@ foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
> if output.endswith('.h')
> genh += qapi_files[i]
> endif
> + if output.endswith('.trace-events')
> + qapi_trace_events_targets += {output: qapi_files[i]}
> + endif
> specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i])
> i = i + 1
> endforeach
> diff --git a/trace/meson.build b/trace/meson.build
> index 77e44fa68d..daa24c3a2d 100644
> --- a/trace/meson.build
> +++ b/trace/meson.build
> @@ -4,7 +4,7 @@ specific_ss.add(files('control-target.c'))
> trace_events_files = []
> foreach path : [ '.' ] + trace_events_subdirs + qapi_trace_events
> if path.contains('trace-events')
> - trace_events_file = meson.project_build_root() / 'qapi' / path
> + trace_events_file = qapi_trace_events_targets[path]
> else
> trace_events_file = meson.project_source_root() / path / 'trace-events'
> endif
>
>
>
Or even simpler, I can use a list combined from needed qapi_files[] elements. So, the solution is to use custom target objects or their indexed subobjects instead of raw paths. This way Meson resolves dependencies better.
--
Best regards,
Vladimir
© 2016 - 2026 Red Hat, Inc.