[lttng-dev] [PATCH lttng-tools] Fix link: move -lrt at the end of the link line

Simon Marchi simon.marchi at polymtl.ca
Wed Apr 10 11:44:19 EDT 2013


The problem was mentionned on the mailing list a few days ago [1].

"Recent" Ubuntus pass --as-needed to the linker [2], which makes it
sensitive to the ordering of libraries on the command line. Libraries
that resolve undefined symbols of other libs or objects must be
specified after those other libs or objects (much like the behavior of
old linkers, if I understand correctly). timer_settime is used in one
of the LTTng libs and is defined in librt, so librt must be put after
it. Me trying to compile lttng-tools on Ubuntu without the patch [3].

[1] http://lists.lttng.org/pipermail/lttng-dev/2013-March/019929.html
[2] https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition
[3] http://pastebin.com/G2pSkseF

On 10 April 2013 10:22, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> * Simon Marchi (simon.marchi at polymtl.ca) wrote:
>> It has to be after libconsumer.la.
>>
>
> why, what issue does it fix ?
>
>> Signed-off-by: Simon Marchi <simon.marchi at polymtl.ca>
>> ---
>>  src/bin/lttng-consumerd/Makefile.am |    5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/bin/lttng-consumerd/Makefile.am b/src/bin/lttng-consumerd/Makefile.am
>> index a418eb4..d340c68 100644
>> --- a/src/bin/lttng-consumerd/Makefile.am
>> +++ b/src/bin/lttng-consumerd/Makefile.am
>> @@ -4,10 +4,11 @@ lttnglibexec_PROGRAMS = lttng-consumerd
>>
>>  lttng_consumerd_SOURCES = lttng-consumerd.c lttng-consumerd.h
>>
>> -lttng_consumerd_LDADD = -lrt \
>> +lttng_consumerd_LDADD = \
>>          $(top_builddir)/src/common/libconsumer.la \
>>          $(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la \
>> -        $(top_builddir)/src/common/libcommon.la
>> +        $(top_builddir)/src/common/libcommon.la \
>> +        -lrt
>>
>>  if HAVE_LIBLTTNG_UST_CTL
>>  lttng_consumerd_LDADD += -llttng-ust-ctl
>> --
>> 1.7.10.4
>>
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev at lists.lttng.org
>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com



More information about the lttng-dev mailing list