Repository: mesonbuild/meson

Issue:
KeyError: 'c_args'
**Describe the bug**
Simple Emscripten example can't build due to `KeyError: 'c_args'`

**To Reproduce**
```
project('mint2d', 'c', default_options: ['c_std=c99'])

executable(
   'mint2d', [
      'main.c'
   ]
)
```

```toml
[host_machine]
system = 'linux'
cpu_family = 'x86'
cpu = 'wasm32'
endian = 'little'

[binaries]
c = 'emcc'
ar = 'emar'
```

**Expected behavior**
To not crash

**Crashlog**
```
The Meson build system
Version: 0.53.999
Source dir: /home/matanui159/vscode/mint2d-meson
Build dir: /home/matanui159/vscode/mint2d-meson/bin
Build type: cross build
Project name: mint2d
Project version: undefined
C compiler for the build machine: cc (gcc 9.2.0 "cc (GCC) 9.2.0")
C linker for the build machine: cc GNU ld.bfd 2.33.1
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/mesonbuild/mesonmain.py", line 129, in run
    return options.run_func(options)
  File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 245, in run
    app.generate()
  File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 159, in generate
    self._generate(env)
  File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 176, in _generate
    intr = interpreter.Interpreter(b)
  File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2165, in __init__
    self.parse_project()
  File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 397, in parse_project
    self.evaluate_codeblock(self.ast, end=1)
  File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock
    raise e
  File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 441, in evaluate_statement
    return self.function_call(cur)
  File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 788, in function_call
    return func(node, posargs, kwargs)
  File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 143, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 174, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2846, in func_project
    self.add_languages(proj_langs, True)
  File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2949, in add_languages
    success &= self.add_languages_for(args, required, MachineChoice.HOST)
  File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2967, in add_languages_for
    comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
  File "/usr/lib/python3.8/site-packages/mesonbuild/compilers/c.py", line 64, in sanity_check
    return self.sanity_check_impl(work_dir, environment, 'sanitycheckc.c', code)
  File "/usr/lib/python3.8/site-packages/mesonbuild/compilers/mixins/clike.py", line 220, in sanity_check_impl
    cargs, largs = self._get_basic_compiler_args(environment, mode)
  File "/usr/lib/python3.8/site-packages/mesonbuild/compilers/mixins/clike.py", line 304, in _get_basic_compiler_args
    sys_args = env.coredata.get_external_args(self.for_machine, self.language)
  File "/usr/lib/python3.8/site-packages/mesonbuild/coredata.py", line 626, in get_external_args
    return self.compiler_options[for_machine][lang + '_args'].value
KeyError: 'c_args'
```

**system parameters**
* Cross build with the above cross file
* Manjaro 4.19.88
* Python 3.8.0
* Meson 0.53.999 from git



Discussion:

Resolving patch:
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -946,6 +946,7 @@ def sanitize(p):
 
             if 'Emscripten' in out:
                 cls = EmscriptenCCompiler if lang == 'c' else EmscriptenCPPCompiler
+                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
                 return cls(
                     ccache + compiler, version, for_machine, is_cross, info,
                     exe_wrap, full_version=full_version)
@@ -966,6 +967,7 @@ def sanitize(p):
                 full_version = arm_ver_str
                 cls = ArmclangCCompiler if lang == 'c' else ArmclangCPPCompiler
                 linker = ArmClangDynamicLinker(for_machine, version=version)
+                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
                 return cls(
                     ccache + compiler, version, for_machine, is_cross, info,
                     exe_wrap, full_version=full_version, linker=linker)
@@ -1061,12 +1063,14 @@ def sanitize(p):
                     exe_wrap, full_version=full_version, linker=l)
             if 'ARM' in out:
                 cls = ArmCCompiler if lang == 'c' else ArmCPPCompiler
+                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
                 linker = ArmDynamicLinker(for_machine, version=version)
                 return cls(
                     ccache + compiler, version, for_machine, is_cross,
                     info, exe_wrap, full_version=full_version, linker=linker)
             if 'RX Family' in out:
                 cls = CcrxCCompiler if lang == 'c' else CcrxCPPCompiler
+                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
                 linker = CcrxDynamicLinker(for_machine, version=version)
                 return cls(
                     ccache + compiler, version, for_machine, is_cross, info,
@@ -1405,6 +1409,7 @@ def detect_rust_compiler(self, for_machine):
                                              always_args=always_args, version=cc.linker.version,
                                              **extra_args)
 
+                self.coredata.add_lang_args(RustCompiler.language, RustCompiler, for_machine, self)
                 return RustCompiler(
                     compiler, version, for_machine, is_cross, info, exe_wrap,
                     linker=linker)


Test patch: