-
Notifications
You must be signed in to change notification settings - Fork 164
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
fix(cmake): fixed shared libs and pkg config files #1842
base: master
Are you sure you want to change the base?
fix(cmake): fixed shared libs and pkg config files #1842
Conversation
Welcome @Apteryks! It looks like this is your first PR to falcosecurity/libs 🎉 |
192681c
to
816a718
Compare
I've now successfully built sysdig against a shared library falcosecurity-libs distinct package with this series, on GNU Guix. |
Hi! Thanks for this PR! cc @federico-sysdig @geraldcombs EDIT: i will edit the PR title and body to follow our template (as per our commit convention: https://github.com/falcosecurity/.github/blob/main/CONTRIBUTING.md#commit-convention) |
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.
It's an interesting PR and there's excellent work on the corrections for the generated pkgconfig files.
I do believe that something else is desirable for the management of the dependent libraries other than the proposed generator expressions.
I'm curious; I have tried to implement the ability to integrate falcosecurity/libs
in a client project through find_package
, which is a better, more CMake-oriented, way to use a library. This is not to say that pkgconfig should be left behind, just another option. What are your thoughts on that?
I'll get to these in a bit.
My immediate thought on this is that a |
Of course, I wasn't suggesting to change the scope of this PR. |
The "build-shared-libs-macos-amd64" job is failing because CFlags in libscap.pc no longer includes
|
816a718
to
5b0dea2
Compare
The Cflags of the libscap.pc file shouldn't have changed; I've only added two new entries to them. For example, on my machine, the old copy (master) looks like:
With this change it now reads:
Probably this header was found via libsinsp.pc, which was capturing a lot of build-specific, non-installed directories, which I think shouldn't be baked in the generated .pc file. Previously, it looked like:
Now, it looks like:
|
/milestone 0.18.0 |
5b0dea2
to
c8ea84a
Compare
Issues go stale after 90d of inactivity. Mark the issue as fresh with Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with Provide feedback via https://github.com/falcosecurity/community. /lifecycle stale |
/remove-lifecycle stale |
Hi! Can you rebase on latest master? |
This is to so that includes work whether using e.g. #include <scap.h> or #include <libscap/scap.h>, and likewise for libsinp. * userspace/libsinsp/libsinsp.pc.in (Cflags): Add include directive for falcosecurity/driver. * userspace/libscap/libscap.pc.in: Likewise. Also add include directive for uthash. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This is needed when linking to the static scap library, as its pkg-config file contains an '-lpman' directive. * userspace/libpman/CMakeLists.txt: New install target. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Previously, an erroneous -linstall_lib_link_libraries-NOTFOUND directive could be added to the configured libscap.pc pkg-config file. * cmake/modules/libscap.cmake: Ensure ${install_lib_link_library} is true. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
* driver/CMakeLists.txt (DRIVER_SOURCES): Add missing headers. * userspace/libscap/engine/gvisor/CMakeLists.txt [BUILD_SHARED_LIBS]: Add missing include directories. * test/libscap/CMakeLists.txt (LIBSCAP_TESTS_LIBRARIES): Add ${PROTOBUF_LIB}. Fixes: falcosecurity#1820 Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
The generated pkg-config file now makes use of pkg-config Requires and Requires.static fields, which should reduce over-linking when linking to shared libraries. * userspace/libscap/libscap.pc.in (prefix): Set directly to CMAKE_INSTALL_PREFIX. (Libs): Add -L{libdir}/@LIBS_PACKAGE_NAME@/libscap. * userspace/libsinsp/CMakeLists.txt: Separate libraries into pkg-config Requires and Requires.private lists. Do not infer from installable targets. * userspace/libsinsp/libsinsp.pc.in (Requires): Add @LIBSINSP_REQUIRES@. (Requires.private): New field. (Libs): Replace @SINSP_PKG_CONFIG_LIBDIRS@ and @SINSP_PKG_CONFIG_LIBS@ with @LIBSINSP_LINK_FLAGS@. (Cflags): Remove @SINSP_PKG_CONFIG_INCLUDES@ and @SINSP_PKG_CONFIG_INCLUDES@/driver. Add -I${includedir}/@LIBS_PACKAGE_NAME@/driver. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
c8ea84a
to
f74a20d
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Apteryks The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I just rebased on top of latest master. 🙏 |
Perf diff from master - unit tests
Heap diff from master - unit tests
Heap diff from master - scap file
Benchmarks diff from master
|
Care to give it a look @Apteryks ? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1842 +/- ##
=======================================
Coverage 74.20% 74.20%
=======================================
Files 253 253
Lines 30832 30832
Branches 5394 5394
=======================================
Hits 22880 22880
+ Misses 7934 7924 -10
- Partials 18 28 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Moving to next milestone since we are nearing a release and this is not ready. |
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area build
/area libscap-engine-gvisor
/area libpman
/area libsinsp
What this PR does / why we need it:
It sanitizes the generated pkg-config files of libscap.pc and libsinsp.pc, and add missing includes needed to build as shared libraries.
Which issue(s) this PR fixes:
Fixes #1820
Special notes for your reviewer:
Also see #1825, which is not addressed by this PR but can be easily worked around.
Does this PR introduce a user-facing change?: