Abseil as shared lib.

101 views
Skip to first unread message

Marcin Kepa

unread,
Jul 18, 2018, 4:33:14 PM7/18/18
to Abseil.io
Can anyone tell me why abseil force build and using it as static library?
Would I have problems if I would build it as shared?

And it seems its not good idea to use abseil freely from shared libs. (by default its not build with fPIC either)
So I would like to use it as shared libs, will it hit me somehow later?

Greg Falcon

unread,
Jul 18, 2018, 5:07:15 PM7/18/18
to kepa....@gmail.com, Abseil.io
Historically, Google has not used Abseil code inside dynamic libraries.  So the claim that Abseil is "battle tested" really only applies to static linking.

We believe in and follow the live-at-head philosophy, where all code is built from trunk/head, and static linking makes this much more practical.  Abseil can't accommodate version skew between binaries and various shared libraries will introduce serious problems.

In particular, note that Abseil does not guarantee ABI compatibility, only source compatibility.  If a binary built from one revision of Abseil links in a shared library build against a different revision, things are not expected to work.  If you get away with it, it's only "by accident".  Building all code from source is the best way to avoid these problems.

Still, there may be times when shared libraries are needed (for plug-in frameworks, say).  If users can guarantee all code will be built from the same version of code (possibly by using an LTS branch), it may be possible to offer some support for shared libraries.  One of my tasks over the next month or two is to investigate this very issue, and see what support of shared libraries we can offer, and what issues (like issue 125) we can fix.

I'll know more after I do my investigation.  My hunch is that loading of shared libraries on startup, when versions are identical, could perhaps be possible.  We probably will not be able to safely support unloading of shared libraries -- usually when we allocate a large permanent buffer, we do not release it at_exit, so this would be a source of leaks.

Greg F

--
You received this message because you are subscribed to the Google Groups "Abseil.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to abseil-io+...@googlegroups.com.
To post to this group, send email to abse...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/abseil-io/b1c81666-cba4-4ac6-b7ca-4ab8a9c50938%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thomas Bolioli

unread,
Nov 9, 2022, 11:26:24 AM11/9/22
to Abseil.io
Sorry for resurrecting this from the dead, but it's terribly on point to my question so I figured I would start here. Is there any update on the ability to build shared objects in abseil? We are 100% in the "times when shared libraries are needed (for plug-in frameworks, say)" and I would prefer to not have to ship archives and instead have .so's inside the system for plugin use.

Thanks,
Tom
Reply all
Reply to author
Forward
0 new messages