Package: meson
Version: 0.49.0-1
Severity: important

Please consider the following interaction:

$ dpkg --print-architecture
amd64
$ cat crossfile
[binaries]
c = 'gcc'
ar = 'ar'

[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
$ cat meson.build
#ifndef DEFINED_VIA_CFLAGS
#error CFLAGS are not propagated
#endif
project('example', 'c')
executable('example', ['example.c'])
$ cat example.c
int main() { return 0; }
$ CFLAGS=-DDEFINED_VIA_CFLAGS meson --cross-file crossfile . build
...
Appending CFLAGS from environment: '-DDEFINED_VIA_CFLAGS'
...
$ ninja -v -C build
ninja: Entering directory `build'
[1/2] gcc -Iexample@exe -I. -I.. -fdiagnostics-color=always -pipe 
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -g  -MD -MQ 
'example@exe/example.c.o' -MF 'example@exe/example.c.o.d' -o 
'example@exe/example.c.o' -c ../example.c
FAILED: example@exe/example.c.o 
gcc -Iexample@exe -I. -I.. -fdiagnostics-color=always -pipe 
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -g  -MD -MQ 
'example@exe/example.c.o' -MF 'example@exe/example.c.o.d' -o 
'example@exe/example.c.o' -c ../example.c
../example.c:2:2: error: #error CFLAGS are not propagated
 #error CFLAGS are not propagated
  ^~~~~
ninja: build stopped: subcommand failed.
$

We ask meson to include -DDEFINED_VIA_CFLAGS via the CFLAGS environment
variable and it says that it is appending the flag. However, when
running ninja, we see that the flag goes missing. When dropping the
--cross-file flag, the flag is correctly propagated. I fact, all
environment flags (LDFLAGS, CPPFLAGS, ...) go missing.

Please fix this as soon as possible as it breaks lots of packages and
makes QA next to impossible. Do not wait for the next upstream release.
Fix it now. Please ask me, if you need a sponsor. Please also add the
above test case as an autopkgtest.

Helmut

Reply via email to