Skip to contentSkip to conversation

rust: Use libc++ runtime when using clang with llvm runtime

PATCH Superseded Khem Raj 2 participants 3 messages Sep 1, 2022

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 rust: Use libc++ runtime when using clang with llvm runtime

meta-clang has options when it comes to C++ runtime, default is to use gnu runtime, other options are llvm runtime and android runtime. This patch helps when a distro is using llvm runtime for C/C++ runtime. It informs the rust build system about right C++ runtime to configure for when such a setting is used.

---
v2: Rebase now that 1.63 is in

 meta/recipes-devtools/rust/rust.inc | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/rust/rust.inc +2 -0
index 284347dedc..3a7b993ee8 100644
@@ -107,6 +107,8 @@ python do_configure() {
     # [llvm]
     config.add_section("llvm")
     config.set("llvm", "static-libstdcpp", e(False))
+    if "llvm" in (d.getVar('RUNTIME', True) or ""):
+        config.set("llvm", "use-libcxx", e(True))
 
     # [rust]
     config.add_section("rust")
Signature · 1 line
2.37.3
#1 lore raw
Quoted 18 lines · Khem Raj

meta-clang has options when it comes to C++ runtime, default is to use gnu runtime, other options are llvm runtime and android runtime. This patch helps when a distro is using llvm runtime for C/C++ runtime. It informs the rust build system about right C++ runtime to configure for when such a setting is used.

---
v2: Rebase now that 1.63 is in

 meta/recipes-devtools/rust/rust.inc | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/rust/rust.inc +0 -0
index 284347dedc..3a7b993ee8 100644

meta/recipes-devtools/rust/rust.inc python do_configure() { · line 114

Quoted 8 lines
meta/recipes-devtools/rust/rust.inc +2 -0
@@ -107,6 +107,8 @@ python do_configure() {
     # [llvm]
     config.add_section("llvm")
     config.set("llvm", "static-libstdcpp", e(False))
+    if "llvm" in (d.getVar('RUNTIME', True) or ""):
+        config.set("llvm", "use-libcxx", e(True))
 
     # [rust]
     config.add_section("rust")

My concerns about "RUNTIME" as a variable in OE-Core stand. We need to figure out the naming properly for this before it is used here.

Cheers,

Richard

author
#2 lore raw
Quoted 26 lines · Richard Purdie
Quoted 24 lines · Khem Raj

meta-clang has options when it comes to C++ runtime, default is to use gnu runtime, other options are llvm runtime and android runtime. This patch helps when a distro is using llvm runtime for C/C++ runtime. It informs the rust build system about right C++ runtime to configure for when such a setting is used.

---
v2: Rebase now that 1.63 is in

 meta/recipes-devtools/rust/rust.inc | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/rust/rust.inc +2 -0
index 284347dedc..3a7b993ee8 100644
@@ -107,6 +107,8 @@ python do_configure() {
     # [llvm]
     config.add_section("llvm")
     config.set("llvm", "static-libstdcpp", e(False))
+    if "llvm" in (d.getVar('RUNTIME', True) or ""):
+        config.set("llvm", "use-libcxx", e(True))
 
Quoted 6 lines

meta/recipes-devtools/rust/rust.inc python do_configure() { · line 114

Quoted 2 lines
meta/recipes-devtools/rust/rust.inc +0 -0
     # [rust]
     config.add_section("rust")

My concerns about "RUNTIME" as a variable in OE-Core stand. We need to figure out the naming properly for this before it is used here.

Thats fine, do you see any other issue, I have addressed your other feedback. May be we should call it
CL_RUNTIME which stands for compiler-language rumtime or we can call

<lang>_RUNTIME which in this case will be CXX_RUNTIME

Quoted 5 lines

Cheers,

Richard