Closed
Description
c7091f5 add "crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o" to self-contained object files, but it don't works for me.
Add some code to print the command line:
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -905,6 +905,9 @@ pub fn compiler_file(
let mut cmd = Command::new(compiler);
cmd.args(builder.cflags(target, GitRepo::Rustc));
cmd.arg(format!("-print-file-name={}", file));
+ builder.info(&format!(
+ "!!!!cmd: {:?}",cmd
+ ));
let out = output(&mut cmd);
PathBuf::from(out.trim())
}
Copy "/usr/src/x86_64-linux-musl/sysroot/lib/crt1.o" to "/home/han/rust/build/x86_64-unknown-linux-musl/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crt1.o"
Copy "/usr/src/x86_64-linux-musl/sysroot/lib/Scrt1.o" to "/home/han/rust/build/x86_64-unknown-linux-musl/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/Scrt1.o"
Copy "/usr/src/x86_64-linux-musl/sysroot/lib/rcrt1.o" to "/home/han/rust/build/x86_64-unknown-linux-musl/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o"
Copy "/usr/src/x86_64-linux-musl/sysroot/lib/crti.o" to "/home/han/rust/build/x86_64-unknown-linux-musl/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o"
Copy "/usr/src/x86_64-linux-musl/sysroot/lib/crtn.o" to "/home/han/rust/build/x86_64-unknown-linux-musl/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
!!!!cmd: "clang" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-unknown-linux-musl" "-print-file-name=crtbegin.o"
Copy "crtbegin.o" to "/home/han/rust/build/x86_64-unknown-linux-musl/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbegin.o"
thread 'main' panicked at 'src.symlink_metadata() failed with No such file or directory (os error 2)', src/bootstrap/lib.rs:1196:24
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
It seems the --target=x86_64-unknown-linux-musl
argument cause clang omit the path of those files.
> clang -ffunction-sections -fdata-sections -fPIC --target=x86_64-unknown-linux-musl -print-file-name=crtbegin.o
crtbegin.o
> clang -ffunction-sections -fdata-sections -fPIC -print-file-name=crtbegin.o
/usr/lib/gcc/x86_64-gentoo-linux-musl/10.3.0/crtbegin.o
> gcc -ffunction-sections -fdata-sections -fPIC --target=x86_64-unknown-linux-musl -print-file-name=crtbegin.o
gcc: error: unrecognized command-line option '--target=x86_64-unknown-linux-musl'
/usr/lib/gcc/x86_64-gentoo-linux-musl/10.3.0/crtbegin.o
> gcc -ffunction-sections -fdata-sections -fPIC -print-file-name=crtbegin.o
/usr/lib/gcc/x86_64-gentoo-linux-musl/10.3.0/crtbegin.o
Meta
rustc --version --verbose
:
rustc 1.52.0-beta.3 (215738137 2021-04-06)
binary: rustc
commit-hash: 215738137bcbef2c3637a5bd290ef612cffe6ba5
commit-date: 2021-04-06
host: x86_64-unknown-linux-musl
release: 1.52.0-beta.3
LLVM version: 12.0.0