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

Sysdig fails to build with grpc 1.41 #1778

Closed
mtorromeo opened this issue Sep 30, 2021 · 9 comments
Closed

Sysdig fails to build with grpc 1.41 #1778

mtorromeo opened this issue Sep 30, 2021 · 9 comments

Comments

@mtorromeo
Copy link
Contributor

As per the title, I am having some trouble building sysdig against grpc 1.41.0 on Arch.

The build fails at the linking phase with the following error:

/usr/bin/ld: ../libsinsp/libsinsp.a(cri.grpc.pb.cc.o): undefined reference to symbol '_ZN4absl12lts_202103245MutexD1Ev'
/usr/bin/ld: /usr/lib/libabsl_synchronization.so.2103.0.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

It is my understanding that the problem is due to ABI incompatibility between grpc and abseil-cpp being built using c++17 while sysdig uses c++0x.

This has been a potential problem for a while, but it happened to work just fine with grpc up to version 1.39.0.

I tried building sysdig with c++17 as well, patching the cmake files where necessary, but it fails with a different type of error with the code generated by protobuf, I think. I don't have the log handy at the moment, but I can try it again and paste it here later if you need it.

Thanks

@hhoffstaette
Copy link
Contributor

hhoffstaette commented Oct 8, 2021

The problem is not the C++ standard (it reprouces when building everything with c++17) but that code that links against grpc-1.41 also needs to link a new dependency required by grpc itself (libabsl_synchronization) so it could be a bug in grpc, though it looks more like something missing in libsinsp's grpc support.
Just now I added -labsl_synchronization to the LINK_LIBRARIES in my generated Ninja build file (after the grpc libs), restarted the build and it linked correctly. The binary works too. :)
I'll see if I can figure out the best way to add this, though I'm working on making 0.27.1 work (on Gentoo) instead of git master, which is very different.

@hhoffstaette
Copy link
Contributor

hhoffstaette commented Oct 8, 2021

I'm not sure how useful this is for current master, but the patch here makes 0.27.1 build/link/work against grpc-1.41 for me on Gentoo (without any bundled deps), even with all of abseil-cpp/grpc/sysdig built with LTO. :)

@mtorromeo
Copy link
Contributor Author

@hhoffstaette thanks for the patch, but it doesn't seem like that's the same issue.

As you can see in the log of my error, the absl_synchronization lib is already being linked. In fact I did try the patch anyway and it still didn't compile with the same error.

@mtorromeo
Copy link
Contributor Author

Nevermind, it works. I was looking at the wrong log.

Thanks again!

@krop
Copy link

krop commented Oct 13, 2021

I'm not sure how useful this is for current master, but the patch here makes 0.27.1 build/link/work against grpc-1.41 for me on Gentoo (without any bundled deps), even with all of abseil-cpp/grpc/sysdig built with LTO. :)

I'm looking at the same failure for openSUSE. The link call needs to be in a block that first checks if the library was found, or it will cause errors when building with older grpc.
i.e.:

if(ABSL_SYNC_LIB)
  target_link_libraries(sinsp "${ABSL_SYNC_LIB}")
endif()

When sysdig updates the minimum CMake version, this could be converted to a generator expression.

The build still fails but not because of this issue anymore :)

carlocab added a commit to carlocab/homebrew-core that referenced this issue Oct 19, 2021
We need the patch adopted by Arch Linux and reported upstream at
draios/sysdig#1778 to build this on Linux.
carlocab added a commit to Homebrew/homebrew-core that referenced this issue Oct 21, 2021
We need the patch adopted by Arch Linux and reported upstream at
draios/sysdig#1778 to build this on Linux.

Also, skip the libscap examples, and don't force a C++ standard. This
leads to build failures.
@FedeDP
Copy link
Contributor

FedeDP commented Nov 24, 2021

@mtorromeo I opened a PR to fix build using system grpc: falcosecurity/libs#144.
Tested on arch myself.

Hopefully it will get merged soon :)

@FedeDP
Copy link
Contributor

FedeDP commented Dec 9, 2021

The PR on libs is now merged; Sysdig still points to an older one though.

@FedeDP
Copy link
Contributor

FedeDP commented Dec 17, 2021

Sysdig 0.28 should built with system grpc! @mtorromeo any feedback?
As far as i can see, you are already building against system grpc: https://archlinux.org/packages/community/x86_64/sysdig/.
Can we close this one?

@mtorromeo
Copy link
Contributor Author

@FedeDP yes, it works fine now. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants