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

fix(userspace/libsinsp): Include cri.hpp in container.cpp #1895

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

geraldcombs
Copy link
Contributor

Include cri.hpp in container.cpp in order to avoid

/usr/bin/ld: /usr/lib/aarch64-linux-gnu/libsinsp.so: undefined reference to `libsinsp::cri::cri_interface<libsinsp::cri::cri_api_v1>::get_cri_runtime_type() const'
collect2: error: ld returned 1 exit status

when building with shared libs on Linux.

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area API-version

/area build

/area CI

/area driver-kmod

/area driver-bpf

/area driver-modern-bpf

/area libscap-engine-bpf

/area libscap-engine-gvisor

/area libscap-engine-kmod

/area libscap-engine-modern-bpf

/area libscap-engine-nodriver

/area libscap-engine-noop

/area libscap-engine-source-plugin

/area libscap-engine-savefile

/area libscap

/area libpman

/area libsinsp

/area tests

/area proposals

Does this PR require a change in the driver versions?

/version driver-API-version-major

/version driver-API-version-minor

/version driver-API-version-patch

/version driver-SCHEMA-version-major

/version driver-SCHEMA-version-minor

/version driver-SCHEMA-version-patch

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Include cri.hpp in container.cpp in order to avoid

```
/usr/bin/ld: /usr/lib/aarch64-linux-gnu/libsinsp.so: undefined reference to `libsinsp::cri::cri_interface<libsinsp::cri::cri_api_v1>::get_cri_runtime_type() const'
collect2: error: ld returned 1 exit status
```

when building with shared libs on Linux.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
@@ -20,6 +20,7 @@ limitations under the License.

#if !defined(MINIMAL_BUILD) && !defined(__EMSCRIPTEN__)
#include <libsinsp/container_engine/cri.h>
#include <libsinsp/cri.hpp>
Copy link
Contributor

@FedeDP FedeDP Jun 5, 2024

Choose a reason for hiding this comment

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

Mmmh i don't see get_cri_runtime_type referenced anywhere in container.cpp. Is this the right place to include cri.hpp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's due to container.cpp indirectly including userspace/cri.h, which has:

using cri_interface_v1alpha2 = cri_interface<cri_api_v1alpha2>;
using cri_interface_v1 = cri_interface<cri_api_v1>;

When I try to build a Debian package here, libsinsp.so ends up with undefined get_cri_runtime_type symbols:

$ nm libsinsp/libsinsp.so | grep get_cri_runtime_type
00000000002e0810 T _ZNK8libsinsp16container_engine3cri20get_cri_runtime_typeEv
                 U _ZNK8libsinsp3cri13cri_interfaceINS0_10cri_api_v1EE20get_cri_runtime_typeEv
                 U _ZNK8libsinsp3cri13cri_interfaceINS0_16cri_api_v1alpha2EE20get_cri_runtime_typeEv

Maybe a better option would be to include libsinsp/cri.hpp instead of libsinsp/cri.h in userspace/container_engine/cri.h, or to combine userspace/cri.h and userspace.hpp?

It's also possible that the combination of CMake options in the Debian rules file is triggering this but I didn't see anything obvious.

Copy link
Contributor

Choose a reason for hiding this comment

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

Weird :/ anyway, the fix is so small that i wouldn't care much :) let's ship it!

Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link
Contributor

poiana commented Jun 11, 2024

LGTM label has been added.

Git tree hash: a332c1ed6615a5176f344de845843851df06afde

@FedeDP
Copy link
Contributor

FedeDP commented Jun 11, 2024

/milestone 0.18.0

@poiana poiana added this to the 0.18.0 milestone Jun 11, 2024
Copy link
Member

@Andreagit97 Andreagit97 left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link
Contributor

poiana commented Jun 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, FedeDP, geraldcombs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit e3eb9f4 into falcosecurity:master Jun 11, 2024
39 of 40 checks passed
@FedeDP
Copy link
Contributor

FedeDP commented Aug 1, 2024

/milestone 0.17.3

@poiana poiana modified the milestones: 0.18.0, 0.17.3 Aug 1, 2024
@LucaGuerra LucaGuerra mentioned this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants