Closed DavidAntliff closed 6 months ago
@DavidAntliff The non-release default profile is named "dev" not "debug", give that a try. https://doc.rust-lang.org/cargo/reference/profiles.html#dev
@posborne ah, there was a hint of that in my previous error, I didn't think that the default was the debug profile but that makes total sense - thank you.
However, perhaps there's something else missing?
CARGO_BUILD_PROFILE = "dev"
bitbake build now fails:
DEBUG: Executing shell function do_install
ERROR: Cargo found no files to install
If I comment out that CARGO_BUILD_PROFILE
it builds properly, as:
/usr/bin/my-app: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=99a2d8f523b317018881d9f8629160596a47e527, for GNU/Linux 3.14.0, with debug_info, not stripped
But it's not really a debug build because if I use gdb
with it, I get a lot of optimised-out symbols. The file size is 15 MB though, compared to only 6 MB when I do a cargo build --release
locally, so not sure what's going on there.
Sorry, I'm new to meta-rust-bin so I'm probably missing something obvious. Thank you for your patience.
@DavidAntliff Cargo must treat the "dev" profile special in that it uses the "debug" output directory (where in every other case it would use the profile name). I may have to hunt this down in cargo to see if that is the case here (and only in this particular case). You should be able to workaround this by creating a new custom profile that inherits from dev.
Getting back to this, from https://doc.rust-lang.org/cargo/guide/build-cache.html
For historical reasons, the dev and test profiles are stored in the debug directory, and the release and bench profiles are stored in the release directory. User-defined profiles are stored in a directory with the same name as the profile.
I'll update the layer to account for these special cases.
Thank you, seems to be working now.
I'm probably using this wrong, but it might indicate an issue.
I have been looking for a way to enable full debugging builds in Yocto (Langdale), with the head of
master
(019e3b0073510e6f39fac23d9a3c2dd6d793a2fe).Initially, I tried setting
.cargo/config.toml
in my project's source root to:But for some reason this file is ignored when bitbake builds the recipe.
Instead, I took a look at
cargo_bin.class
and sawCARGO_BUILD_PROFILE
, with a comment that says it can be "release" or "debug", and defaults to "release". Thus, to set debug mode, I have added to my recipe:However, this now fails to build with this error:
I'm not sure how to proceed.
My full recipe is: