rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.82k stars 12.5k forks source link

error: manifest path `.../src/tools/cargo/Cargo.toml` does not exist #119720

Open th0ma7 opened 8 months ago

th0ma7 commented 8 months ago

I tried this code:

./configure --set build.target=powerpc-unknown-linux-gnuspe
./x build
Building bootstrap
    Finished dev [unoptimized] target(s) in 0.08s
error: manifest path `/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/rust-1.75.0/src/tools/cargo/Cargo.toml` does not exist
thread 'main' panicked at src/core/metadata.rs:86:31:
command did not execute successfully: RUSTC_BOOTSTRAP="1" "/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/rust-1.75.0/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "metadata" "--format-version" "1" "--no-deps" "--manifest-path" "/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/rust-1.75.0/src/tools/cargo/Cargo.toml"
expected success, got: exit status: 101

Behavior somehow changed recently where src/tools/cargo directory is now empty in both online tar.gz source file as well as using a git clone https://github.com/rust-lang/rust.git, thus failing at build time due to missing Cargo.toml from the cargo directory.

This looks similar to https://github.com/rust-lang/rust/issues/115041 whereas invoking submodule init & update does populate the cargo directory at the expense of more than 4GB extra storage (not mentionning the build overhead time).

git submodule init
git submodule update

Note that this wasn't hapening using git clone as of last october.

EDIT: it seems that using git submodule init && git submodule update src/tools/cargo does the trick at populating only that subdirectory.

chenyukang commented 8 months ago

what's the content of your config.toml?

th0ma7 commented 8 months ago

Here's a copy of it that got generated using the ./configure. What I noticed is that it defaults to profile = "dist" instead of compiler which is what I normally use for my usecases. Also note that post configure I must still add my cross-compiler details as I haven't found out how to do that automatically using the configure script:

# Use different pre-set defaults than the global defaults.
#
# See `src/bootstrap/defaults` for more information.
# Note that this has no default value (x.py uses the defaults in `config.example.toml`).
profile = 'dist'

[llvm]

[build]

# Which triples to build libraries (core/alloc/std/test/proc_macro) for. Each of these triples will
# be bootstrapped from the build triple themselves. In other words, this is the list of triples for
# which to build a library that can CROSS-COMPILE to that triple.
#
# Defaults to `host`. If you set this explicitly, you likely want to add all
# host triples to this list as well in order for those host toolchains to be
# able to compile programs for their native target.
target = ['powerpc-unknown-linux-gnuspe']

# Arguments passed to the `./configure` script, used during distcheck. You
# probably won't fill this in but rather it's filled in by the `./configure`
# script. Useful for debugging.
configure-args = ['--set', 'build.target=powerpc-unknown-linux-gnuspe']

[install]

[rust]

[target.x86_64-unknown-linux-gnu]

[target.powerpc-unknown-linux-gnuspe]
cc = "/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-gcc"
cxx = "/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-g++"
ar = "/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-ar"
ranlib = "/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-ranlib"
linker = "/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-gcc"

[dist]

And my normal config file that does not trigger this:

profile = "compiler"

[build]
target = ["x86_64-unknown-linux-gnu", "powerpc-unknown-linux-gnuspe"]
build-stage = 1
doc-stage = 2
docs = false
docs-minification = false
compiler-docs = false

[rust]
channel = "stable"
lto = "off"

[llvm]
download-ci-llvm = "if-unchanged"

[install]

[dist]

[target.x86_64-unknown-linux-gnu]

[target.powerpc-unknown-linux-gnuspe]
cc = "/home/spksrc/qoriq-debug-update/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-gcc"
cxx = "/home/spksrc/qoriq-debug-update/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-g++"
ar = "/home/spksrc/qoriq-debug-update/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-ar"
ranlib = "/home/spksrc/qoriq-debug-update/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-ranlib"
linker = "/home/spksrc/qoriq-debug-update/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-gcc"
LuuuXXX commented 8 months ago

This answer may be helpful when you download source as a zip package : https://github.com/rust-lang/rust/issues/115041#issuecomment-1741757011

If the source code is obtained through git clone https://github.com/rust-lang/rust.git. Perhaps the following command can help you update the submodule code:

git submodule update --init --recursive