linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tools: perf: fix linker error when libelf config is disabled
@ 2017-01-10 10:22 Sudeep Holla
  2017-01-10 10:22 ` [PATCH 2/2] tools: perf: fix build error in uapi/linux/mman.h Sudeep Holla
  0 siblings, 1 reply; 4+ messages in thread
From: Sudeep Holla @ 2017-01-10 10:22 UTC (permalink / raw)
  To: linux-kernel, Arnaldo Carvalho de Melo
  Cc: Sudeep Holla, Jiri Olsa, Peter Zijlstra, Ingo Molnar, Stephane Eranian

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")
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
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(-)

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

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

* [PATCH 2/2] tools: perf: fix build error in uapi/linux/mman.h
  2017-01-10 10:22 [PATCH 1/2] tools: perf: fix linker error when libelf config is disabled Sudeep Holla
@ 2017-01-10 10:22 ` Sudeep Holla
  2017-01-10 14:43   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: Sudeep Holla @ 2017-01-10 10:22 UTC (permalink / raw)
  To: linux-kernel, Arnaldo Carvalho de Melo
  Cc: Sudeep Holla, Jiri Olsa, Wang Nan, Peter Zijlstra, Ingo Molnar

All the other occurrence refer "uapi/asm-generic/*.h" directly instead
of "uapi/asm/*.h" in tools/include except mman.h. Without this patch,
the following build failure is seen.

 In file included from util/event.c:2:0:
 tools/include/uapi/linux/mman.h:4:27: fatal error: uapi/asm/mman.h: No such file or directory
 compilation terminated.

Fixes: f3539c12d819 ("tools include: Add uapi mman.h for each architecture")
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 tools/include/uapi/linux/mman.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h
index 81d8edf11789..74a19ae15cd1 100644
--- a/tools/include/uapi/linux/mman.h
+++ b/tools/include/uapi/linux/mman.h
@@ -1,7 +1,7 @@
 #ifndef _UAPI_LINUX_MMAN_H
 #define _UAPI_LINUX_MMAN_H
 
-#include <uapi/asm/mman.h>
+#include <uapi/asm-generic/mman.h>
 
 #define MREMAP_MAYMOVE	1
 #define MREMAP_FIXED	2
-- 
2.7.4

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

* Re: [PATCH 2/2] tools: perf: fix build error in uapi/linux/mman.h
  2017-01-10 10:22 ` [PATCH 2/2] tools: perf: fix build error in uapi/linux/mman.h Sudeep Holla
@ 2017-01-10 14:43   ` Arnaldo Carvalho de Melo
  2017-01-10 17:13     ` Sudeep Holla
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-01-10 14:43 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: linux-kernel, Jiri Olsa, Wang Nan, Peter Zijlstra, Ingo Molnar, acme

Em Tue, Jan 10, 2017 at 10:22:50AM +0000, Sudeep Holla escreveu:
> All the other occurrence refer "uapi/asm-generic/*.h" directly instead
> of "uapi/asm/*.h" in tools/include except mman.h. Without this patch,
> the following build failure is seen.
> 

Seen where? I don't see it here, and I build perf for lots of different
systems:

  # time dm
   1 alpine:3.4: Ok
   2 android-ndk:r12b-arm: Ok
   3 archlinux:latest: Ok
   4 centos:5: Ok
   5 centos:6: Ok
   6 centos:7: Ok
   7 debian:7: Ok
   8 debian:8: Ok
   9 debian:experimental: Ok
  10 debian:experimental-x-arm64: Ok
  11 debian:experimental-x-mips64: Ok
  12 debian:experimental-x-mipsel: Ok
  13 fedora:20: Ok
  14 fedora:21: Ok
  15 fedora:22: Ok
  16 fedora:23: Ok
  17 fedora:24: Ok
  18 fedora:24-x-ARC-uClibc: Ok
  19 fedora:25: Ok
  20 fedora:rawhide: Ok
  21 mageia:5: Ok
  22 opensuse:13.2: Ok
  23 opensuse:42.1: Ok
  24 opensuse:tumbleweed: Ok
  25 ubuntu:12.04.5: Ok
  26 ubuntu:14.04.4-x-linaro-arm64: Ok
  27 ubuntu:15.10: Ok
  28 ubuntu:16.04: Ok
  29 ubuntu:16.04-x-arm: Ok
  30 ubuntu:16.04-x-arm64: Ok
  31 ubuntu:16.04-x-powerpc: Ok
  32 ubuntu:16.04-x-powerpc64: Ok
  33 ubuntu:16.04-x-powerpc64el: Ok
  34 ubuntu:16.04-x-s390: Ok
  35 ubuntu:16.10: Ok

The ones for cross compiling (-x-) mostly don't have the full set of
devel packages, but even so, I am not seeing this problem, can you
please describe more precisely the environment where you notice this
problem?

Assuming this is on ARM, based on your e-mail address, for instance,
debian:experimental-x-arm64 is built with this Dockerfile, look at the
packages used:

[root@jouet x-arm64]# cat Dockerfile 
# docker.io/acmel/linux-perf-tools-build-debian:experimental-x-arm64
FROM docker.io/debian:experimental
MAINTAINER Arnaldo Carvalho de Melo <acme@kernel.org>
#ENV DEBIAN_FRONTEND noninteractive
# libelf-dev, a host package, is needed to build objtool, that will run
# on the host checking target object files. It is also needed for samples/bpf/,
# but that is disabled as cross compilation is not available for it, would require
# a cross clang, etc.
# objtool is disabled because it requires a per arch function that is
# missing for
# arm64:
# make[1]: Leaving directory '/git/linux/tools/objtool'
#   LINK     /tmp/build/objtool/objtool
# /tmp/build/objtool/objtool-in.o: In function `decode_instructions':
# /git/linux/tools/objtool/builtin-check.c:296: undefined reference to `arch_decode_instruction'
# collect2: error: ld returned 1 exit status
# Makefile:45: recipe for target '/tmp/build/objtool/objtool' failed
# make: *** [/tmp/build/objtool/objtool] Error 1
# make: Leaving directory '/git/linux/tools/objtool'
# debian:experimental-x-arm64: FAIL
ENV ARCH arm64
ENV TARGET aarch64-linux-gnu
RUN dpkg --add-architecture ${ARCH} && \
    apt-get -y update && \
    apt-get -y install \
	make flex bison \
	crossbuild-essential-${ARCH} \
	libaudit-dev:${ARCH} \
	libdw-dev:${ARCH} \
	libelf-dev:${ARCH} \
	liblzma-dev:${ARCH} \
	libnuma-dev:${ARCH} \
	libperl-dev:${ARCH} \
	libslang2-dev:${ARCH} \
	libssl-dev:${ARCH} \
	libunwind-dev:${ARCH} \
	systemtap-sdt-dev:${ARCH} && \
    apt-get -y clean && \
    rm -rf /usr/share/doc /usr/share/gtk-doc /usr/share/locale /usr/share/man && \
    mkdir -m 777 -p /tmp/build/perf /tmp/build/objtool /tmp/build/linux && \
    groupadd -r perfbuilder && \
    useradd -m -r -g perfbuilder perfbuilder && \
    unset TARGET INSTALLDIR TARGETMACH CROSS CC LD AS && \
    chown -R perfbuilder.perfbuilder /tmp/build/
USER perfbuilder
ENTRYPOINT make ARCH=${ARCH} CROSS_COMPILE=${TARGET}- -C /git/linux/tools/perf O=/tmp/build/perf && \
	   rm -rf /tmp/build/perf/{.[^.]*,*} && \
	   make ARCH=${ARCH} CROSS_COMPILE=${TARGET}- -C /git/linux/tools/perf O=/tmp/build/perf NO_LIBELF=1
#	   make ARCH=${ARCH} CROSS_COMPILE=${TARGET}- -C /git/linux/tools/objtool O=/tmp/build/objtool && \
#	   make ARCH=${ARCH} CROSS_COMPILE=${TARGET}- -C /git/linux O=/tmp/build/linux allmodconfig && \
#	   make ARCH=${ARCH} CROSS_COMPILE=${TARGET}- -C /git/linux O=/tmp/build/linux headers_install && \
#	   make ARCH=${ARCH} CROSS_COMPILE=${TARGET}- -C /git/linux O=/tmp/build/linux samples/bpf/
[root@jouet x-arm64]#

>  In file included from util/event.c:2:0:
>  tools/include/uapi/linux/mman.h:4:27: fatal error: uapi/asm/mman.h: No such file or directory
>  compilation terminated.
> 
> Fixes: f3539c12d819 ("tools include: Add uapi mman.h for each architecture")
> Cc: Wang Nan <wangnan0@huawei.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  tools/include/uapi/linux/mman.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h
> index 81d8edf11789..74a19ae15cd1 100644
> --- a/tools/include/uapi/linux/mman.h
> +++ b/tools/include/uapi/linux/mman.h
> @@ -1,7 +1,7 @@
>  #ifndef _UAPI_LINUX_MMAN_H
>  #define _UAPI_LINUX_MMAN_H
>  
> -#include <uapi/asm/mman.h>
> +#include <uapi/asm-generic/mman.h>
>  
>  #define MREMAP_MAYMOVE	1
>  #define MREMAP_FIXED	2
> -- 
> 2.7.4

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

* Re: [PATCH 2/2] tools: perf: fix build error in uapi/linux/mman.h
  2017-01-10 14:43   ` Arnaldo Carvalho de Melo
@ 2017-01-10 17:13     ` Sudeep Holla
  0 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2017-01-10 17:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Sudeep Holla, linux-kernel, Jiri Olsa, Wang Nan, Peter Zijlstra,
	Ingo Molnar, acme



On 10/01/17 14:43, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jan 10, 2017 at 10:22:50AM +0000, Sudeep Holla escreveu:
>> All the other occurrence refer "uapi/asm-generic/*.h" directly instead
>> of "uapi/asm/*.h" in tools/include except mman.h. Without this patch,
>> the following build failure is seen.
>>
> 
> Seen where? I don't see it here, and I build perf for lots of different
> systems:
> 

[...]

> The ones for cross compiling (-x-) mostly don't have the full set of
> devel packages, but even so, I am not seeing this problem, can you
> please describe more precisely the environment where you notice this
> problem?
> 
> Assuming this is on ARM, based on your e-mail address, for instance,
> debian:experimental-x-arm64 is built with this Dockerfile, look at the
> packages used:

In fact this is on x86_64. I noticed the actual difference today when I
was experimenting further.

make ARCH=x86_64 -C tools O=/tmp/perf perf ----> fails to build
make -C tools O=/tmp/perf perf ----> Builds fine

-- 
Regards,
Sudeep

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

end of thread, other threads:[~2017-01-10 17:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-10 10:22 [PATCH 1/2] tools: perf: fix linker error when libelf config is disabled Sudeep Holla
2017-01-10 10:22 ` [PATCH 2/2] tools: perf: fix build error in uapi/linux/mman.h Sudeep Holla
2017-01-10 14:43   ` Arnaldo Carvalho de Melo
2017-01-10 17:13     ` Sudeep Holla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).