summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/rust.py
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-12-15 19:06:13 +0100
committerDylan Baker <dylan@pnwbakers.com>2024-01-17 13:36:15 -0800
commit1ca2c74d16c3f5987f686e358b58ce5d2253ce9b (patch)
tree7d0c2ab046ac34f69c0c7b93eacf3099f62013d7 /mesonbuild/compilers/rust.py
parentbd3f1b2e0e70ef16dfa4f441686003212440a09b (diff)
downloadmeson-1ca2c74d16c3f5987f686e358b58ce5d2253ce9b.tar.gz
rust: fix linking static executables
For the same reason as for static libraries, we have to use -l when generating static executables. Fixes: https://github.com/mesonbuild/meson/issues/12585
Diffstat (limited to 'mesonbuild/compilers/rust.py')
-rw-r--r--mesonbuild/compilers/rust.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py
index e10cb4cf3..89b913a58 100644
--- a/mesonbuild/compilers/rust.py
+++ b/mesonbuild/compilers/rust.py
@@ -3,6 +3,7 @@
from __future__ import annotations
+import functools
import subprocess, os.path
import textwrap
import re
@@ -118,6 +119,12 @@ class RustCompiler(Compiler):
p, stdo, stde = Popen_safe_logged(cmd)
return stdo.split('\n', maxsplit=1)[0]
+ @functools.lru_cache(maxsize=None)
+ def get_crt_static(self) -> bool:
+ cmd = self.get_exelist(ccache=False) + ['--print', 'cfg']
+ p, stdo, stde = Popen_safe_logged(cmd)
+ return bool(re.search('^target_feature="crt-static"$', stdo, re.MULTILINE))
+
def get_debug_args(self, is_debug: bool) -> T.List[str]:
return clike_debug_args[is_debug]