Skip to content

Large executable while compiling for windows from Linux systems #60504

@noelaugustin

Description

@noelaugustin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-heavyIssue: Problems and improvements with respect to binary size of generated code.O-windows-gnuToolchain: GNU, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions