]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: Fix cross-building of dtrace probes
authorHelmut Grohne <helmut@subdivi.de>
Mon, 18 Jan 2021 23:08:23 +0000 (00:08 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Tue, 26 Jan 2021 09:59:45 +0000 (10:59 +0100)
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>
meson.build
src/meson.build
src/qemu/meson.build

index d8a63baac9324f084f19c8cc99199febb5040fa4..1c36b10390084f435e2126bee70b803ddc2cbaf8 100644 (file)
@@ -2022,6 +2022,7 @@ if host_machine.system() == 'linux'
   if dtrace_prog.found()
     conf.set('WITH_DTRACE_PROBES', 1)
   endif
+  dtrace_command = [ 'env', 'CC=' + ' '.join(meson.get_compiler('c').cmd_array()), dtrace_prog ]
 endif
 
 if not get_option('host_validate').disabled() and host_machine.system() != 'windows'
index 3aa9498b98a36b6eaf2b0863d374625528b6a475..74d932a32c0f9f153f2526a91386c84c62a80933 100644 (file)
@@ -60,14 +60,14 @@ if conf.has('WITH_DTRACE_PROBES')
     out_h,
     input: infile,
     output: out_h,
-    command: [ dtrace_prog, '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ],
+    command: dtrace_command + [ '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ],
   )
 
   dtrace_gen_objects += custom_target(
     out_o,
     input: infile,
     output: out_o,
-    command: [ dtrace_prog, '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ],
+    command: dtrace_command + [ '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ],
   )
 
   custom_target(
index 7ab591d040adcdb142ce7b480565e9ec06dd6c4c..08c1d20087da3a3cffab97ec16c582c7b3395c03 100644 (file)
@@ -56,14 +56,14 @@ if conf.has('WITH_DTRACE_PROBES')
     out_h,
     input: infile,
     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(
     out_o,
     input: infile,
     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(