I've run into an odd case with cargo, and I'm trying to figure out what's causing it.
I have an embedded system that has many different crates in it. Many crates are libraries, while some are programs. One is the kernel, and one is the loader.
If I build the loader by itself, it works. If I build one of the programs by itself, it works. If I build the loader + a program, it fails.
More concretely:
$ cargo build --package loader --package shellchat --target riscv32imac-unknown-xous-elf --release
Finished release [optimized + debuginfo] target(s) in 0.23s
$ cargo build --package shellchat --target riscv32imac-unknown-xous-elf --release
Finished release [optimized + debuginfo] target(s) in 0.34s
$ cargo build --package loader --package shellchat --target riscv32imac-unknown-xous-elf --release
Compiling loader v0.1.0 (E:\Code\Xous\Core\loader)
error: no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait
error: `#[alloc_error_handler]` function required, but not found
note: Use `#![feature(default_alloc_error_handler)]` for a default error handler
error: could not compile `loader` due to 2 previous errors
$
Now granted, loader
is a no_std
program given that it is a bootloader. However, there's clearly something funky going on with the dependency tree. If I build it using --verbose
then I see the hashes for the program names change as arguments to rustc
, however nothing else is changing.
How can I track down this issue? Is it expected that cargo
builds differently depending on which packages you specify? I'm using rust 1.58.0
and this workspace is using resolver version 2.