Skip to content

Commit

Permalink
cuda: don't inject -lstdc++ when linking
Browse files Browse the repository at this point in the history
Fixes: #10570
  • Loading branch information
SoapGentoo authored and nirbheek committed Aug 8, 2022
1 parent 9c6dab2 commit 738030e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion mesonbuild/build.py
Expand Up @@ -1585,6 +1585,15 @@ def get_clink_dynamic_linker_and_stdlibs(self) -> T.Tuple['Compiler', T.List[str

# Languages used by dependencies
dep_langs = self.get_langs_used_by_deps()

# This set contains all the languages a linker can link natively
# without extra flags. For instance, nvcc (cuda) can link C++
# without injecting -lc++/-lstdc++, see
# https://github.com/mesonbuild/meson/issues/10570
MASK_LANGS = frozenset([
# (language, linker)
('cpp', 'cuda'),
])
# Pick a compiler based on the language priority-order
for l in clink_langs:
if l in self.compilers or l in dep_langs:
Expand All @@ -1597,7 +1606,7 @@ def get_clink_dynamic_linker_and_stdlibs(self) -> T.Tuple['Compiler', T.List[str
'a project language.')
stdlib_args: T.List[str] = []
for dl in itertools.chain(self.compilers, dep_langs):
if dl != linker.language:
if dl != linker.language and (dl, linker.language) not in MASK_LANGS:
stdlib_args += all_compilers[dl].language_stdlib_only_link_flags(self.environment)
# Type of var 'linker' is Compiler.
# Pretty hard to fix because the return value is passed everywhere
Expand Down

0 comments on commit 738030e

Please sign in to comment.