Description
Whatever the code being compiled, ld
complains about not finding crt2.o, crtbegin.o, and crtend.o, even though these files should all be found by GCC, and is so on beta.
E:\Dropbox\Program\Rust\test-rs
λ set PATH=C:/Program Files/Rust nightly/bin/
E:\Dropbox\Program\Rust\test-rs
λ rustc -V
rustc 1.1.0-nightly (c42c1e7a6 2015-05-02) (built 2015-05-02)
E:\Dropbox\Program\Rust\test-rs
λ echo fn main() { println!("test") } | rustc -
error: linking with `gcc` failed: exit code: 1
note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-static-libgcc" "-m64" "-L" "C:\Program Files\Rust nightly\bin\rustlib\x86_64-pc-windows-gnu\lib" "-o" "rust_out.exe" "rust_out.o" "-Wl,--gc-sections" "C:\Program Files\Rust nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\libstd-4e7c5e5c.rlib" "C:\Program Files\Rust nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\libcollections-4e7c5e5c.rlib" "C:\Program Files\Rust nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\librustc_unicode-4e7c5e5c.rlib" "C:\Program Files\Rust nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\librand-4e7c5e5c.rlib" "C:\Program Files\Rust nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\liballoc-4e7c5e5c.rlib" "C:\Program Files\Rust nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\liblibc-4e7c5e5c.rlib" "C:\Program Files\Rust nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\libcore-4e7c5e5c.rlib" "-L" "\\?\C:\Program Files\Rust nightly\bin\rustlib\x86_64-pc-windows-gnu\lib" "-L" "E:\Dropbox\Program\Rust\test-rs\.rust\bin\x86_64-pc-windows-gnu" "-L" "E:\Dropbox\Program\Rust\test-rs\bin\x86_64-pc-windows-gnu" "-Wl,--whole-archive" "-Wl,-Bstatic" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-lws2_32" "-luserenv" "-lcompiler-rt"
note: ld: cannot find crt2.o: No such file or directory
ld: cannot find crtbegin.o: No such file or directory
ld: cannot find crtend.o: No such file or directory
error: aborting due to previous error
E:\Dropbox\Program\Rust\test-rs
λ set PATH=C:/Program Files/Rust beta/bin/
E:\Dropbox\Program\Rust\test-rs
λ rustc -V
rustc 1.0.0-beta.3 (5241bf9c3 2015-04-25) (built 2015-04-25)
E:\Dropbox\Program\Rust\test-rs
λ echo fn main() { println!("test") } | rustc -
E:\Dropbox\Program\Rust\test-rs
λ rust_out.exe
test
As can be seen in the log, the crt
files are not found, even though the "-L" "C:\Program Files\Rust nightly\bin\rustlib\x86_64-pc-windows-gnu\lib"
option is set for gcc, and the files do exist:
C:\Users\Johan
λ ls -l "C:/Program Files/Rust nightly/bin/rustlib/x86_64-pc-windows-gnu/lib/" | grep crt
-rw-r--r-- 1 Johan Users 5770 May 2 04:43 crt2.o
-rw-r--r-- 1 Johan Users 450 May 2 04:43 crtbegin.o
-rw-r--r-- 1 Johan Users 450 May 2 04:43 crtend.o
-rw-r--r-- 1 Johan Users 3473 May 2 04:43 dllcrt2.o
-rw-r--r-- 1 Johan Users 962194 May 2 04:43 libmsvcrt.a
-rw-r--r-- 1 Johan Users 418504 May 2 04:43 librpcrt4.a
I'm even more confused by the fact that everything works fine on rust beta, even though the setup is the same.
edit: I am running this with 64-bit versions of rust nightly and rust beta