Re: Problems with recipe for our Rust-Software


Alexander Kanavin
 

Accessing the network is not allowed from do_compile, or any other
task for that matter. You need to provide every needed item in SRC_URI
and rely on standard fetchers to form a complete source tree.

Alex

On Thu, 12 May 2022 at 15:09, Felix Knorr <fknorr@...> wrote:

Hey,

I'm struggling with a recipe to build our rust project.

I cannot use cargo-bitbake because we use the 2021 edition. Also the project is quite complex. We have one repository with 4 different crates, some of them are linking c code. I'm trying to create a recipe by hand.

When I run bitbake for the recipe, it will error out with the following error message:

ERROR: serve-1.0.0-r0 do_compile: ExecutionError('/home/felix/git/poky/build/tmp/work/core2-64-poky-linux/serve/1.0.0-r0/temp/run.do_compile.400923', 101, None, None)
ERROR: Logfile of failure stored in: /home/felix/git/poky/build/tmp/work/core2-64-poky-linux/serve/1.0.0-r0/temp/log.do_compile.400923
Log data follows:
| DEBUG: Executing shell function do_compile
| Updating crates.io index
| warning: spurious network error (2 tries remaining): failed to resolve address for github.com: Name or service not known; class=Net (12)
| warning: spurious network error (1 tries remaining): failed to resolve address for github.com: Name or service not known; class=Net (12)
| error: failed to get `anyhow` as a dependency of package `nlprog v0.1.0 (/home/felix/git/poky/build/tmp/work/core2-64-poky-linux/serve/1.0.0-r0/tmp/baroloop/programmer-rust/nlprog)`
|
| Caused by:
| failed to fetch `https://github.com/rust-lang/crates.io-index`
|
| Caused by:
| network failure seems to have happened
| if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
| https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
|
| Caused by:
| failed to resolve address for github.com: Name or service not known; class=Net (12)
| WARNING: exit code 101 from a shell command.
ERROR: Task (/home/felix/git/baroloop/programmer-tablet/layers/meta-main/recipes-core/programmer/serve_1.0.0.bb:do_compile) failed with exit code '1'

However, if I run the devshell for the recipe and run cargo, it will at least be able to do the fetching. (It will currently fail in the linker step, but I assume thats because I haven't executed oe_cargo_fix_env)

if I don't remove the http.multiplexing=false from the cargo config, it will just hang forever in the devshell (but not error out).

If I set export CARGO_NET_GIT_FETCH_WITH_CLI=true the error is slightly different, but the git call that is then displayed also works in the devshell. Also using a crate://-fetcher doesn't work, which is why I added the CARGO_DISABLE_BITBAKE_VENDORING = "1" I've been fighting this for hours and can't come up with anything. I hope you can help me.

PS: I'm using kirkstone, and I'm not having any url sections in my .gitconfig

This is the recipe:

cargo

SUMMARY = "Copy prebuild programmer serve into the image"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

SRC_URI="\
file://${bl_path}/programmer-ui/dist \
file://${config_path}/files/session \
file:///tmp/baroloop \
"
# crate://crates.io/tokio/1 \
# crate://crates.io/war/0.3 \
# crate://crates.io/byte/1 \
# crate://crates.io/log/0.4.8 \
# crate://crates.io/serde_json/1.0.75 \
# crate://crates.io/serde/1.0.133 \
# crate://crates.io/docopt/1.1.0 \
# crate://crates.io/colored/1.9.3 \
# crate://crates.io/chrono/0.4.11 \
# crate://crates.io/battery/0.7.7 \
# crate://crates.io/uuid/0.8.2 \
# crate://crates.io/thiserror/1.0 \
# crate://crates.io/anyhow/1 \
# crate://crates.io/clap/3.0 \
# crate://crates.io/futures/0.3 \
# crate://crates.io/wry/0.6.1
S = "${WORKDIR}"

RDEPENDS:${PN} = "\
eudev \
dbus \
"

DEPENDS = "\
eudev \
dbus \
"

# INSANE_SKIP:${PN} += "file-rdeps"

FILES:${PN} = "\
/home/neuro/serve \
/home/neuro/dist/** \
${sysconfdir}/mini_x/session \
"

CARGO_DISABLE_BITBAKE_VENDORING = "1"

do_compile() {
oe_cargo_fix_env

sed -i '/multiplexing = false/d' $CARGO_HOME/config
sed -i '/\[http\]/d' $CARGO_HOME/config
sed -i '/cainfo/d' $CARGO_HOME/config

export RUSTFLAGS="${RUSTFLAGS}"
export RUST_TARGET_PATH="${RUST_TARGET_PATH}"

export CARGO_NET_GIT_FETCH_WITH_CLI=true
cd ${S}/tmp/baroloop/programmer-rust/
cargo build --release --bin serve
}

do_install() {
# this isn_t reached anyway
# ...
}

--
Mit freundlichen Grüßen neuroloop GmbH
i.A. Felix Knorr
Senior Software Developer
--------------------------------------
neuroloop GmbH
Engesserstr. 4, 79108 Freiburg, Germany

Amtsgericht Freiburg HRB 713935

Geschäftsführer: Dr. Michael Lauk, Dr. Dennis Plachta



The information contained in this communication is confidential, may be attorney-client privileged, may constitute inside information, and is intended only for the use of the addressee. It is the property of the company of the sender of this e-mail. Unauthorized use, disclosure, or copying of this communication or any part thereof is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by return e-mail and destroy this communication and all copies thereof, including all attachments.



Join yocto@lists.yoctoproject.org to automatically receive all group messages.