Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Cross.toml configs #186

Open
redeexpressos opened this issue Jul 24, 2024 · 3 comments
Open

Support for Cross.toml configs #186

redeexpressos opened this issue Jul 24, 2024 · 3 comments

Comments

@redeexpressos
Copy link

Trying to build a crate that depends on protoc. When cross-compiling, I have to add Cross.toml:

[build]
default-target = "armv7-unknown-linux-gnueabihf"
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH",
    "apt-get update && apt-get --assume-yes install protobuf-compiler:$CROSS_DEB_ARCH",
]

How can I add that configuration when compiling with this layer?

@tronical
Copy link

I don't think calling apt-get install, etc. would make sense in the Yocto context. I suggest to try to modify your bit bake recipe to include protoc in the native sysroot, that's hopefully in the path. Something like DEPENDS += " protobuf-native"

@redeexpressos
Copy link
Author

@tronical Thanks for answering. However, doesn't this layer use cross to build? When I use Cross, I also have to install protoc via a Cross.toml like this:

[build]
default-target = "armv7-unknown-linux-gnueabihf"
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH",
    "apt-get update && apt-get --assume-yes install protobuf-compiler:$CROSS_DEB_ARCH",
]

@tronical
Copy link

However, doesn't this layer use cross to build?

No, meta-rust-bin does not use cross to build. In fact, it doesn't build rust, it fetches the right binaries and makes them available (via bit bake classes) to recipes for invocation. The actual build of crates compiled with meta-rust-bin happen inside the yocto/bitbake environment, not inside a docker container (like cross). In short, cross-compilation with meta-rust-bin is like calling cargo build --target=aarch64-unknown-linux-gnu (or similar), along with a cargo config set up to invoke the correct linker, set the right sysroot, etc - behind the scenes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants