meson: Fix cross-building of dtrace probes

dtrace invokes the C compiler, so when cross-building we need
to make sure that $CC is set in the environment and that it
points to the cross-compiler rather than the native one.

Until https://github.com/mesonbuild/meson/issues/266
is addressed, the workaround is to call dtrace via env(1).

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980334

Signed-off-by: Helmut Grohne <helmut@subdivi.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Helmut Grohne 2021-01-19 00:08:23 +01:00 committed by Andrea Bolognani
parent 5b1c525b1f
commit 44b348134c
3 changed files with 5 additions and 4 deletions

View File

@ -2022,6 +2022,7 @@ if host_machine.system() == 'linux'
if dtrace_prog.found() if dtrace_prog.found()
conf.set('WITH_DTRACE_PROBES', 1) conf.set('WITH_DTRACE_PROBES', 1)
endif endif
dtrace_command = [ 'env', 'CC=' + ' '.join(meson.get_compiler('c').cmd_array()), dtrace_prog ]
endif endif
if not get_option('host_validate').disabled() and host_machine.system() != 'windows' if not get_option('host_validate').disabled() and host_machine.system() != 'windows'

View File

@ -60,14 +60,14 @@ if conf.has('WITH_DTRACE_PROBES')
out_h, out_h,
input: infile, input: infile,
output: out_h, output: out_h,
command: [ dtrace_prog, '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ], command: dtrace_command + [ '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ],
) )
dtrace_gen_objects += custom_target( dtrace_gen_objects += custom_target(
out_o, out_o,
input: infile, input: infile,
output: out_o, output: out_o,
command: [ dtrace_prog, '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ], command: dtrace_command + [ '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ],
) )
custom_target( custom_target(

View File

@ -56,14 +56,14 @@ if conf.has('WITH_DTRACE_PROBES')
out_h, out_h,
input: infile, input: infile,
output: out_h, output: out_h,
command: [ dtrace_prog, '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ], command: dtrace_command + [ '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ],
) )
qemu_dtrace_gen_objects += custom_target( qemu_dtrace_gen_objects += custom_target(
out_o, out_o,
input: infile, input: infile,
output: out_o, output: out_o,
command: [ dtrace_prog, '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ], command: dtrace_command + [ '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ],
) )
qemu_dtrace_gen_stp = custom_target( qemu_dtrace_gen_stp = custom_target(