-
Notifications
You must be signed in to change notification settings - Fork 733
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
Stripped and musl build options #1682
Conversation
A minimal build is a build that only produces a sysdig, scap and sinsp artifact containing the bare minimum to let them do the syscall instrumentation. This means no kubernetes, container and mesos support. Container interfaces are kept to allow a third party to hook container support externally. Signed-off-by: Lorenzo Fontana <[email protected]>
Minimal builds will still be able to produce and read scap files but not compressed ones. Signed-off-by: Lorenzo Fontana <[email protected]>
Signed-off-by: Lorenzo Fontana <[email protected]>
Signed-off-by: Lorenzo Fontana <[email protected]>
Signed-off-by: Lorenzo Fontana <[email protected]>
Signed-off-by: Lorenzo Fontana <[email protected]>
Signed-off-by: Lorenzo Fontana <[email protected]>
Co-Authored-By: Leonardo Grasso <[email protected]> Signed-off-by: Lorenzo Fontana <[email protected]>
Co-Authored-By: Leonardo Grasso <[email protected]> Signed-off-by: Lorenzo Fontana <[email protected]>
We need to patch the CRI proto while under musl because musl does not fully respect the standard and defines stdin, stdout and stderr as compile time constants. However, those are already defined in cri.proto and that is a reference collision. see: https://git.musl-libc.org/cgit/musl/tree/include/stdio.h?id=0b0640219338b80cf47026d1970b5503414ed7f3#n60 Co-Authored-By: Leonardo Grasso <[email protected]> Signed-off-by: Lorenzo Fontana <[email protected]>
Co-Authored-By: Lorenzo Fontana <[email protected]> Signed-off-by: Leonardo Grasso <[email protected]>
Co-authored-by: Lorenzo Fontana <[email protected]> Signed-off-by: Leonardo Di Donato <[email protected]>
Co-authored-by: Lorenzo Fontana <[email protected]> Signed-off-by: Leonardo Di Donato <[email protected]>
Co-authored-by: Lorenzo Fontana <[email protected]> Signed-off-by: Leonardo Di Donato <[email protected]>
Co-authored-by: Lorenzo Fontana <[email protected]> Signed-off-by: Leonardo Di Donato <[email protected]>
Co-authored-by: Lorenzo Fontana <[email protected]> Signed-off-by: Leonardo Di Donato <[email protected]>
Co-authored-by: Lorenzo Fontana <[email protected]> Signed-off-by: Leonardo Di Donato <[email protected]>
…o be used only when input was not an IP Co-authored-by: Lorenzo Fontana <[email protected]> Signed-off-by: Leonardo Di Donato <[email protected]>
Co-Authored-By: Leonardo Di Donato <[email protected]> Signed-off-by: Lorenzo Fontana <[email protected]>
Co-authored-by: Lorenzo Fontana <[email protected]> Signed-off-by: Leonardo Di Donato <[email protected]>
…t a minimal one Co-authored-by: Lorenzo Fontana <[email protected]> Signed-off-by: Leonardo Di Donato <[email protected]>
…ed only when build is not a minimal one Co-authored-by: Lorenzo Fontana <[email protected]> Signed-off-by: Leonardo Di Donato <[email protected]>
Co-Authored-By: Leonardo Di Donato <[email protected]> Signed-off-by: Lorenzo Fontana <[email protected]>
Co-authored-by: Leonardo Grasso <[email protected]> Signed-off-by: Leonardo Di Donato <[email protected]>
Co-Authored-By: Leonardo Di Donato <[email protected]> Co-Authored-By: Leonardo Grasso <[email protected]> Signed-off-by: Lorenzo Fontana <[email protected]>
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.
👏
that's hell of a PR just to circumvent lack of getaddrinfo_a in POSIX conformant libcs.
instead we get a "musl profile", an embedded 3rd party library and lots of cmake options... |
Will be active in the next release upstream commits: draios/sysdig#1682 73554b9c48b06612eb50494ee6fa5b779c57edc0
Will be active in the next release upstream commits: draios/sysdig#1682 73554b9c48b06612eb50494ee6fa5b779c57edc0
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.
The changes made for build problems with musl did not fix the problem but encoded a dependency on implementation details which are not public interfaces. Comments inline. Hope this worked right - it's my first time using the GitHub review system.
endif() | ||
|
||
if(MUSL_OPTIMIZED_BUILD) | ||
set(SYSDIG_MUSL_FLAGS "-static -Os -D__NEED_struct_timespec -D__NEED_time_t") |
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.
These macros are not public interfaces. If they're fixing a build error for you, the underlying problem is that the file is failing to include <time.h>
. All headers in bits
are private implementation details and are only valid for inclusion from the other libc headers, not directly.
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.
Thanks for taking the time to look at this @richfelker - I'll try to fix this. To be honest, I found those by looking at the musl source code directly, I wasn't aware of this detail so thanks!
@@ -18,6 +18,9 @@ limitations under the License. | |||
*/ | |||
|
|||
#pragma once | |||
#ifdef MUSL_OPTIMIZED | |||
#include <bits/alltypes.h> |
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.
This should be <time.h>
and it should probably be included at the point where the types are needed rather than here.
@rofl0r PRs are welcome! |
@richfelker would you please take a look at #1684 if you can? :) |
LGTM |
This patch adds two new build options to the project
-DMINIMAL_BUILD=On
-DMUSL_OPTIMIZED_BUILD=On
-DUSE_BUNDLED_DEPS=On
These options can be used together to accomplish a minimal build that uses musl libc.
Todo:
getaddrinfo_a
right now we did it by doing a dumb wrapper (that will need to be changed before we merge this PR)gethostbyname
How to compile a static binary using musl?
The easiest way is to:
Goals
The main goal is to produce a 100% static sysdig binary that has no dependencies on the host libc and libraries.
Fixes #903