Re: [PATCH] Link ocount with librt for clock_gettime only when needed

Maynard Johnson <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
On 08/08/2014 12:50 PM, Carl Love wrote:
> On Fri, 2014-08-08 at 09:45 -0700, Carl Love wrote:
>> On Fri, 2014-08-08 at 10:45 -0500, Maynard Johnson wrote:
>>> Link ocount with librt for clock_gettime only when needed
>>>
>>> With GLIBC 2.17, the clock_* functions were moved from librt
>>> to libc. The ocount tool uses clock_gettime. This patch adds
>>> a configure check to determine whether or not to link with
>>> "-lrt".
>>>
>>> Signed-off-by: Maynard Johnson <[email protected]>
>> Acked-by: Carl Love <[email protected]>
>>
>> I don't see any issues with the patch.  I tested on a PPC64 BE. It
>> checked out fine.
>>
> 
> I should have mentioned that the PPC64 system had
> glibc-2.12-1.132.el6.ppc64 installed on it and a Power 7 processor
> 
> I did some additional testing using Fedora 19 with
> glibc-2.17-20.fc19.ppc64p7 on an X86 64bit laptop.  The patch checked
> out fine on this system.
> 
> I ran on a PPC64 system, Power 7 processor, running 
> Red Hat Enterprise Linux Server release 7.0 Beta (Maipo) with
> glibc-2.17-52.el7.ppc64.  The patch also checked out fine on this
> system.
Thanks for the review and testing.  Patch applied.

-Maynard
> 
>             Carl Love
> 
>>
>>> ---
>>>  configure.ac            |    6 ++++++
>>>  pe_counting/Makefile.am |    4 ++--
>>>  2 files changed, 8 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index d80ec1b..a84c9be 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -395,6 +395,12 @@ AM_CONDITIONAL(CHECK_ACCOUNT, test "x$enable_account_check" = "xyes")
>>>  AC_SUBST(OP_CFLAGS)
>>>  AC_SUBST(OP_CXXFLAGS)
>>>
>>> +AC_CHECK_FUNC(clock_gettime, [], [
>>> +	AC_CHECK_LIB(rt, clock_gettime, RT_LIB="-lrt",
>>> +		AC_MSG_ERROR(Unable to find clock_gettime function; required by ocount))])
>>> +AC_SUBST(RT_LIB)
>>> +
>>> +
>>>  # fixups for config.h
>>>  if test "$prefix" = "NONE"; then
>>>  	my_op_prefix="$ac_default_prefix"
>>> diff --git a/pe_counting/Makefile.am b/pe_counting/Makefile.am
>>> index c46fd74..fadd4d9 100644
>>> --- a/pe_counting/Makefile.am
>>> +++ b/pe_counting/Makefile.am
>>> @@ -1,4 +1,4 @@
>>> -LIBS=@LIBERTY_LIBS@ @PFM_LIB@
>>> +LIBS=@LIBERTY_LIBS@ @PFM_LIB@ @RT_LIB@
>>>  if BUILD_FOR_PERF_EVENT
>>>
>>>  AM_CPPFLAGS = \
>>> @@ -19,7 +19,7 @@ AM_CXXFLAGS = @OP_CXXFLAGS@
>>>  AM_LDFLAGS = @OP_LDFLAGS@
>>>
>>>  bin_PROGRAMS = ocount
>>> -ocount_LDADD = -lrt ../libpe_utils/libpe_utils.a \
>>> +ocount_LDADD = ../libpe_utils/libpe_utils.a \
>>>  	../libpe_utils/libpe_utils.a \
>>>  	../libop/libop.a \
>>>  	../libutil/libutil.a \
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Want fast and easy access to all the code in your enterprise? Index and
>> search up to 200,000 lines of code with a free copy of Black Duck
>> Code Sight - the same software that powers the world's largest code
>> search on Ohloh, the Black Duck Open Hub! Try it now.
>> http://p.sf.net/sfu/bds
>> _______________________________________________
>> oprofile-list mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/oprofile-list
>>
> 
> 


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.