All of lore.kernel.org
 help / color / mirror / Atom feed
* LTTng unfriendly with mixed static/dynamic linking
@ 2014-07-25 18:48 Adam Crume
  2014-07-25 21:22 ` Adam Crume
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Crume @ 2014-07-25 18:48 UTC (permalink / raw)
  To: ceph-devel

[-- Attachment #1: Type: text/plain, Size: 2039 bytes --]

LTTng requires tracepoints to be linked into a program only once.  If
tracepoints are linked in multiple times, the program crashes at
startup with: "LTTng-UST: Error (-17) while registering tracepoint
probe. Duplicate registration of tracepoint probes having the same
name is not allowed."

This is problematic when mixing static and dynamic linking.  If the
tracepoints are in a static library, that library can end up in an
executable multiple times by being linked in directly, as well as
being statically linked into a dynamic library.  Even if the
tracepoints are not linked directly into the executable, they can be
statically linked into multiple dynamic libraries that the executable
loads.

For us, this problem shows up with libcommon, and could show up with
others such as libosd.  (In general, I think anything added to
noinst_LTLIBRARIES is static, and anything added to lib_LTLIBRARIES is
dynamic.)

There are a few ways of solving the issue:
1. Change every library that has tracepoints, like libcommon, from
static to dynamic.  This could be a big change, as at the very least
we'd have to rename the library to something like libceph_common to
avoid conflicts, since now it would be an installed file.  This has
the advantage of keeping code and its tracepoints in the same library.
2. Keep tracepoints in a separate static library.  For example,
libcommon and libcommon_tp.  Unfortunately, every executable (but not
library!) that links in libcommon (directly or indirectly) would have
to manually link in libcommon_tp, and I don't think Automake could
automate that.
3. Keep tracepoints in a separate dynamic library.  In this case, I
think libcommon could depend on libcommon_tp, so executables would not
have to manually link in libcommon_tp.  (I'm not an Automake expert,
so let me know if I'm wrong on that.)  Again, libcommon_tp would be an
installed file, so we'd want to rename it to something like
libceph_common_tp.

I attached a minimal test case of the problem.

Thoughts or suggestions?

Thanks,
Adam Crume

[-- Attachment #2: lttng-duplicate-tracepoints.tar.gz --]
[-- Type: application/x-gzip, Size: 950 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-08-12 20:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-25 18:48 LTTng unfriendly with mixed static/dynamic linking Adam Crume
2014-07-25 21:22 ` Adam Crume
2014-07-25 22:12   ` Sage Weil
2014-07-26 10:29     ` Joao Eduardo Luis
2014-08-12 19:41       ` Adam Crume
2014-08-12 19:50         ` Sage Weil
2014-08-12 20:30           ` Adam Crume
2014-08-12 19:54         ` Noah Watkins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.