-
Notifications
You must be signed in to change notification settings - Fork 449
Adjusting Makefile.one and btfhub.sh with fixes and improvements. #1276
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
Adjusting Makefile.one and btfhub.sh with fixes and improvements. #1276
Conversation
@yanivagman this PR contain fixes to Makefile.one logic recently merged. Feel free to merge this, if you agree, or to steal this PR and do any adjustments it might need, as I'll be off for couple of weeks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it's a bit too much that every recipe needs to declare all the commands it will use
This was causing issues such as: make[1]: warning: -j24 forced in makefile: resetting jobserver mode. So its better to use $(PARALLEL) whenever we would like builds to be parallel by default (or to rely in user providing -jX to make as an argument).
Now, with a customized /etc/sudoers file, we're able to dictate which environment variables are automatically passed through "sudo". With that, the feature: $ sudo make -f builder/Makefile.docker alpine-shell (or ubuntu-shell) Automatically sets LIBBPFGO_OSRELEASE_FILE environment variable AND it is automatically passwed through sudo as well. This way, user is able to compile tracee-ebpf on the host (or inside tracee-make container): $ STATIC=1 BTFHUB=1 sudo make -f Makefile.one tracee-ebpf Spin up a tracee-make container (if not inside already): $ make -f builder/Makefile.docker alpine-prepare $ make -f builder/Makefile.docker alpine-shell And run tracee-ebpf with embedded BTF files identified correctly (reading /etc/os-release-host file, instead of /etc/os-release file). tracee@9b17259fe526[/tracee]$ sudo ./dist/tracee-ebpf --debug --trace 'event!=sched*' --output none KConfig: warning: could not check enabled kconfig features (could not read /boot/config-5.13.0-22-generic: stat ...) KConfig: warning: assuming kconfig values, might have unexpected behavior OSInfo: ID: ubuntu OSInfo: ID_LIKE: debian OSInfo: KERNEL_RELEASE: 5.13.0-22-generic OSInfo: ARCH: x86_64 OSInfo: PRETTY_NAME: "Ubuntu 21.10" OSInfo: VERSION_ID: "21.10" OSInfo: VERSION: "21.10 (Impish Indri)" OSInfo: VERSION_CODENAME: impish BTF: bpfenv = false, btfenv = false, vmlinux = true BPF: using embedded BPF object unpacked CO:RE bpf object file into memory KConfig: warning: assuming kconfig values, might have unexpected behavior ... Note: This commit also adds rsync dependency to tracee-make containers, so they can execute: $ STATIC=1 BTFHUB=1 sudo make -f Makefile.one tracee-ebpf correctly.
1. execute shell with -e 2. check for command requirements 3. document excluded BTF files
1. Fix the target dependency checks (per target so requirements are checked to each build target, based on its needs). 2. Keep a temporary (and gitignore'd) file that correspond to each of the requirement test being done. This is needed so the build targets are not rebuilt each time you call make for them (by keeping an unmodified file there is no need to re-run the build requirement). 3. Cover tooling versioning. There is not a check for Go and Clang versions so we can exit the build if requirements aren't met: - clang >= 12 - golang 1.16 or 1.17 4. Format style: keep ordered check requirements, so they're evaluated before the real build requirements. Keep each requirement in a different line to facilitate maintenance (patches adding and removing requirements and build flags).
Okay. I can remove checks for basic commands (such as CMD_RM, CMD_MKDIR, CMD_TOUCH, CMD_GREP, CMD_CAT). I'll keep the others, though, as they aren't "installed by default" such as those basic commands. |
@itaysk I have removed the basic checks now. |
Could someone else please take a look? Don't let me block you |
@yanivagman could you, please, review this one ? It's a bunch of needed fixes to Makefile.one and I would like to move on with it so I can generate the container images with the new Makefile and, finally, get rid of current building files. Thanks. |
@grantseltzer @danielpacak PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Please only check about go backwards compatibility
- improve go version detection: go => 1.16 now - improve clang version detection error message
bbf7da2 Makefile.one: build dependencies fixes
a8b8507 btfhub.sh: improvement and fixes
bcf796e tracee-make: fix dockerfiles sudoers and dependencies
6ffbad3 Makefile.one: default parallel jobs for libbpf build only