aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorDavid Seifert <soap@gentoo.org>2024-05-08 00:55:06 +0200
committerDylan Baker <dylan@pnwbakers.com>2024-05-07 22:32:35 -0700
commitb6e5683764c5b296a98b67c0a2ec11fbd9f59c71 (patch)
tree07ce23ae9a7f064b156d9223a9c8718063085f0b /mesonbuild
parent89a5bde9d98ecc96bb462872bb2d83ac762ffc08 (diff)
downloadmeson-b6e5683764c5b296a98b67c0a2ec11fbd9f59c71.zip
meson-b6e5683764c5b296a98b67c0a2ec11fbd9f59c71.tar.gz
meson-b6e5683764c5b296a98b67c0a2ec11fbd9f59c71.tar.bz2
cuda: disable thin archives when 'cuda' is enabled globally
Bug: mesonbuild/meson/pull/9453 Bug: mesonbuild/meson/issues/9479#issuecomment-953485040
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index e394c60..28f5d53 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -496,6 +496,19 @@ class NinjaBackend(backends.Backend):
self.rust_crates: T.Dict[str, RustCrate] = {}
self.implicit_meson_outs = []
self._uses_dyndeps = False
+ # nvcc chokes on thin archives:
+ # nvlink fatal : Could not open input file 'libfoo.a.p'
+ # nvlink fatal : elfLink internal error
+ # hence we disable them if 'cuda' is enabled globally. See also
+ # - https://github.com/mesonbuild/meson/pull/9453
+ # - https://github.com/mesonbuild/meson/issues/9479#issuecomment-953485040
+ self._allow_thin_archives = PerMachine[bool](
+ 'cuda' not in self.environment.coredata.compilers.build,
+ 'cuda' not in self.environment.coredata.compilers.host) if self.environment else PerMachine[bool](True, True)
+ if not self._allow_thin_archives.build:
+ mlog.debug('cuda enabled globally, disabling thin archives for build machine, since nvcc/nvlink cannot handle thin archives natively')
+ if not self._allow_thin_archives.host:
+ mlog.debug('cuda enabled globally, disabling thin archives for host machine, since nvcc/nvlink cannot handle thin archives natively')
def create_phony_target(self, dummy_outfile: str, rulename: str, phony_infilename: str) -> NinjaBuildElement:
'''
@@ -3255,7 +3268,8 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
if target.import_filename:
commands += linker.gen_import_library_args(self.get_import_filename(target))
elif isinstance(target, build.StaticLibrary):
- commands += linker.get_std_link_args(self.environment, not target.should_install())
+ produce_thin_archive = self._allow_thin_archives[target.for_machine] and not target.should_install()
+ commands += linker.get_std_link_args(self.environment, produce_thin_archive)
else:
raise RuntimeError('Unknown build target type.')
return commands