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

Simplify tetra and tetragon build without CGO, add binary stripping and improve Makefile #1268

Merged
merged 3 commits into from
Jul 24, 2023

Conversation

mtardy
Copy link
Member

@mtardy mtardy commented Jul 24, 2023

Fix #1077 and #1164.

For #1164, removing CGO will force the builder to use pure Go implementation for net and user.

See individual commits.

@mtardy mtardy added kind/enhancement This improves or streamlines existing functionality kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Jul 24, 2023
@mtardy mtardy requested a review from a team as a code owner July 24, 2023 09:37
@mtardy mtardy requested a review from jrfastab July 24, 2023 09:37
Previously tetra on Linux was importing the tracingpolicy package that
was importing pkg/bpf which was using CGO. The CGO dependency was
removed so we don't need to split between dynamic and static compilation
anymore.

Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
- use JOBS on the local BPF build
- remove docs aliases
- remove image-clang-arm because the clang is multi-arch
- document options of the Makefile
- move variables set to the top of the file

Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
Build a common GO_BUILD variable to be used by all target building Go
progs. Also add binary stripping by default as it doesn't affect late
debugging (stack traces and gops) and reduce the size of binaries:
approximately tetra 37Mo -> 25Mo and tetragon 74Mo -> 51Mo.
Use new option DEBUG=1 to remove optimizations and stripping.

Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
@mtardy mtardy force-pushed the pr/mtardy/makefile-go-build branch from 10ff183 to ca59980 Compare July 24, 2023 09:40
@mtardy mtardy linked an issue Jul 24, 2023 that may be closed by this pull request
Copy link
Contributor

@kkourt kkourt left a comment

Choose a reason for hiding this comment

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

Thanks!

@mtardy mtardy merged commit 15e37f6 into main Jul 24, 2023
21 checks passed
@mtardy mtardy deleted the pr/mtardy/makefile-go-build branch July 24, 2023 10:55
@echo ' JOBS - number of jobs to run for BPF compilation (default to nproc)'
@echo ' EXTRA_GO_BUILD_LDFLAGS - extra flags to pass to the Go linker'
@echo ' EXTRA_GO_BUILD_FLAGS - extra flags to pass to the Go builder'
@echo ' EXTRA_GO_BUILD_FLAGS - extra flags to pass to the Go builder'
Copy link
Member Author

Choose a reason for hiding this comment

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

sad copy pasting here, wanted to add EXTRA_TESTFLAGS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/enhancement This improves or streamlines existing functionality
Projects
None yet
2 participants