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

Compiler on windows 8.1 issues #26647

Closed
saixmh opened this issue Jun 29, 2015 · 15 comments
Closed

Compiler on windows 8.1 issues #26647

saixmh opened this issue Jun 29, 2015 · 15 comments
Labels
O-windows Operating system: Windows

Comments

@saixmh
Copy link

saixmh commented Jun 29, 2015

Source compiled to binary can not be run. But after I use UPX to compress the binary, it can be run successfully.

@huonw huonw added the O-windows Operating system: Windows label Jun 29, 2015
@huonw
Copy link
Member

huonw commented Jun 29, 2015

Could you be more specific? E.g. what source? In what way does it fail to run?

@saixmh
Copy link
Author

saixmh commented Jun 29, 2015

@huonw
Thanks. Anything sources can be compiled but not run. (windows 8.1 chinese)
E.g.

test.rs
fn main() {
    println!("Hello, world!");
}
D:\>rustc test.rs
D:\>test.exe

The error message just like: test.exe has already stop working.
With this information:

Question event name: APPCRASH
Application name: test.exe
Application version: 0.0.0.0
Application time stamp: 00020000
Fault module name: ntdll.dll
Fault module version: 6.3.9600.16408
Fault module time stamp: 523d5305
Exception code: c0000005
Exception shift: 000000000004bb96
OS version: 6.3.9600.2.0.0.256.4
zone setting ID: 2052
Other information 1: 9a8f
Other information 2: 9a8fb9fff4da9966d6757731fe5b7fd3
Other information 3: 9cf5
Other information 4: 9cf5f9a211bedeb7985f53e7ecb7132d

I'm sorry for my terrible translations. After compress, it can run normally.

D:\>upx test.exe
...
D:\>test.exe
Hello, world!

@saixmh
Copy link
Author

saixmh commented Jul 2, 2015

@BigBoneDaddy Just running a simple anti virus. But if it has Intercepted virus, It will give me a tip. I also feel very strange.

@retep998
Copy link
Member

retep998 commented Jul 3, 2015

So rustc runs fine but not binaries created by it?
Does cargo work?
Does it still crash if the println! is removed?

@saixmh
Copy link
Author

saixmh commented Jul 4, 2015

@retep998
It can created binaries but the binaries can't work.
The cargo can't work, it's the same as the binary which is rustc created.
It still crash without println!

@retep998
Copy link
Member

retep998 commented Jul 4, 2015

Could you try running a binary created by rustc with gdb and get a backtrace of the point where it crashes?

@saixmh
Copy link
Author

saixmh commented Jul 4, 2015

@retep998
I try to use gdb and get this info.

D:\>D:\program\TDM-GCC-32\bin\gdb.exe test.exe
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from D:\test.exe...done.
(gdb) break 1
Breakpoint 1 at 0x401613: file test.rs, line 1.
(gdb) r
Starting program: D:\test.exe
[New Thread 3744.0x19d0]
[New Thread 3744.0x19e4]

Program received signal SIGSEGV, Segmentation fault.
0x7795e12c in ?? ()

@retep998
Copy link
Member

retep998 commented Jul 4, 2015

@saixmh Can you enter in the command backtrace inside gdb to get a backtrace?

@saixmh
Copy link
Author

saixmh commented Jul 4, 2015

@retep998 Thanks.

(gdb) backtrace
#0  0x77b3e12c in ?? ()
#1  0x77b3e04f in ?? ()
#2  0x77b3e078 in ?? ()
#3  0x004c7d88 in je_malloc_mutex_lock ()
    at C:/bot/slave/stable-dist-rustc-win-gnu-     
    32/build/src/jemalloc/include/jemalloc/internal/mutex.h:73
#4  malloc_init_hard ()
    at C:/bot/slave/stable-dist-rustc-win-gnu-32/build/src/jemalloc/src/jemalloc.c:692
#5  malloc_init ()
    at C:/bot/slave/stable-dist-rustc-win-gnu-32/build/src/jemalloc/src/jemalloc.c:314
#6  jemalloc_constructor ()
    at C:/bot/slave/stable-dist-rustc-win-gnu-32/build/src/jemalloc/src/jemalloc.c:1994
#7  0x00486eca in __do_global_ctors ()
#8  0x004013b2 in __tmainCRTStartup ()
#9  0x757c495d in KERNEL32!BaseThreadInitThunk ()
    from C:\Windows\SysWOW64\kernel32.dll
#10 0x77b698ee in ?? ()
#11 0x77b698c4 in ?? ()
#12 0x00000000 in ?? ()

@retep998
Copy link
Member

retep998 commented Jul 5, 2015

I guess we can chalk up yet another issue to jemalloc being easily broken on Windows.
A workaround for now can be to use the msvc version of Rust, which doesn't use jemalloc. You'll have to install VS 2013 and use Microsoft Visual Studio 12.0\VC\bin\amd64\vcvars64.bat to setup your environment variables so it'll work (at least until #26741 lands). Also unwinding is kinda broken so panics will abort instead, but at least it doesn't use jemalloc.
https://static.rust-lang.org/dist/rust-nightly-x86_64-pc-windows-msvc.msi

cc @alexcrichton

@retep998
Copy link
Member

retep998 commented Jul 5, 2015

Also, what command line or terminal are you using? cmd.exe? Git bash? Conemu? Msys2?

@saixmh
Copy link
Author

saixmh commented Jul 6, 2015

@retep998
Too many thanks.
It's cmd.exe.

@retep998
Copy link
Member

retep998 commented Jul 6, 2015

Another option you have is to manually build Rust yourself and when doing ./configure you can pass the --disable-jemalloc flag.

@saixmh
Copy link
Author

saixmh commented Jul 6, 2015

@retep998
All right, I'll try it. Thanks.

@alexcrichton
Copy link
Member

#29839 was recently opened which I believe is the same bug as this one, and that one's a little more specific, so I'm gonna close this in favor of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

5 participants
@alexcrichton @retep998 @huonw @saixmh and others