Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1550827 > unrolled thread

[PATCH] tools: perf: fix linker error when libelf config is disabled

Started bySudeep Holla <sudeep.holla@arm.com>
First post2017-01-04 15:00 +0100
Last post2017-01-04 19:00 +0100
Articles 11 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tools: perf: fix linker error when libelf config is disabled Sudeep Holla <sudeep.holla@arm.com> - 2017-01-04 15:00 +0100
    Re: [PATCH] tools: perf: fix linker error when libelf config is  disabled Jiri Olsa <jolsa@redhat.com> - 2017-01-04 15:50 +0100
      Re: [PATCH] tools: perf: fix linker error when libelf config is  disabled Sudeep Holla <sudeep.holla@arm.com> - 2017-01-04 17:00 +0100
    [PATCH v2] tools: perf: fix linker error when libelf config is disabled Sudeep Holla <sudeep.holla@arm.com> - 2017-01-04 17:00 +0100
      Re: [PATCH v2] tools: perf: fix linker error when libelf config is  disabled Sudeep Holla <sudeep.holla@arm.com> - 2017-01-04 17:10 +0100
        Re: [PATCH v2] tools: perf: fix linker error when libelf config is  disabled Sudeep Holla <sudeep.holla@arm.com> - 2017-01-04 17:20 +0100
          Re: [PATCH v2] tools: perf: fix linker error when libelf config is  disabled Jiri Olsa <jolsa@redhat.com> - 2017-01-04 18:30 +0100
            Re: [PATCH v2] tools: perf: fix linker error when libelf config is  disabled Sudeep Holla <sudeep.holla@arm.com> - 2017-01-04 18:40 +0100
      Re: [PATCH v2] tools: perf: fix linker error when libelf config is  disabled Jiri Olsa <jolsa@redhat.com> - 2017-01-04 17:10 +0100
      Re: [PATCH v3] tools: perf: fix linker error when libelf config is  disabled Jiri Olsa <jolsa@redhat.com> - 2017-01-04 18:40 +0100
      [PATCH v3] tools: perf: fix linker error when libelf config is disabled Sudeep Holla <sudeep.holla@arm.com> - 2017-01-04 19:00 +0100

#1550827 — [PATCH] tools: perf: fix linker error when libelf config is disabled

FromSudeep Holla <sudeep.holla@arm.com>
Date2017-01-04 15:00 +0100
Subject[PATCH] tools: perf: fix linker error when libelf config is disabled
Message-ID<sVUgF-5oR-5@gated-at.bofh.it>
When libelf is disabled in the configuration, we get the following
linker error:
  LINK     libperf-jvmti.so
  ld: cannot find -lelf
  Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed

This patch fixes the error by using the configuration macro EXTLIBS.

Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 8fc24824705e..6defd9b00bc4 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -512,7 +512,7 @@ $(LIBJVMTI_IN): FORCE
 	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
 
 $(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
-	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
+	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< $(EXTLIBS) -lrt
 endif
 
 $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
-- 
2.7.4

[toc] | [next] | [standalone]


#1550873 — Re: [PATCH] tools: perf: fix linker error when libelf config is disabled

FromJiri Olsa <jolsa@redhat.com>
Date2017-01-04 15:50 +0100
SubjectRe: [PATCH] tools: perf: fix linker error when libelf config is disabled
Message-ID<sVV34-5Z1-1@gated-at.bofh.it>
In reply to#1550827
On Wed, Jan 04, 2017 at 01:52:40PM +0000, Sudeep Holla wrote:
> When libelf is disabled in the configuration, we get the following
> linker error:
>   LINK     libperf-jvmti.so
>   ld: cannot find -lelf
>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
> 
> This patch fixes the error by using the configuration macro EXTLIBS.
> 
> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  tools/perf/Makefile.perf | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 8fc24824705e..6defd9b00bc4 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -512,7 +512,7 @@ $(LIBJVMTI_IN): FORCE
>  	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
>  
>  $(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
> -	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
> +	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< $(EXTLIBS) -lrt
>  endif

hm, do we need -lelf -lrt at all? can't see reason for that

jirka

[toc] | [prev] | [next] | [standalone]


#1550951 — Re: [PATCH] tools: perf: fix linker error when libelf config is disabled

FromSudeep Holla <sudeep.holla@arm.com>
Date2017-01-04 17:00 +0100
SubjectRe: [PATCH] tools: perf: fix linker error when libelf config is disabled
Message-ID<sVW8O-6Ds-17@gated-at.bofh.it>
In reply to#1550873

On 04/01/17 14:45, Jiri Olsa wrote:
> On Wed, Jan 04, 2017 at 01:52:40PM +0000, Sudeep Holla wrote:
>> When libelf is disabled in the configuration, we get the following
>> linker error:
>>   LINK     libperf-jvmti.so
>>   ld: cannot find -lelf
>>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
>>
>> This patch fixes the error by using the configuration macro EXTLIBS.
>>
>> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Jiri Olsa <jolsa@kernel.org>
>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>> ---
>>  tools/perf/Makefile.perf | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
>> index 8fc24824705e..6defd9b00bc4 100644
>> --- a/tools/perf/Makefile.perf
>> +++ b/tools/perf/Makefile.perf
>> @@ -512,7 +512,7 @@ $(LIBJVMTI_IN): FORCE
>>  	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
>>  
>>  $(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
>> -	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
>> +	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< $(EXTLIBS) -lrt
>>  endif
> 
> hm, do we need -lelf -lrt at all? can't see reason for that

I agree as it links well without libelf. I was not sure if enabling
libelf has any issue removing it, hence I retained. I will remove both
and repost. Thanks for having a look.

-- 
Regards,
Sudeep

[toc] | [prev] | [next] | [standalone]


#1550946 — [PATCH v2] tools: perf: fix linker error when libelf config is disabled

FromSudeep Holla <sudeep.holla@arm.com>
Date2017-01-04 17:00 +0100
Subject[PATCH v2] tools: perf: fix linker error when libelf config is disabled
Message-ID<sVW8N-6Ds-3@gated-at.bofh.it>
In reply to#1550827
When libelf is disabled in the configuration, we get the following
linker error:
  LINK     libperf-jvmti.so
  ld: cannot find -lelf
  Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed

Jiri pointed out that both librt and libelf are not really required. So
this patch fixes the linker error by getting rid of unwanted libraries
in the linker stage.

Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v1->v2:
	- Dropped libelf and librt as they are not required

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 8fc24824705e..9e4a7ea84637 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -512,7 +512,7 @@ $(LIBJVMTI_IN): FORCE
 	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti

 $(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
-	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
+	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
 endif

 $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
--
2.7.4

[toc] | [prev] | [next] | [standalone]


#1550954 — Re: [PATCH v2] tools: perf: fix linker error when libelf config is disabled

FromSudeep Holla <sudeep.holla@arm.com>
Date2017-01-04 17:10 +0100
SubjectRe: [PATCH v2] tools: perf: fix linker error when libelf config is disabled
Message-ID<sVWit-6Xe-9@gated-at.bofh.it>
In reply to#1550946

On 04/01/17 16:06, Jiri Olsa wrote:
> On Wed, Jan 04, 2017 at 03:56:03PM +0000, Sudeep Holla wrote:
>> When libelf is disabled in the configuration, we get the following
>> linker error:
>>   LINK     libperf-jvmti.so
>>   ld: cannot find -lelf
>>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
>>
>> Jiri pointed out that both librt and libelf are not really required. So
>> this patch fixes the linker error by getting rid of unwanted libraries
>> in the linker stage.
>>
>> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
> 
> hum, AFAICS it linked -lelf and -lrt even before right? ;-)
> 

Yes, sorry I forgot to remove that and trace it back the actual commit.

-- 
Regards,
Sudeep

[toc] | [prev] | [next] | [standalone]


#1550959 — Re: [PATCH v2] tools: perf: fix linker error when libelf config is disabled

FromSudeep Holla <sudeep.holla@arm.com>
Date2017-01-04 17:20 +0100
SubjectRe: [PATCH v2] tools: perf: fix linker error when libelf config is disabled
Message-ID<sVWs9-72d-19@gated-at.bofh.it>
In reply to#1550954

On 04/01/17 16:08, Sudeep Holla wrote:
> 
> 
> On 04/01/17 16:06, Jiri Olsa wrote:
>> On Wed, Jan 04, 2017 at 03:56:03PM +0000, Sudeep Holla wrote:
>>> When libelf is disabled in the configuration, we get the following
>>> linker error:
>>>   LINK     libperf-jvmti.so
>>>   ld: cannot find -lelf
>>>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
>>>
>>> Jiri pointed out that both librt and libelf are not really required. So
>>> this patch fixes the linker error by getting rid of unwanted libraries
>>> in the linker stage.
>>>
>>> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
>>
>> hum, AFAICS it linked -lelf and -lrt even before right? ;-)
>>
> 
> Yes, sorry I forgot to remove that and trace it back the actual commit.
> 

Having looked at it again, it looks new additions in the above commit.
It may be a copied from somewhere else but I can't trace it back :(.
I need your help if you want to get rid of that ;)

-- 
Regards,
Sudeep

[toc] | [prev] | [next] | [standalone]


#1551005 — Re: [PATCH v2] tools: perf: fix linker error when libelf config is disabled

FromJiri Olsa <jolsa@redhat.com>
Date2017-01-04 18:30 +0100
SubjectRe: [PATCH v2] tools: perf: fix linker error when libelf config is disabled
Message-ID<sVXxT-7HR-9@gated-at.bofh.it>
In reply to#1550959
On Wed, Jan 04, 2017 at 04:18:10PM +0000, Sudeep Holla wrote:
> 
> 
> On 04/01/17 16:08, Sudeep Holla wrote:
> > 
> > 
> > On 04/01/17 16:06, Jiri Olsa wrote:
> >> On Wed, Jan 04, 2017 at 03:56:03PM +0000, Sudeep Holla wrote:
> >>> When libelf is disabled in the configuration, we get the following
> >>> linker error:
> >>>   LINK     libperf-jvmti.so
> >>>   ld: cannot find -lelf
> >>>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
> >>>
> >>> Jiri pointed out that both librt and libelf are not really required. So
> >>> this patch fixes the linker error by getting rid of unwanted libraries
> >>> in the linker stage.
> >>>
> >>> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
> >>
> >> hum, AFAICS it linked -lelf and -lrt even before right? ;-)
> >>
> > 
> > Yes, sorry I forgot to remove that and trace it back the actual commit.
> > 
> 
> Having looked at it again, it looks new additions in the above commit.
> It may be a copied from somewhere else but I can't trace it back :(.
> I need your help if you want to get rid of that ;)

I think it's this one:
  209045adc2bb perf tools: add JVMTI agent library

jirka

[toc] | [prev] | [next] | [standalone]


#1551011 — Re: [PATCH v2] tools: perf: fix linker error when libelf config is disabled

FromSudeep Holla <sudeep.holla@arm.com>
Date2017-01-04 18:40 +0100
SubjectRe: [PATCH v2] tools: perf: fix linker error when libelf config is disabled
Message-ID<sVXHA-7LF-17@gated-at.bofh.it>
In reply to#1551005

On 04/01/17 17:19, Jiri Olsa wrote:
> On Wed, Jan 04, 2017 at 04:18:10PM +0000, Sudeep Holla wrote:
>>
>>
>> On 04/01/17 16:08, Sudeep Holla wrote:
>>>
>>>
>>> On 04/01/17 16:06, Jiri Olsa wrote:
>>>> On Wed, Jan 04, 2017 at 03:56:03PM +0000, Sudeep Holla wrote:
>>>>> When libelf is disabled in the configuration, we get the following
>>>>> linker error:
>>>>>   LINK     libperf-jvmti.so
>>>>>   ld: cannot find -lelf
>>>>>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
>>>>>
>>>>> Jiri pointed out that both librt and libelf are not really required. So
>>>>> this patch fixes the linker error by getting rid of unwanted libraries
>>>>> in the linker stage.
>>>>>
>>>>> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")
>>>>
>>>> hum, AFAICS it linked -lelf and -lrt even before right? ;-)
>>>>
>>>
>>> Yes, sorry I forgot to remove that and trace it back the actual commit.
>>>
>>
>> Having looked at it again, it looks new additions in the above commit.
>> It may be a copied from somewhere else but I can't trace it back :(.
>> I need your help if you want to get rid of that ;)
> 
> I think it's this one:
>   209045adc2bb perf tools: add JVMTI agent library

Thanks for that, I would never have figured this out myself. Will fix
that and send out v3.

-- 
Regards,
Sudeep

[toc] | [prev] | [next] | [standalone]


#1550955 — Re: [PATCH v2] tools: perf: fix linker error when libelf config is disabled

FromJiri Olsa <jolsa@redhat.com>
Date2017-01-04 17:10 +0100
SubjectRe: [PATCH v2] tools: perf: fix linker error when libelf config is disabled
Message-ID<sVWit-6Xe-11@gated-at.bofh.it>
In reply to#1550946
On Wed, Jan 04, 2017 at 03:56:03PM +0000, Sudeep Holla wrote:
> When libelf is disabled in the configuration, we get the following
> linker error:
>   LINK     libperf-jvmti.so
>   ld: cannot find -lelf
>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
> 
> Jiri pointed out that both librt and libelf are not really required. So
> this patch fixes the linker error by getting rid of unwanted libraries
> in the linker stage.
> 
> Fixes: d4dfdf00d43e ("perf jvmti: Plug compilation into perf build")

hum, AFAICS it linked -lelf and -lrt even before right? ;-)

jirka

[toc] | [prev] | [next] | [standalone]


#1551012 — Re: [PATCH v3] tools: perf: fix linker error when libelf config is disabled

FromJiri Olsa <jolsa@redhat.com>
Date2017-01-04 18:40 +0100
SubjectRe: [PATCH v3] tools: perf: fix linker error when libelf config is disabled
Message-ID<sVXHA-7LF-35@gated-at.bofh.it>
In reply to#1550946
On Wed, Jan 04, 2017 at 05:30:02PM +0000, Sudeep Holla wrote:
> When libelf is disabled in the configuration, we get the following
> linker error:
>   LINK     libperf-jvmti.so
>   ld: cannot find -lelf
>   Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
> 
> Jiri pointed out that both librt and libelf are not really required. So
> this patch fixes the linker error by getting rid of unwanted libraries
> in the linker stage.
> 
> Fixes: 209045adc2bb ("perf tools: add JVMTI agent library")
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Stephane Eranian <eranian@google.com>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

[toc] | [prev] | [next] | [standalone]


#1551042 — [PATCH v3] tools: perf: fix linker error when libelf config is disabled

FromSudeep Holla <sudeep.holla@arm.com>
Date2017-01-04 19:00 +0100
Subject[PATCH v3] tools: perf: fix linker error when libelf config is disabled
Message-ID<sVXHA-7LF-37@gated-at.bofh.it>
In reply to#1550946
When libelf is disabled in the configuration, we get the following
linker error:
  LINK     libperf-jvmti.so
  ld: cannot find -lelf
  Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed

Jiri pointed out that both librt and libelf are not really required. So
this patch fixes the linker error by getting rid of unwanted libraries
in the linker stage.

Fixes: 209045adc2bb ("perf tools: add JVMTI agent library")
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v2->v3:
	- Corrected the original commit under "Fixes:" tag that
	  introduced the libraries initially
v1->v2:
	- Dropped libelf and librt as they are not required

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 8fc24824705e..9e4a7ea84637 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -512,7 +512,7 @@ $(LIBJVMTI_IN): FORCE
 	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti

 $(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
-	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
+	$(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
 endif

 $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
--
2.7.4

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web