aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreter.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-10-30 09:59:07 -0400
committerEli Schwartz <eschwartz93@gmail.com>2022-10-31 20:21:07 -0400
commit81763e610fac24c7a9720fa37630e7660111c4a6 (patch)
tree4f880836699a096afd30e6d0715deaa3c2429aa4 /mesonbuild/interpreter/interpreter.py
parent8d8ce4fb774aacb26d4710627a245781df2a3446 (diff)
downloadmeson-81763e610fac24c7a9720fa37630e7660111c4a6.zip
meson-81763e610fac24c7a9720fa37630e7660111c4a6.tar.gz
meson-81763e610fac24c7a9720fa37630e7660111c4a6.tar.bz2
both_libraries: Make sure to select the right linker for static lib
Regression test: libccpp has both C and C++ sources. The executable only has C sources. It should still link using the C++ compiler. When using both_libraries the static has no sources and thus no compilers, resulting in the executable linking using the C compiler. https://github.com/Netflix/vmaf/issues/1107
Diffstat (limited to 'mesonbuild/interpreter/interpreter.py')
-rw-r--r--mesonbuild/interpreter/interpreter.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 056cc32..0bab57e 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -101,7 +101,6 @@ import typing as T
import textwrap
import importlib
import copy
-import itertools
if T.TYPE_CHECKING:
import argparse
@@ -3093,8 +3092,8 @@ Try setting b_lundef to false instead.'''.format(self.coredata.options[OptionKey
static_lib.sources = []
static_lib.generated = []
# Compilers with no corresponding sources confuses the backend.
- # Keep only the first compiler because it is the linker.
- static_lib.compilers = dict(itertools.islice(static_lib.compilers.items(), 1))
+ # Keep only compilers used for linking
+ static_lib.compilers = {k: v for k, v in static_lib.compilers.items() if k in compilers.clink_langs}
return build.BothLibraries(shared_lib, static_lib)