Skip to content

cargo.bbclass: invoking pkg-config for host-crates while building a target recipe will lead to host/target mismatch #155

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

Open
codyps opened this issue Mar 14, 2017 · 0 comments

Comments

@codyps
Copy link
Member

codyps commented Mar 14, 2017

Just to clarify the items in play here (because the title is a disaster).

A. target recipe using cargo: a bitbake recipe that invokes cargo to build, and is being built for the bitbake target (ie: not native).
B. crate using calling/using pkg-config and being built for the host (say, for a plugin or the build script)
C. crate being built for bitbake target (which may use pkg-config).

A contains C & B. C's build script (or similar) depends on B.

If a recipe for a target package that calls cargo (A) has cargo host-dependencies that use pkg-config to find host-libraries (B), B's calls to pkg-config will discover TARGET libraries instead of HOST (ie: native.bbclass) libraries, and likely fail to build (or potentially take some other action like trying to build the library locally instead of using bitbake's provided version).

It seems like fixing this will likely mean getting some modifications to the pkg-config crate so that we can supply different PKG_CONFIG_PATHs for host vs target builds, probably by using similar logic to gcc-rs for the environment variables.

Right now running into this appears unlikely (I'm not aware of any examples) because most build scripts are fairly simple. I'm worried that increased use of plugins may increase the complexity of the things cargo builds for host, which would increase the likely hood of hitting this issue.

I haven't yet run into this, just wanted to make sure it's on our radar.

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

1 participant