Can't find crate for `std` error - new target


I am currently porting rust to a new target (out of tree). The host compiler run on Windows (msvc) and cross-compile to an embedded target.

I am at the point where I want to use the std that was built using: python build --config opus_config.toml

I changed the default rustc using: rustup toolchain link opus3-octasic-opuskernel C:\git\sdt_rust\build\x86_64-pc-windows-msvc\stage1

Now if I build a project, I get this error:

C:\git\hello_world> cargo build

Compiling hello_world v0.1.0 (C:\git\hello_world)
error[E0463]: can't find crate for `std`

I tried using "rustup target add" but that doesn't seem to work.

I can see the std files (.rlib and stuff) for my target in: C:\git\sdt_rust\build\x86_64-pc-windows-msvc\stage1-std\opus3-octasic-opuskernel\release

How can I tell cargo to look there for std lib?

Thank you

Have you tried asking on Zulip? There are more compiler people active there and it is easier to receive and provide help on there.

What is your opus_config.toml file? You probably need to add the host target to the target array to allow building build script and proc macros. Also you need cargo build --target opus3-octasic-opuskernel to build for this target. Rustc defaults to building for the host target.

Turn out I just needed to add `--target opus3-octasic-opuskernel' on the cargo build.

Thank you.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.