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

Reduce the size of the binaries #6238

Merged
merged 1 commit into from
Apr 19, 2016

Conversation

sorenmat
Copy link
Contributor

Introducing an TF_RELEASE variable to the build process.
When TF_RELEASE is set, the LD_FLAGS -s -w is applied. This will strip debug information from
the binaries.
The complete size of the binaries before change was 543 mb
After the change the complete size is 395
This is a decrease of 148 mb
Numbers are taken from OSX.

This has not been tested on other platform then OSX, but since it's standard go build flags I don't foresee any issues with it.

@apparentlymart
Copy link
Contributor

@sorenmat, thanks for this!

I tried it on my Linux machine, building binaries for all supported targets, and it seemed to work across all of them, so I merged it. I also tweaked the Makefile so that this will be done by default when making distribution packages.

I am wondering whether this will mean that when users submit bug reports about crashes they'll be less useful, because we'll lose the source information. My gut is to try it and see what happens, since the savings are quite compelling, but I'm pinging @phinze in case he disagrees and wants to roll back my follow up change a153085 and leave this as an optional flag for people making custom distros.

#6013 should also make a considerable impact on this, by avoiding duplicating the code (and debug info!) for some core bits of Terraform repeatedly in each binary.

@radeksimko
Copy link
Member

It would be good to see the difference between crash log from standard binary vs stripped version of binary before we actually ship any stripped binaries off to the wild.

Also see #6013 which is reducing the size probably even more radically without introducing the tradeoffs mentioned (715 - 130 = 585 MB saved), so such stripping may not be necessary.

Having spent quite some time trying to reproduce weird bugs in different AWS environments I'm absolutely 👎 for any attempts of making this more difficult - i.e. I'm 👍 for rolling back this change, but I'll leave the decision on @phinze

@sorenmat
Copy link
Contributor Author

The output of a panic will be the same. I don't think there currently is a way to strip that. Not that I think we should.
So this basically means you can't debug the binary with gdb or similar, and I guess the use case for that is quite limited. If you have that usecase then you would have to rebuild terraform with debug information, I would personally be fine with that.

@radeksimko
Copy link
Member

So this basically means you can't debug the binary with gdb or similar

right, I see. That makes me feel less worried. I was mostly worried about the crash logs.

I guess the ability to debug released binaries via gdb would be nice to have, but it's not a common task we would ask user to perform.

@ghost
Copy link

ghost commented Apr 26, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants