All of lore.kernel.org
 help / color / mirror / Atom feed
* rust: why is it built in do_install()
@ 2023-09-01 16:34 Enrico Scholz
  2023-09-01 17:37 ` [OE-core] " Frédéric Martinsons
  2023-09-01 21:22 ` Richard Purdie
  0 siblings, 2 replies; 6+ messages in thread
From: Enrico Scholz @ 2023-09-01 16:34 UTC (permalink / raw)
  To: openembedded-core

Hello,

rust recipe does

| do_compile () {
| }
|  
| rust_do_install() {
|     rust_runx install
| }
| 
| rust_do_install:class-nativesdk() {
|     export PSEUDO_UNLOAD=1
|     rust_runx install
|     rust_runx install clippy
|     rust_runx install rustfmt


What is the reason to run the expensive "rust_runx" in do_install() and
not in do_compile().

This:

- is unexpected... do_install is usually expected to run fast

- might interfere with different ${PARALLEL_MAKE} and ${PARALLEL_MAKEINST}
  setup

- might slow down the build process because the 'class-native' variant
  seems to run with active 'pseudo'


I guess it is done in this way because of

|    config.set("install", "prefix",  e(d.getVar("D") + d.getVar("prefix")))

where '${D}' is cleared by do_install.


Wouldn't it be better to replace this by

|    config.set("install", "prefix",  e(d.getVar("B") + '/_install' + d.getVar("prefix")))


| do_compile () {
|     rust_runx install
|     rust_runx install clippy
|     rust_runx install rustfmt
| }
|
| rust_do_install() {
|     cp -a ${B}/_install ${D}

?


[adding 'rustfmt' to 'class-native' would be nice because e.g. 'bindgen'
 users might expect it]



Enrico


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

* Re: [OE-core] rust: why is it built in do_install()
  2023-09-01 16:34 rust: why is it built in do_install() Enrico Scholz
@ 2023-09-01 17:37 ` Frédéric Martinsons
  2023-09-01 21:22 ` Richard Purdie
  1 sibling, 0 replies; 6+ messages in thread
From: Frédéric Martinsons @ 2023-09-01 17:37 UTC (permalink / raw)
  To: Enrico Scholz; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 2211 bytes --]

Hello Enrico,

Le ven. 1 sept. 2023, 18:34, Enrico Scholz via lists.openembedded.org
<enrico.scholz=sigma-chemnitz.de@lists.openembedded.org> a écrit :

> Hello,
>
> rust recipe does
>
> | do_compile () {
> | }
> |
> | rust_do_install() {
> |     rust_runx install
> | }
> |
> | rust_do_install:class-nativesdk() {
> |     export PSEUDO_UNLOAD=1
> |     rust_runx install
> |     rust_runx install clippy
> |     rust_runx install rustfmt
>
>
> What is the reason to run the expensive "rust_runx" in do_install() and
> not in do_compile().
>
> This:
>
> - is unexpected... do_install is usually expected to run fast
>
> - might interfere with different ${PARALLEL_MAKE} and ${PARALLEL_MAKEINST}
>   setup
>
> - might slow down the build process because the 'class-native' variant
>   seems to run with active 'pseudo'
>
>
> I guess it is done in this way because of
>
> |    config.set("install", "prefix",  e(d.getVar("D") +
> d.getVar("prefix")))
>
> where '${D}' is cleared by do_install.
>
>
> Wouldn't it be better to replace this by
>
> |    config.set("install", "prefix",  e(d.getVar("B") + '/_install' +
> d.getVar("prefix")))
>
>
> | do_compile () {
> |     rust_runx install
> |     rust_runx install clippy
> |     rust_runx install rustfmt
> | }
> |
> | rust_do_install() {
> |     cp -a ${B}/_install ${D}
>
> ?
>
>
> [adding 'rustfmt' to 'class-native' would be nice because e.g. 'bindgen'
>  users might expect it]
>
>
I don't know why this was done that way and I lacked xp for telling you if
your suggestion is correct. But I just wanna tell that the
do_install:rust-native is very long (more than 45mn on my machine) so you
may have a point here.

Enrico
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#187012):
> https://lists.openembedded.org/g/openembedded-core/message/187012
> Mute This Topic: https://lists.openembedded.org/mt/101098826/6213388
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> frederic.martinsons@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

[-- Attachment #2: Type: text/html, Size: 3657 bytes --]

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

* Re: [OE-core] rust: why is it built in do_install()
  2023-09-01 16:34 rust: why is it built in do_install() Enrico Scholz
  2023-09-01 17:37 ` [OE-core] " Frédéric Martinsons
@ 2023-09-01 21:22 ` Richard Purdie
  2023-09-02  5:09   ` Alexander Kanavin
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2023-09-01 21:22 UTC (permalink / raw)
  To: enrico.scholz, openembedded-core

On Fri, 2023-09-01 at 18:34 +0200, Enrico Scholz via
lists.openembedded.org wrote:
> Hello,
> 
> rust recipe does
> 
> > do_compile () {
> > }
> >  
> > rust_do_install() {
> >     rust_runx install
> > }
> > 
> > rust_do_install:class-nativesdk() {
> >     export PSEUDO_UNLOAD=1
> >     rust_runx install
> >     rust_runx install clippy
> >     rust_runx install rustfmt
> 
> 
> What is the reason to run the expensive "rust_runx" in do_install() and
> not in do_compile().

The reason was probably that was what was found to work in the original
recipe and nobody has had the time/need to improve it.

> This:
> 
> - is unexpected... do_install is usually expected to run fast
> 
> - might interfere with different ${PARALLEL_MAKE} and ${PARALLEL_MAKEINST}
>   setup
> 
> - might slow down the build process because the 'class-native' variant
>   seems to run with active 'pseudo'
> 
> 
> I guess it is done in this way because of
> 
> >    config.set("install", "prefix",  e(d.getVar("D") + d.getVar("prefix")))
> 
> where '${D}' is cleared by do_install.

That would seem likely to be at least one reason.

> Wouldn't it be better to replace this by
> 
> >    config.set("install", "prefix",  e(d.getVar("B") + '/_install' + d.getVar("prefix")))
> 
> 
> > do_compile () {
> >     rust_runx install
> >     rust_runx install clippy
> >     rust_runx install rustfmt
> > }
> > 
> > rust_do_install() {
> >     cp -a ${B}/_install ${D}
> 
> ?
> 
> 
> [adding 'rustfmt' to 'class-native' would be nice because e.g. 'bindgen'
>  users might expect it]

One potential downside is that "install" would then run outside pseudo
context which may cause problems with permissions. I don't really know
whether that would be an issue or not though in reality.

I'd be happy to see more people working on the rust recipes. The
challenge is the long testing cycles needed. Fancy working on some
patches?

Cheers,

Richard







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

* Re: [OE-core] rust: why is it built in do_install()
  2023-09-01 21:22 ` Richard Purdie
@ 2023-09-02  5:09   ` Alexander Kanavin
  2023-09-02  9:22     ` Enrico Scholz
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Kanavin @ 2023-09-02  5:09 UTC (permalink / raw)
  To: Richard Purdie; +Cc: enrico.scholz, openembedded-core

On Fri, 1 Sept 2023 at 23:22, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> > > do_compile () {
> > >     rust_runx install
> > >     rust_runx install clippy
> > >     rust_runx install rustfmt
> > > }
> > >
> > > rust_do_install() {
> > >     cp -a ${B}/_install ${D}
> >
> > ?
> >
> >
> > [adding 'rustfmt' to 'class-native' would be nice because e.g. 'bindgen'
> >  users might expect it]
>
> One potential downside is that "install" would then run outside pseudo
> context which may cause problems with permissions. I don't really know
> whether that would be an issue or not though in reality.
>
> I'd be happy to see more people working on the rust recipes. The
> challenge is the long testing cycles needed. Fancy working on some
> patches?

The original recipes in meta-rust and oe-core recipes had for a while
separate compile/install steps. At some point this regressed on a
version update - install on top of compile became broken and errored
out, but pristine install (with compile inside of it) continued to
work. This is what upstream tests and documents, so that's how rust
recipe does it as well nowadays. It's not any slower than separate
steps, actually it's somewhat faster, as install was rebuilding
supplementary things unnecessarily after compile has already done
that. The only problem I see is that it's indeed visually confusing.

If somene wants to separate the steps again, they can simply find the
commit in oe-core history and undo that. Any changes would have to
fulfil this:
1. Rust's installation procedure should run under pseudo, e.g. in
do_install. Even if it's not a problem now, it might become a problem
later.
2. The changes can't lengthen build times. Rust is already one of the
slowest items in core.
3. This probably requires fixing things in rust upstream, w.r.t.
supporting separation of build/install, and install using artefacts
from the build step properly.

Alex


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

* Re: [OE-core] rust: why is it built in do_install()
  2023-09-02  5:09   ` Alexander Kanavin
@ 2023-09-02  9:22     ` Enrico Scholz
  2023-09-02  9:49       ` Richard Purdie
  0 siblings, 1 reply; 6+ messages in thread
From: Enrico Scholz @ 2023-09-02  9:22 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: Richard Purdie, openembedded-core

Alexander Kanavin <alex.kanavin@gmail.com> writes:

> Any changes would have to fulfil this:
>
> 1. Rust's installation procedure should run under pseudo, e.g. in
> do_install.

The current recipe does *not* run installation under pseudo

| rust_do_install:class-target() {
|     export PSEUDO_UNLOAD=1
|     rust_runx install

Only class-native runs under pseudo (or is pseudo automatically disabled
for this class?).


Enrico


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

* Re: [OE-core] rust: why is it built in do_install()
  2023-09-02  9:22     ` Enrico Scholz
@ 2023-09-02  9:49       ` Richard Purdie
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2023-09-02  9:49 UTC (permalink / raw)
  To: Enrico Scholz, Alexander Kanavin; +Cc: openembedded-core

On Sat, 2023-09-02 at 11:22 +0200, Enrico Scholz wrote:
> Alexander Kanavin <alex.kanavin@gmail.com> writes:
> 
> > Any changes would have to fulfil this:
> > 
> > 1. Rust's installation procedure should run under pseudo, e.g. in
> > do_install.
> 
> The current recipe does *not* run installation under pseudo
> 
> > rust_do_install:class-target() {
> >     export PSEUDO_UNLOAD=1
> >     rust_runx install
> 
> Only class-native runs under pseudo (or is pseudo automatically disabled
> for this class?).

pseudo is disabled for native.

Cheers,

Richard


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

end of thread, other threads:[~2023-09-02  9:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-01 16:34 rust: why is it built in do_install() Enrico Scholz
2023-09-01 17:37 ` [OE-core] " Frédéric Martinsons
2023-09-01 21:22 ` Richard Purdie
2023-09-02  5:09   ` Alexander Kanavin
2023-09-02  9:22     ` Enrico Scholz
2023-09-02  9:49       ` Richard Purdie

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.