Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

cargo-build-bpf: Running from top-level workspace still filters targets on Xargo.toml #16329

Closed
joncinque opened this issue Apr 2, 2021 · 4 comments

Comments

@joncinque
Copy link
Contributor

Problem

Although Xargo.toml is no longer needed with the new build system, cargo build-bpf still filters for bpf packages based on the presence of Xargo.toml when building at the workspace level:

package.manifest_path.with_file_name("Xargo.toml").exists()

Proposed Solution

I'm not sure to be honest, so a few mediocre ideas:

  • build-bpf can just try to build everything the workspace
  • programs specify [build.target] in Cargo.toml to target bpfel-unknown-unknown
  • programs add a feature like build-bpf, similar to test-bpf (or just use test-bpf, but that feels even worse)
@mvines
Copy link
Contributor

mvines commented Apr 2, 2021

Darn. I guess for now keeping Xargo.toml around isn't terrible, even though it's now only for build-bpf

@joncinque
Copy link
Contributor Author

Looks like this was done in #16431 by Jack, searching for a cdylib target -- thanks @jackcmay !

@jackcmay
Copy link
Contributor

My solution may not hold up forever if there is a non-bpf compatible project in the workspace that also exports a cdylib , but for now I think it is better than requiring folks to create xargo.toml files. We could flag a project as bpf compatible via a package.metadata field instead. https://doc.rust-lang.org/cargo/reference/manifest.html#the-metadata-table

@mvines
Copy link
Contributor

mvines commented Apr 12, 2021

solana-program dependency + cdylib is a pretty strong signal

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

No branches or pull requests

3 participants