Skip to content

std not found when trying to cross-compile tools #85320

Closed
@infinity0

Description

@infinity0

We are adding rustfmt and clippy to the Debian package. Previously, with just rustc without these tools, cross-compiling works fine. When adding tools however, the cross-compile of these tools fails.

For example cross-compiling from x86_64 to armv5te:

[..]
        < Rustc { target: TargetSelection { triple: "armv5te-unknown-linux-gnueabi", file: None }, compiler: Compiler { stage: 2, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        c Libdir { compiler: Compiler { stage: 2, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
        c Sysroot { compiler: Compiler { stage: 2, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        c Sysroot { compiler: Compiler { stage: 2, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        c Sysroot { compiler: Compiler { stage: 2, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        c Sysroot { compiler: Compiler { stage: 2, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        c Sysroot { compiler: Compiler { stage: 2, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        c Llvm { target: TargetSelection { triple: "armv5te-unknown-linux-gnueabi", file: None } }
Building stage2 tool rustfmt (armv5te-unknown-linux-gnueabi)
running: "/usr/bin/cargo" "build" "--target" "armv5te-unknown-linux-gnueabi" "-Zdual-proc-macros" "-Zbinary-dep-depinfo" "-j" "4" "-v" "-v" "--release" "--manifest-path" "/<<PKGBUILDDIR>>/src/tools/rustfmt/Cargo.toml" "--message-format" "json-render-diagnostics"
   Compiling proc-macro2 v1.0.24
     Running `CARGO=/usr/bin/cargo CARGO_CRATE_NAME=build_script_build CARGO_MANIFEST_DIR=/<<PKGBUILDDIR>>/vendor/proc-macro2 CARGO_PKG_AUTHORS='Alex Crichton <alex@alexcrichton.com>:David Tolnay <dtolnay@gmail.com>' CARGO_PKG_DESCRIPTION='A substitute implementation of the compiler'\''s `proc_macro` API to decouple
token-based libraries from the procedural macro use case.
' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=proc-macro2 CARGO_PKG_REPOSITORY='https://github.com/alexcrichton/proc-macro2' CARGO_PKG_VERSION=1.0.24 CARGO_PKG_VERSION_MAJOR=1 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=24 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps:/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage2/lib' /<<PKGBUILDDIR>>/build/bootstrap/debug/rustc --crate-name build_script_build --edition=2018 /<<PKGBUILDDIR>>/vendor/proc-macro2/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -Cembed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=513cd11018457a4d -C extra-filename=-513cd11018457a4d --out-dir /<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage2-tools/release/build/proc-macro2-513cd11018457a4d -L dependency=/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps --cap-lints warn -Zbinary-dep-depinfo`
[..]
error[E0463]: can't find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`


Did not run successfully: exit code: 1
"/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--crate-name" "build_script_build" "--edition=2018" "/<<PKGBUILDDIR>>/vendor/proc-macro2/build.rs" "--error-format=json" "--json=diagnostic-rendered-ansi" "--crate-type" "bin" "--emit=dep-info,link" "-C" "opt-level=3" "-Cembed-bitcode=no" "-C" "debuginfo=2" "--cfg" "feature=\"default\"" "--cfg" "feature=\"proc-macro\"" "-C" "metadata=513cd11018457a4d" "-C" "extra-filename=-513cd11018457a4d" "--out-dir" "/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage2-tools/release/build/proc-macro2-513cd11018457a4d" "-L" "dependency=/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--cap-lints" "warn" "-Zbinary-dep-depinfo" "-Clinker=x86_64-linux-gnu-gcc" "--remap-path-prefix" "/<<PKGBUILDDIR>>=/usr/src/rustc-1.52.1"

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