mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.55k stars 1.61k forks source link

Meson mangles custom emscripten linker arguments in checks #6097

Open Akaricchi opened 4 years ago

Akaricchi commented 4 years ago

You can not just assume it's safe to re-order and deduplicate parameters. Emscripten accepts lots of settings in the form of -s FOO=spam -s BAR=eggs. If I put that into c_link_args, meson removes the "redundant" second -s and everything breaks.

Akaricchi commented 4 years ago

Here is the offender: https://github.com/mesonbuild/meson/blob/6ac5db50c901f172176b297d087e6123df497062/mesonbuild/compilers/mixins/clike.py#L313-L318

Does having duplicate args actually break anything here? Other build systems don't seem to care.

Note that despite the comment referring to CFLAGS/LDFLAGS, this actually affects the c_args/c_link_args options as well.

Akaricchi commented 4 years ago

The usefulness of this is actually very questionable. In _get_compiler_check_args, everything eventually gets merged into a CompilerArgs instance, which does its own (much saner, but still sketchy) deduplication. The only other place where _get_basic_compiler_args is used is in sanity_check_impl. I don't think it goes through CompilerArgs in that case. Perhaps it should? Does it even matter?