Skip to content

Failing to find bootloader dependency when it's conditionally included #75

Open
@bollian

Description

@bollian

I'm writing a kernel that runs on both the Raspberry Pi 3 and x86_64. I'm trying to use bootloader+bootimage exclusively for the x86_64 version, but not any other architecture. As a result, my Cargo.toml looks like this:

[dependencies]
# common, architecture-independent dependencies

[target.'cfg(target_arch = "x86_64")'.dependencies]
bootloader = "^0.9.8"

When I compile this project with cargo bootimage --target targets/x86_64-unknown-none-softfloat.json --release I get this error message:

Error: An error occured while trying to build the bootloader: Could not find required key `packages[name = `bootloader`` in cargo metadata output

However, if I change the bootloader dependency to not be conditional, i.e. if I just put it in the [dependencies] section, the above error goes away and the project boots perfectly.

Is there some extra configuration I need to do to make this work? It would be nice for me to be able to completely exclude the bootloader dependency off of x86.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions