aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorDavid Seifert <soap@gentoo.org>2022-07-06 21:18:08 +0200
committerDylan Baker <dylan@pnwbakers.com>2022-07-06 14:33:58 -0700
commit11f76c2fc732dd4d827329d088d0e6587ef3ce12 (patch)
tree62f5dcccd3a692317f43e3d4886d0ddaaf7ab5f4 /mesonbuild/build.py
parent15078112f9a04915d702d7a07018589cccdccf20 (diff)
downloadmeson-11f76c2fc732dd4d827329d088d0e6587ef3ce12.zip
meson-11f76c2fc732dd4d827329d088d0e6587ef3ce12.tar.gz
meson-11f76c2fc732dd4d827329d088d0e6587ef3ce12.tar.bz2
cuda: don't inject `-lstdc++` when linking
Fixes: #10570
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 8655507..98e3c93 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1586,6 +1586,15 @@ You probably should put it in link_with instead.''')
# 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:
@@ -1598,7 +1607,7 @@ You probably should put it in link_with instead.''')
'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