meson: 0.50 regression: Default option c_std not applied when cross-compiling
When providing default_options: ['c_std=c99']
to the project
, it is not being applied on meson build --cross-file <cross-file>
invocation on a simple test project using flexible array members:
ninja -v
[1/2] cc -Itest-executable@exe -I. -I…/…/work -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -g -pedantic -MD -MQ ‘test-executable@exe/main.c.o’ -MF ‘test-executable@exe/main.c.o.d’ -o ‘test-executable@exe/main.c.o’ -c …/…/work/main.c …/…/work/main.c:5:9: warning: ISO C90 does not support flexible array members [-Wpedantic] int array[]; ^ [2/2] cc -o test-executable ‘test-executable@exe/main.c.o’ -Wl,–no-undefined -Wl,–as-needed
However, after doing any kind of (even unrelated) configuration such as meson configure -Db_asneeded=true
, the configuration is being fixed and applies as expected:
ninja -v
[1/2] cc -Itest-executable@exe -I. -I…/…/work -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c99 -g -pedantic -MD -MQ ‘test-executable@exe/main.c.o’ -MF ‘test-executable@exe/main.c.o.d’ -o ‘test-executable@exe/main.c.o’ -c …/…/work/main.c [2/2] cc -o test-executable ‘test-executable@exe/main.c.o’ -Wl,–no-undefined -Wl,–as-needed
Note: I haven’t tested whether this also applies to other default options.
main.c
#include <stdio.h>
struct a {
int foo;
int array[];
};
int main(int argc, char* argv[]) {
printf("Hey!\n");
return 0;
}
meson.build
project('test-project', 'c', version: '0.0.1', default_options: ['c_std=c99'])
add_project_arguments('-pedantic', language: 'c')
executable('test-executable', 'main.c')
cross-file
[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
[properties]
root = '/usr/android-ndk/toolchains/llvm/prebuilt/linux-x86_64'
needs_exe_wrapper = true
[paths]
prefix = '/usr/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot'
[binaries]
c = '/usr/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android28-clang'
cpp = '/usr/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android28-clang++'
ar = '/usr/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android-ar'
as = '/usr/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android-as'
ld = '/usr/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/ld.lld'
strip = '/usr/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android-strip'
pkgconfig = '/usr/bin/pkg-config'
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 15 (13 by maintainers)
Commits related to this issue
- Add workaround for https://github.com/mesonbuild/meson/issues/5097 — committed to rawrtc/ci-image by lgrahl 5 years ago
- Workaround for mesonbuild/meson#5097 Force the use of mesoon 0.49.2 — committed to kiwix/kiwix-build by mgautierfr 5 years ago
- Workaround for mesonbuild/meson#5097 Force the use of mesoon 0.49.2 — committed to kiwix/kiwix-build by mgautierfr 5 years ago
- Workaround for mesonbuild/meson#5097 Force the use of meson 0.49.2 — committed to kiwix/kiwix-build by mgautierfr 5 years ago
- Workaround for mesonbuild/meson#5097 Force the use of meson 0.49.2 — committed to kiwix/kiwix-build by mgautierfr 5 years ago
- Revert "package/meson: bump version to 0.50.0" This reverts commit 114e9dcd28e1001b74689215ec669b8940dc3ea9. Indeed, there is major issue with this version because c_std is not passed anymore when cr... — committed to buildroot/buildroot by ffontaine 5 years ago
- Workaround for mesonbuild/meson#5097 Force the use of meson 0.49.2 — committed to refeed/kiwix-build by mgautierfr 5 years ago
- Add tests for std usage. Closes #5097. — committed to mesonbuild/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. — committed to mesonbuild/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. — committed to Ericson2314/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. — committed to Ericson2314/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. (cherry picked from commit 27ae70dfaaff1298e68df70098acaa96f7ca748a) — committed to Ericson2314/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. — committed to mesonbuild/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. (cherry picked from commit 27ae70dfaaff1298e68df70098acaa96f7ca748a) — committed to Ericson2314/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. (cherry picked from commit 27ae70dfaaff1298e68df70098acaa96f7ca748a) — committed to Ericson2314/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. (cherry picked from commit 27ae70dfaaff1298e68df70098acaa96f7ca748a) — committed to Ericson2314/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. (cherry picked from commit 27ae70dfaaff1298e68df70098acaa96f7ca748a) — committed to Ericson2314/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. (cherry picked from commit 27ae70dfaaff1298e68df70098acaa96f7ca748a) — committed to Ericson2314/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. (cherry picked from commit 27ae70dfaaff1298e68df70098acaa96f7ca748a) — committed to Ericson2314/meson by jpakkane 5 years ago
- Add tests for std usage. Closes #5097. (cherry picked from commit 27ae70dfaaff1298e68df70098acaa96f7ca748a) — committed to Ericson2314/meson by jpakkane 5 years ago
For
c_std
that’s new. Forc_args
andc_link_args
this was also the case in0.49.0
.I’m not sure what
c_args
is supposed to be used for but the correct C standard depends on the code that is compiled. Cross-compiling or not should not have an effect for this.And after doing some testing, I must say that it is very confusing that command line options don’t have any effect.