Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows segfaults in libstdc++ when MinGW version is too new #5712

Closed
darkf opened this issue Apr 4, 2013 · 8 comments
Closed

Windows segfaults in libstdc++ when MinGW version is too new #5712

darkf opened this issue Apr 4, 2013 · 8 comments
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-windows Operating system: Windows

Comments

@darkf
Copy link
Contributor

darkf commented Apr 4, 2013

After using the 0.6 installer (with add to PATH checked), and MinGW (with GCC 4.7.2) on Windows 8, attempting to launch rustc or rustc.exe results with the message boxed error:

The application was unable to start correctly (0xc0000142). Click OK to close the application.

Running under ollydbg, it seems to segfault when doing some stuff with libstdc++. Rust 0.5 worked fine.

@nettok
Copy link

nettok commented Apr 4, 2013

I am having the same problem using the latest mingw (gcc 4.7.2). Here is the segmentation fault.

$ gdb rustc.exe
GNU gdb (GDB) 7.5
...
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from c:\Program Files (x86)\Rust\bin\rustc.exe...(no debugging symbols found)...done.
(gdb) run
Starting program: c:\Program Files (x86)\Rust\bin\rustc.exe
[New Thread 5196.0x1068]

Program received signal SIGSEGV, Segmentation fault.
0x6fc5b93f in libstdc++-6!_ZN9__gnu_cxx18__exchange_and_addEPVii ()
   from C:\MinGW\bin\libstdc++-6.dll

@bstrie
Copy link
Contributor

bstrie commented May 10, 2013

Nominating this for 0.7.

@bstrie
Copy link
Contributor

bstrie commented May 10, 2013

Also, I'm not certain off the top of my head if that's the correct version of MinGW that Rust needs. However, even if it's not, the installer needs to detect this and abort rather than complete the install.

@mschorsch
Copy link

You have to downgrade your "libstdc++-6.dll".

  1. mingw-get upgrade "gcc<4.7"
  2. mingw-get upgrade "libstdc++<4.7"

@graydon
Copy link
Contributor

graydon commented May 16, 2013

accepted for production-ready milestone

@pnkfelix
Copy link
Member

Visiting for triage from 2013-07-22 email.

One can readily reproduce this (and toggle between working/non-working) by running mingw-get upgrade "libstdc++>=4.7" in a MinGW window. (I do not personally know where things will fail if you upgrade your gcc to 4.7 or beyond; upgrading it did not immediately fail for me, but I did not test it thoroughly.)

(It is also not too hard to have two distinct installation of MinGW, and then toggle between then by modifying your PATH accordingly so that the dll lookup proceeds in whichever MinGW installation you wish to test. For example, I am playing with a wrapper .bat file that is just the following

rem PATH=c:\MinGWissue5712\bin;c:\Rust\bin\;c:\Python27;%PATH%
PATH=c:\MinGW\bin;c:\Rust\bin\;c:\Python27;%PATH%
start

which opens a command window with the PATH set to look up the corresponding dll's.)

I do not yet know if we should/must fail the installation outright if the user has not yet installed the appropriate libstdc++-6.dll variant. It might be better if we can detect the situation from rust.exe and instruct the user as to how to fix the problem at runtime, especially since someone might inadvertently upgrade their MinGW libraries after having installed Rust, and at that point an install-time check will be of no use.

@darkf
Copy link
Contributor Author

darkf commented Jul 25, 2013

Why is there a requirement for the old libstdc++? Is it an ABI thing that can be fixed in rustc/rustrt or is there a deeper issue? Why do later versions work on Linux? Could we have an option to statically link libstdc++? (GCC provides this with -static-libstdc++)

@sanyer
Copy link

sanyer commented Sep 7, 2013

Only after deleting the libstdc++ (mingw-get remove libstdc++) and installing libstdc++ for gcc 4.5 (mingw-get install "libstdc++<4.6") rustc was finally able to start.
And also I appended "c:\mingw\bin" to PATH environment variable.

@bors bors closed this as completed in 8bb55db Oct 4, 2013
flip1995 added a commit to flip1995/rust that referenced this issue Jun 23, 2020
Remove `bar` from blacklisted names

changelog: Remove `bar` from blacklisted names
fixes rust-lang#5225
flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 23, 2020
Rollup of 9 pull requests

Successful merges:

 - rust-lang#5178 (clippy-driver: pass all args to rustc if --rustc is present)
 - rust-lang#5705 (Downgrade unnested_or_patterns to pedantic)
 - rust-lang#5709 (Fix ICE in consts::binop)
 - rust-lang#5710 (typo)
 - rust-lang#5712 (Remove `bar` from blacklisted names)
 - rust-lang#5713 (Use lints in Clippy that are enabled in rustc bootstrap)
 - rust-lang#5716 (Fix typo in wildcard_imports)
 - rust-lang#5724 (redundant_pattern_matching: avoid non-`const fn` calls in const contexts)
 - rust-lang#5726 (Fix typo)

Failed merges:

r? @ghost

changelog: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-windows Operating system: Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants