Skip to content

Added flags '-s -w' to buildflags#3742

Merged
ebuchman merged 5 commits intotendermint:developfrom
tac0turtle:marko/reduce_binary-size
Jun 24, 2019
Merged

Added flags '-s -w' to buildflags#3742
ebuchman merged 5 commits intotendermint:developfrom
tac0turtle:marko/reduce_binary-size

Conversation

@tac0turtle
Copy link
Contributor

@tac0turtle tac0turtle commented Jun 21, 2019

ref #1182

  • -s -w reduces the binary size by removing symbols that are only used by debuggers. All panics, stacktraces, etc. stay the same.
    - -s : Omit the symbol table and debug information.
    - -w : Omit the DWARF symbol table.
    The reduction in the size of the binary is 18%, this primarily comes from removing the DWARF symbol table.

  • Ran go mod tidy on the repo to help clean up the go.mod file

  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG_PENDING.md

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
@codecov-io
Copy link

codecov-io commented Jun 21, 2019

Codecov Report

Merging #3742 into develop will decrease coverage by 0.04%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           develop   #3742      +/-   ##
==========================================
- Coverage    63.95%   63.9%   -0.05%     
==========================================
  Files          241     241              
  Lines        19996   19994       -2     
==========================================
- Hits         12788   12777      -11     
- Misses        6162    6171       +9     
  Partials      1046    1046
Impacted Files Coverage Δ
blockchain/reactor.go 71.49% <0%> (-1.87%) ⬇️
consensus/reactor.go 71.52% <0%> (-1.53%) ⬇️
blockchain/pool.go 80.26% <0%> (-1.32%) ⬇️
abci/example/kvstore/persistent_kvstore.go 64.04% <0%> (+0.3%) ⬆️
p2p/pex/pex_reactor.go 82.64% <0%> (+0.58%) ⬆️
privval/signer_validator_endpoint.go 85.55% <0%> (+10%) ⬆️

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍷 🧀

@melekes
Copy link
Contributor

melekes commented Jun 22, 2019

People who want to use debuggers (developers) should be able to build binaries without -s -w themselves (this will require modifying Makefile). But I think it's fine to compile with -s -w by default.

@alessio
Copy link
Contributor

alessio commented Jun 22, 2019

I'd rather do something conditional like the following:

ifeq ($(NOSTRIP),)
  BUILD_FLAGS += -w -s
endif

So that such flags can be added back in by just

make NOSTRIP=y

(Sent from mobile - excuse the brevity)

@melekes melekes self-requested a review June 24, 2019 10:09
Makefile Outdated
BUILD_FLAGS = -X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short=8 HEAD`

ifeq ($(NOSTRIP),)
BUILD_FLAGS += -s -w
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to document this in the build instructions

@ebuchman ebuchman merged commit 4c4bf0f into tendermint:develop Jun 24, 2019
unclezoro pushed a commit to unclezoro/tendermint that referenced this pull request Sep 6, 2019
* Added flags '-s -w' to buildflags

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* added a condition for no strip

* minor changes

* on call discussions

* on call discussion v2
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

Successfully merging this pull request may close these issues.

5 participants