[Buildroot] [PATCH 1/2] package/pkg-cargo.mk: fix handling of runtime debug builds

Moritz Bitsch moritz at h6t.eu
Fri Oct 21 21:04:07 UTC 2022


Am 21.10.22 um 18:41 schrieb James Hilliard:
> On Fri, Oct 21, 2022 at 2:48 AM Moritz Bitsch <moritz at h6t.eu> wrote:
>>
>> Am 20.10.22 um 00:12 schrieb James Hilliard:
>>
>>> On Wed, Oct 19, 2022 at 6:02 PM Moritz Bitsch via buildroot
>>> <buildroot at buildroot.org> wrote:
>>>> From: Moritz Bitsch <moritz at h6t.eu>
>>>>
>>>> The cargo --release flag is used to create optimized builds, not supplying
>>>> --release has major performance implications.
>>> Is there an env variable we can use to set this instead?
>>>
>>> Some packages use cargo without the cargo infrastructure, for example
>>> we have a number of pyo3(https://pyo3.rs/) based packages that use the
>>> cargo env but not the cargo build commands from here.
>> I could not find any env variable for switching profiles.
>>
>> I had a look at python-rtoml, and the used setuptools-rust: supplying
>> --debug to
>> the "setup.py build" removes the --release flag from the cargo invocation.
> 
> Hmm, there are two pyo3 build backends, only setuptools-rust uses setup.py,
> we also have maturin which is pep517 based.

I'm in no way a a python expert, so take my words with a grain of salt.

I could not find a way to specify what build profile is used by maturin 
when in a pep517 build. Even if maturin supports the -r flag for release 
builds when called directly.

> 
>>>> Signed-off-by: Moritz Bitsch <moritz at h6t.eu>
>>>> ---
>>>>    package/pkg-cargo.mk | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
>>>> index f7e3f39503..e0556252fa 100644
>>>> --- a/package/pkg-cargo.mk
>>>> +++ b/package/pkg-cargo.mk
>>>> @@ -119,7 +119,7 @@ define $(2)_BUILD_CMDS
>>>>                   $$($(2)_CARGO_ENV) \
>>>>                   cargo build \
>>>>                           --offline \
>>>> -                       $$(if $$(BR2_ENABLE_DEBUG),,--release) \
>>>> +                       $$(if $$(BR2_ENABLE_RUNTIME_DEBUG),,--release) \
>>>>                           --manifest-path Cargo.toml \
>>>>                           --locked \
>>>>                           $$($(2)_CARGO_BUILD_OPTS)
>>>> --
>>>> 2.37.3
>>>>
>>>> _______________________________________________
>>>> buildroot mailing list
>>>> buildroot at buildroot.org
>>>> https://lists.buildroot.org/mailman/listinfo/buildroot



More information about the buildroot mailing list