-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Closed
Copy link
Labels
O-windowsOperating system: WindowsOperating system: Windows
Description
At first glance, it looks like a PATH-related mingw issue. I may be wrong though, happy investigating! :)
Steps:
- Install mingw first (or at least something that adds
ld
to PATH), in my case it came with Haskell 2013.2.0.0 for Windows. - Install Rust from the nightly Windows installer
- Create any Rust program ('Hello world' is sufficient) and try to compile it.
- Witness the aftermath.
F:\Rust\TestProj>rustc test.rs
error: linking with `gcc` failed: exit code: 1
note: gcc arguments: '-m32' '-LC:\Program Files (x86)\Rust\bin\rustlib\i686-pc-m
ingw32\lib' '-o' 'test' 'test.o' '-lmorestack' '-shared-libgcc' '-Wl,--enable-lo
ng-section-names' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib\l
ibnative-83574243-0.11-pre.rlib' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-p
c-mingw32\lib\libstd-aad93cea-0.11-pre.rlib' 'C:\Program Files (x86)\Rust\bin\ru
stlib\i686-pc-mingw32\lib\liblibc-3574b280-0.11-pre.rlib' '-LF:\Rust\TestProj\.r
ust' '-LF:\Rust\TestProj' '-Wl,-Bdynamic' '-lws2_32' '-lgcc_s' '-lcompiler-rt'
note: C:/Program Files (x86)/Haskell Platform/2013.2.0.0/mingw/bin/ld.exe: Dwarf
Error: Offset (3168) greater than or equal to .debug_abbrev size (972).
C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib\libstd-aad93cea-0.11
-pre.rlib(r-rustrt-rust_builtin.o):rust_builtin.c:(.text+0x1d0): undefined refer
ence to `_gmtime32'
C:/Program Files (x86)/Haskell Platform/2013.2.0.0/mingw/bin/ld.exe: Dwarf Error
: found dwarf version '0', this reader only handles version 2, 3 and 4 informati
on.
C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib\libstd-aad93cea-0.11
-pre.rlib(r-rustrt-rust_builtin.o):rust_builtin.c:(.text+0x230): undefined refer
ence to `_localtime32'
C:/Program Files (x86)/Haskell Platform/2013.2.0.0/mingw/bin/ld.exe: Dwarf Error
: found dwarf version '20039', this reader only handles version 2, 3 and 4 infor
mation.
C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib\libstd-aad93cea-0.11
-pre.rlib(r-rustrt-rust_builtin.o):rust_builtin.c:(.text+0x41c): undefined refer
ence to `_mktime32'
C:/Program Files (x86)/Haskell Platform/2013.2.0.0/mingw/bin/ld.exe: Dwarf Error
: found dwarf version '8259', this reader only handles version 2, 3 and 4 inform
ation.
C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib\libstd-aad93cea-0.11
-pre.rlib(r-rustrt-rust_builtin.o):rust_builtin.c:(.text+0x44c): undefined refer
ence to `_mktime32'
collect2: ld returned 1 exit status
error: aborting due to previous error
Metadata
Metadata
Assignees
Labels
O-windowsOperating system: WindowsOperating system: Windows
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
ghost commentedon Apr 26, 2014
This is HP's fault for putting a MinGW in the PATH. Windows users should manage their own precisely because of all these breakages.
alexcrichton commentedon Apr 27, 2014
What's the version of gcc that haskell is providing you?
pcwiek commentedon Apr 27, 2014
@alexcrichton: Short answer, GCC 4.5.2. Long answer:
ld
gcc
alexcrichton commentedon Apr 27, 2014
It sounds like this is using an outdated version of mingw that rust no longer supports. I would recommend installing a more recent version of mingw-w64 and having that be farther up in your path than the Haskell version.
pcwiek commentedon Apr 27, 2014
Will do.
I don't know if it's a feasible option, but maybe the installer could be made completely standalone, with all dependencies bundled, for 1.0 release? Just some food for thought.
brson commentedon Apr 29, 2014
@pcwiek It's intended that by 1.0 the windows install will have no external mingw dependency.
brson commentedon Apr 29, 2014
That's #11782
lilianmoraru commentedon Sep 13, 2014
I had about the same problems. Had in the PATH set first MinGW 4.7.2 but then I switched it to the MinGW 4.8.2 that Qt comes with and all works good...
nstoddard commentedon Oct 15, 2014
I'm having the same problem. I'm using the 32-bit version of Rust and I have MinGW installed in C:\MinGW. If I move the MinGW directory to somewhere else, or rename it to something else, it works. Here's the log I'm getting when it fails:
gcc
failed: exit code: 1 #17235steveklabnik commentedon Feb 16, 2015
Is this still happening for people?
vadimcn commentedon Feb 20, 2015
@pcwiek, Windows installer is standalone now, can you please verify that it fixed your problem?
pcwiek commentedon Feb 20, 2015
@vadimcn Can't seem to reproduce the same issue anymore; seems to be fixed for me!
steveklabnik commentedon Feb 20, 2015
Great! If it still happens for anyone else, please let me knowl
shankarsengalani commentedon Mar 4, 2015
I have the same problem
Compiling sdl2 v0.0.28 (file:///G:/Shankar/Project/Maidsafe/Rust/practise/rust-sdl2)
error: linking with
gcc
failed: exit code: 1note: "gcc" '"-Wl,--enable-long-section-names"' '"-fno-use-linker-plugin"' '"-Wl,--nxcompat"' '"-static-libgcc"' '"-m64"' '"-L"' '"C:\Program Files (x86)\Rust-nightly\bin\rustlib\x86_64-pc-windows-gnu\lib"' '"-o"' '"G:\Shankar\Project\Maidsafe\Rust\practise\rust-sdl2\target\examples\demo.exe"' '"G:\Shankar\Project\Maidsafe\Rust\practise\rust-sdl2\target\examples\demo.o"' '"-Wl,--gc-sections"' '"G:\Shankar\Project\Maidsafe\Rust\practise\rust-sdl2\target\libsdl2-39afa0645ddf0ae4.rlib"' '"G:\Shankar\Project\Maidsafe\Rust\practise\rust-sdl2\target\deps\librand-1a237188f461fee5.rlib"' '"G:\Shankar\Project\Maidsafe\Rust\practise\rust-sdl2\target\deps\libsdl2-sys-37248979ab973f09.rlib"' '"G:\Shankar\Project\Maidsafe\Rust\practise\rust-sdl2\target\deps\liblibc-8d21de95f4de7169.rlib"' '"G:\Shankar\Project\Maidsafe\Rust\practise\rust-sdl2\target\deps\libbitflags-518ea12e21428edd.rlib"' '"C:\Program Files (x86)\Rust-nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\libstd-4e7c5e5c.rlib"' '"C:\Program Files (x86)\Rust-nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\libcollections-4e7c5e5c.rlib"' '"C:\Program Files (x86)\Rust-nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\libunicode-4e7c5e5c.rlib"' '"C:\Program Files (x86)\Rust-nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\librand-4e7c5e5c.rlib"' '"C:\Program Files (x86)\Rust-nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\liballoc-4e7c5e5c.rlib"' '"C:\Program Files (x86)\Rust-nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\liblibc-4e7c5e5c.rlib"' '"C:\Program Files (x86)\Rust-nightly\bin\rustlib\x86_64-pc-windows-gnu\lib\libcore-4e7c5e5c.rlib"' '"-L"' '"G:\Shankar\Project\Maidsafe\Rust\practise\rust-sdl2\target"' '"-L"' '"G:\Shankar\Project\Maidsafe\Rust\practise\rust-sdl2\target\deps"' '"-L"' '"C:\Program Files (x86)\Rust-nightly\bin\rustlib\x86_64-pc-windows-gnu\lib"' '"-L"' '"G:\Shankar\Project\Maidsafe\Rust\practise\rust-sdl2.rust\bin\x86_64-pc-windows-gnu"' '"-L"' '"G:\Shankar\Project\Maidsafe\Rust\practise\rust-sdl2\bin\x86_64-pc-windows-gnu"' '"-Wl,--whole-archive"' '"-Wl,-Bstatic"' '"-Wl,--no-whole-archive"' '"-Wl,-Bdynamic"' '"-lSDL2"' '"-lSDL2"' '"-lws2_32"' '"-luserenv"' '"-lcompiler-rt"'
kwebi commentedon Aug 29, 2018
I use the Cygwin, and the gcc..etc were installed, because the net error, I didn't install Mingw64 successfully,
this is my error information:
``
➜ web-app git:(master) ✗ cargo run
Compiling web-app v0.1.0 (file:///E:/Lessons/Rust/project/web-app)
error: linking with
gcc
failed: exit code: 1|
= note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" .......
jesse996 commentedon Jan 8, 2020
same problem,i use msys2
Auto merge of rust-lang#13784 - Veykril:bm-hints, r=Veykril