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

Large executable while compiling for windows from Linux systems #60504

Closed
noelaugustin opened this issue May 3, 2019 · 3 comments
Closed

Large executable while compiling for windows from Linux systems #60504

noelaugustin opened this issue May 3, 2019 · 3 comments
Labels
I-heavy Issue: Problems and improvements with respect to binary size of generated code. O-windows-gnu Toolchain: GNU, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@noelaugustin
Copy link

I have a simple Hello World program, which only has a single line in the main function of main.rs, which is
println!(Hello World);

Adding to the default package that is done by cargo init, the cargo.toml file has
[profile.dev]
panic="abort"

When I compile the code with target i686-pc-windows-gnu, with the linker being i686-w64-mingw32-g++ on linux, for windows, I get an exe, which is 3052 kB, and when i do the same with target i686-pc-windows-msvc, for windows on windows, I get an exe, which is 112 kB. Could someone suggest as to how I can reduce the size while I cross compile my code for windows from Linux? This is a concern as the difference in size is almost 30 times.

@jonas-schievink
Copy link
Contributor

Those are separate targets (GNU vs. MSVC), what's the size when you build for the GNU target while on Windows?

@jonas-schievink jonas-schievink added I-heavy Issue: Problems and improvements with respect to binary size of generated code. O-windows-gnu Toolchain: GNU, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 3, 2019
@mati865
Copy link
Contributor

mati865 commented Dec 27, 2019

Binaries linked by GCC are not stripped. Therefore this is duplicate of #46034

what's the size when you build for the GNU target while on Windows?

The same as when cross compiling from Linux.

@jonas-schievink
Copy link
Contributor

Thanks, closing as a duplicate then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-heavy Issue: Problems and improvements with respect to binary size of generated code. O-windows-gnu Toolchain: GNU, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants