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

Size executable of hello app #2393

Closed
renlite opened this issue Aug 21, 2021 · 7 comments
Closed

Size executable of hello app #2393

renlite opened this issue Aug 21, 2021 · 7 comments

Comments

@renlite
Copy link
Contributor

renlite commented Aug 21, 2021

Hi,
the "hello.exe" from "Getting started" has a size of 16 MB. This seems to be a big size for a minimum app.
Is this common or are there compiler/build options to reduce the footprint?

@andydotxyz
Copy link
Member

It depends which platform you are building for. Basic app is around 8MB due to the go runtime and some embedded resources. It will be larger if you are packaging for multiple OS architectures.

For a more detailed response please complete the bug template with os/version and commands used

@MatejMagat305
Copy link
Contributor

MatejMagat305 commented Aug 21, 2021

use command go build -ldflags "-w -s -H=windowsgui" - which reduce size to aprox. 8(7.8) MB (ordinary -H=windowsgui only few kilobite, but it remove console),
and if you do not need fast start you can use upx --ultra-brute ..., it together comprest to 2.8 MB ............., but I do not recomend use upx on android apk......... .

@andydotxyz
Copy link
Member

andydotxyz commented Aug 21, 2021

Please use the fyne tools (fyne package) and report back.
We cannot help what the go build phase outputs but there are various flags and improvements applied through the fyne command.

(I would always recommend using the fyne package command as without it your windows executable will not have appropriate icon embedded etc)

@MatejMagat305
Copy link
Contributor

it is similar #1097

@1-bytes
Copy link

1-bytes commented Aug 21, 2021

使用命令go build -ldflags "-w -s -H=windowsgui"- 将大小减少到大约。8(7.8) MB(一般-H=windowsgui只有几千字节,但它去掉了控制台),
如果你不需要快速启动,你可以使用upx --ultra-brute ...,它加起来压缩到 2.8 MB ........,但是我不建议在 android apk 上使用 upx .......

I agree with you :)

@renlite
Copy link
Contributor Author

renlite commented Aug 22, 2021

go build -ldflags "-w -s -H=windowsgui" helped to reduce the size to 8 MB.
Thanks

@renlite renlite closed this as completed Aug 22, 2021
@andydotxyz
Copy link
Member

Just FYI for others landing here, those parameters are set if you use fyne package instead of the go build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants