Skip to content

uclibc targets (and others?) cannot perform libc-test macro expansion due to lack of core lib #5204

Description

@skrap

During the development of #5046 , the request was made that the bitrotten CI script for armv7-unknown-linux-uclibceabihf be resuscitated and made to work. However, I encountered difficulties with the somewhat-new macro expansion functions within the libc testing infrastructure.

RUSTC_BOOTSTRAP=1 rustc -Zunpretty=expanded --edition 2021 /checkout/src/lib.rs --target armv7-unknown-linux-uclibceabihf

but this results in the following error:

macro expansion failed with exit status: 1: error[E0463]: can't find crate for `core`
  |
  = note: the `armv7-unknown-linux-uclibceabihf` target may not be installed
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0463`

@tgross35 suggested using -Zbuild-std but this is a cargo-ism, not a switch which rustc understands. I also was asked to try running cargo rustc in order to invoke the -Zbuild-std switch, but this isn't really the same as invoking rustc directly, as it wants to build the whole crate. (More precisely, it wants to build exactly one target within the crate.) The macro expansion code wants to build exactly one .rs file. This capability is not available from cargo rustc. If you try to make it work you end up with macro expansion trying to call:

RUSTC_BOOTSTRAP=1 cargo rustc --profile check --target armv7-unknown-linux-uclibceabihf -- -Zunpretty=expanded/checkout/src/lib.rs

which fails with:

macro expansion failed with exit status: 101: error: extra arguments to `rustc` can only be passed to one target, consider filtering the package by passing, e.g., `--lib` or `--bin NAME` to specify a single target

To reproduce:

  • Dockerfile needs some amendments, use attached Dockerfile at ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile
  • from libc top level, run RUSTUP_TOOLCHAIN=nightly LIBC_CI_ZBUILD_STD=1 ./ci/run-docker.sh armv7-unknown-linux-uclibceabihf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions