-
Notifications
You must be signed in to change notification settings - Fork 7
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
Enable Building Both libjbpf.a and libjbpf.so with cmake option -DJBPF_STATIC=Both #22
base: main
Are you sure you want to change the base?
Conversation
@doctorlai-msrc Can you please explain why we cannot build both the static and the dynamic library by default? Why |
We can, however, building both would double the time. |
Why would it double the time? Have you profiled this? Could you share some numbers? |
Because building both will have two
|
The default (JBPF_STATIC=off) and the case when building both take similar time according to this profiling, so in my view we should build both by default, as it simplifies the build process. |
CMakeLists.txt
Outdated
add_definitions(-DJBPF_SHARED_LIB) | ||
elseif(JBPF_STATIC_OPTION_UPPER STREQUAL "ON") | ||
# Optional: Add definitions or logic for static builds if needed | ||
elseif(JBPF_STATIC_OPTION_UPPER STREQUAL "BOTH") |
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.
I think this introduces an a bug for the static build. If this option is set to "BOTH", then jbpf will be built with -DJBPF_SHARED_LIB enabled, which would introduce a bug in the produced .a due to this preprocessor check:
Line 44 in f55747a
#ifdef JBPF_SHARED_LIB |
When this option is set to "BOTH", we need to make sure that the static library is built without this flag enabled and the shared library is built with it.
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.
Fixed.
This PR changes the cmake option
JBPF_STATIC
to 3 states: On, Off and Both.When set to Both, both the
libjbpf.a
andlibjbpf.so
will be built