Skip to content

Some crates should expose indirect axhal as a direct optional dependency to compile on multiple platforms #300

@zjp-CN

Description

@zjp-CN

For crates that transively/indirectly rely on axhal, there is no way to compile them on non-host targets/platforms, like axfs:

arceos/modules/axfs $ cargo b --target aarch64-unknown-none-softfloat
   Compiling axhal v0.2.0 (/home/gh-zjp-CN/arceos/arceos/modules/axhal)
error[E0463]: can't find crate for `axplat_aarch64_qemu_virt`
  --> modules/axhal/src/lib.rs:48:9
   |
48 |         extern crate axplat_aarch64_qemu_virt;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `axhal` (lib) due to 1 previous error

The solution is to add optional axhal in axfs's Cargo.toml, and compile with -Faxhal/defplat

[dependencies]
+axhal = { workspace = true, optional = true }
arceos/modules/axfs $ cargo b --target aarch64-unknown-none-softfloat -Faxhal/defplat 

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions