All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rust: Use libc++ runtime when using clang with llvm runtime
@ 2022-08-22 21:10 Khem Raj
  2022-08-22 21:51 ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2022-08-22 21:10 UTC (permalink / raw)
  To: openembedded-core; +Cc: 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.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/rust/rust.inc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc
index 284347dedc..c288903c9b 100644
--- a/meta/recipes-devtools/rust/rust.inc
+++ b/meta/recipes-devtools/rust/rust.inc
@@ -73,6 +73,7 @@ python do_configure() {
 
     # [target.ARCH-poky-linux]
     host_section = "target.{}".format(d.getVar('RUST_HOST_SYS', True))
+    runtime = "target.{}".format(d.getVar('RUNTIME', True))
     config.add_section(host_section)
 
     llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}")
@@ -107,6 +108,8 @@ python do_configure() {
     # [llvm]
     config.add_section("llvm")
     config.set("llvm", "static-libstdcpp", e(False))
+    if "llvm" in runtime:
+        config.set("llvm", "use-libcxx", e(True))
 
     # [rust]
     config.add_section("rust")
-- 
2.37.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] rust: Use libc++ runtime when using clang with llvm runtime
  2022-08-22 21:10 [PATCH] rust: Use libc++ runtime when using clang with llvm runtime Khem Raj
@ 2022-08-22 21:51 ` Richard Purdie
  2022-08-22 22:23   ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2022-08-22 21:51 UTC (permalink / raw)
  To: Khem Raj, openembedded-core

On Mon, 2022-08-22 at 14:10 -0700, Khem Raj wrote:
> 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.
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-devtools/rust/rust.inc | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc
> index 284347dedc..c288903c9b 100644
> --- a/meta/recipes-devtools/rust/rust.inc
> +++ b/meta/recipes-devtools/rust/rust.inc
> @@ -73,6 +73,7 @@ python do_configure() {
>  
>      # [target.ARCH-poky-linux]
>      host_section = "target.{}".format(d.getVar('RUST_HOST_SYS', True))
> +    runtime = "target.{}".format(d.getVar('RUNTIME', True))
>      config.add_section(host_section)
>  
>      llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}")
> @@ -107,6 +108,8 @@ python do_configure() {
>      # [llvm]
>      config.add_section("llvm")
>      config.set("llvm", "static-libstdcpp", e(False))
> +    if "llvm" in runtime:
> +        config.set("llvm", "use-libcxx", e(True))
>  

I think it is a little bit over complicated, couldn't it just be:

if "llvm" in (d.getVar('RUNTIME', True) or ""):
    config.set("llvm", "use-libcxx", e(True))

I'd much rather we did some kind of indirection via a variable too
since I'm not sure OE-Core knows anything about RUNTIME, or that
RUNTIME is a particularly good choice of name for the core.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] rust: Use libc++ runtime when using clang with llvm runtime
  2022-08-22 21:51 ` [OE-core] " Richard Purdie
@ 2022-08-22 22:23   ` Khem Raj
  0 siblings, 0 replies; 3+ messages in thread
From: Khem Raj @ 2022-08-22 22:23 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core

On Mon, Aug 22, 2022 at 2:51 PM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Mon, 2022-08-22 at 14:10 -0700, Khem Raj wrote:
> > 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.
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  meta/recipes-devtools/rust/rust.inc | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc
> > index 284347dedc..c288903c9b 100644
> > --- a/meta/recipes-devtools/rust/rust.inc
> > +++ b/meta/recipes-devtools/rust/rust.inc
> > @@ -73,6 +73,7 @@ python do_configure() {
> >
> >      # [target.ARCH-poky-linux]
> >      host_section = "target.{}".format(d.getVar('RUST_HOST_SYS', True))
> > +    runtime = "target.{}".format(d.getVar('RUNTIME', True))
> >      config.add_section(host_section)
> >
> >      llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}")
> > @@ -107,6 +108,8 @@ python do_configure() {
> >      # [llvm]
> >      config.add_section("llvm")
> >      config.set("llvm", "static-libstdcpp", e(False))
> > +    if "llvm" in runtime:
> > +        config.set("llvm", "use-libcxx", e(True))
> >
>
> I think it is a little bit over complicated, couldn't it just be:
>
> if "llvm" in (d.getVar('RUNTIME', True) or ""):
>     config.set("llvm", "use-libcxx", e(True))
>

OK. I have pushed this into yoe/mut on contrib and testing it. I think
it will work ok.

> I'd much rather we did some kind of indirection via a variable too
> since I'm not sure OE-Core knows anything about RUNTIME, or that
> RUNTIME is a particularly good choice of name for the core.
>

Thats fine, I am not vested in name as much, although it might be used in
other places too by now. but if we were to have a convention in
OE-core which is different
thats one time bullet to bite.
I think we have few bugs open in bugzilla

https://bugzilla.yoctoproject.org/show_bug.cgi?id=11528
https://bugzilla.yoctoproject.org/show_bug.cgi?id=9417

which attempt to bring various portions of toolchain options into
core. We have been
postponing it for quite a while. if we want to consider it something
for next LTS, this
would be right time to start.

> Cheers,
>
> Richard


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-22 22:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-22 21:10 [PATCH] rust: Use libc++ runtime when using clang with llvm runtime Khem Raj
2022-08-22 21:51 ` [OE-core] " Richard Purdie
2022-08-22 22:23   ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.