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


Groups > linux.kernel > #1453562

Re: [RFC 0/4] tools lib traceevent: Install fixes

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject Re: [RFC 0/4] tools lib traceevent: Install fixes
Date 2016-08-02 05:20 +0200
Message-ID <s1ypj-786-1@gated-at.bofh.it> (permalink)
References <s1pvH-YH-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Aug 01, 2016 at 07:41:28PM +0200, Jiri Olsa wrote:
> hi,
> sending traceevent changes to make this lib installable
> under rpm spec.
> 
> Basically adding support to:
>   - install header files
>   - install version links
> 
> Having this patchset applied over the fedora source,
> I could built following rpms:
> 
>   kernel-tools-libs
>   kernel-tools-libs-devel
> 
> with added libtraceevent stuff:
> 
>   $ rpm -ql kernel-tools-libs
>   /usr/lib64/libcpupower.so.0
>   /usr/lib64/libcpupower.so.0.0.0
>   /usr/lib64/libtraceevent.so.1
>   /usr/lib64/libtraceevent.so.1.1.0
> 
>   $ rpm -ql kernel-tools-libs-devel
>   /usr/include/cpufreq.h
>   /usr/include/traceevent
>   /usr/include/traceevent/event-parse.h
>   /usr/include/traceevent/event-utils.h
>   /usr/include/traceevent/kbuffer.h
>   /usr/lib64/libcpupower.so
>   /usr/lib64/libtraceevent.a
>   /usr/lib64/libtraceevent.so
> 
> and could build following ex.c outside the kernel tree:
> 
>   $ cat ex.c 
>   #include <traceevent/event-parse.h>
> 
>   int main(void)
>   {
>           struct pevent *pevent = pevent_alloc();
>           printf("krava %p\n", pevent);
>           return 0;
>   }
>   $ gcc -o ex ex.c -ltraceevent -ldl
>   $ ./ex
>   krava 0x10c6010
>   $

On my system, building ex.c with libtraceevent failed:

$ gcc -I ~/.local/include/ ex.c -L ~/.local/lib64 -ltraceevent -ldl
/home/namhyung/.local/lib64/libtraceevent.so: undefined reference to `str_error_r'
collect2: error: ld returned 1 exit status


Also I think it'd be better for libtraceevent has dependency to libdl
explicitly so that we can get rid of -ldl at the end.


From ac7dc027274cb31f5860c4cf6219ea7584611e17 Mon Sep 17 00:00:00 2001
From: Namhyung Kim <namhyung@kernel.org>
Date: Tue, 2 Aug 2016 12:03:00 +0900
Subject: [PATCH] tools lib traceevent: Add dependency to libdl

The libtraceevent has dependency to libdl due to plugins.  So if
external program wants to link libtraceevent it also needs to add -ldl
to the compiler command line.  Make it explicit so that external
programs doesn't care about the internel dependency of libtraceevent
anymore.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/lib/traceevent/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index c76012ebdb9c..bae0c090c638 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -173,7 +173,7 @@ $(TE_IN): force
 	$(Q)$(MAKE) $(build)=libtraceevent
 
 $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
-	$(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
+	$(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@ -ldl
 	@ln -sf $(@F) $(OUTPUT)libtraceevent.so
 	@ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)
 
-- 
2.9.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 0/4] tools lib traceevent: Install fixes Jiri Olsa <jolsa@kernel.org> - 2016-08-01 19:50 +0200
  [PATCH 3/4] tools lib traceevent: Rename LIB_FILE to LIB_TARGET Jiri Olsa <jolsa@kernel.org> - 2016-08-01 19:50 +0200
  [PATCH 1/4] tools lib traceevent: Add install_headers target Jiri Olsa <jolsa@kernel.org> - 2016-08-01 19:50 +0200
    Re: [PATCH 1/4] tools lib traceevent: Add install_headers target Namhyung Kim <namhyung@kernel.org> - 2016-08-02 04:40 +0200
      Re: [PATCH 1/4] tools lib traceevent: Add install_headers target Jiri Olsa <jolsa@redhat.com> - 2016-08-02 11:40 +0200
  Re: [RFC 0/4] tools lib traceevent: Install fixes Namhyung Kim <namhyung@kernel.org> - 2016-08-02 05:20 +0200
    [PATCH 1/2] tools lib traceevent: Ignore generated library files Namhyung Kim <namhyung@kernel.org> - 2016-08-02 07:20 +0200
      [PATCH 2/2] tools lib traceevent: Add str_error_r() Namhyung Kim <namhyung@kernel.org> - 2016-08-02 07:20 +0200
        Re: [PATCH 2/2] tools lib traceevent: Add str_error_r() Namhyung Kim <namhyung@kernel.org> - 2016-08-02 17:30 +0200
      [tip:perf/urgent] tools lib traceevent: Ignore generated library  files tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-08-04 11:40 +0200
    Re: [RFC 0/4] tools lib traceevent: Install fixes Jiri Olsa <jolsa@redhat.com> - 2016-08-02 11:40 +0200
      Re: [RFC 0/4] tools lib traceevent: Install fixes Steven Rostedt <rostedt@goodmis.org> - 2016-08-02 16:00 +0200
        Re: [RFC 0/4] tools lib traceevent: Install fixes Jiri Olsa <jolsa@redhat.com> - 2016-08-02 16:10 +0200
          Re: [RFC 0/4] tools lib traceevent: Install fixes Namhyung Kim <namhyung@kernel.org> - 2016-08-02 16:20 +0200
            Re: [RFC 0/4] tools lib traceevent: Install fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-08-02 16:20 +0200
          Re: [RFC 0/4] tools lib traceevent: Install fixes Steven Rostedt <rostedt@goodmis.org> - 2016-08-02 16:20 +0200
          Re: [RFC 0/4] tools lib traceevent: Install fixes Steven Rostedt <rostedt@goodmis.org> - 2016-08-05 16:20 +0200
            Re: [RFC 0/4] tools lib traceevent: Install fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-08-05 16:50 +0200
              Re: [RFC 0/4] tools lib traceevent: Install fixes Jiri Olsa <jolsa@redhat.com> - 2016-08-07 15:00 +0200

csiph-web