linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] trace-cmd: fix building of the python interface
@ 2016-11-14 11:55 Andreas Platschek
  2016-11-14 11:55 ` [PATCH 1/2] trace-cmd: Makefile - link all trace-* objects into ctracecmd.so Andreas Platschek
  2016-11-14 11:55 ` [PATCH 2/2] trace-cmd: python interface: add global variables to swig interface Andreas Platschek
  0 siblings, 2 replies; 4+ messages in thread
From: Andreas Platschek @ 2016-11-14 11:55 UTC (permalink / raw)
  To: rostedt; +Cc: linux-kernel, Andreas Platschek

Build the python interface I experienced some problems, the following
changes fixed those problems.

Andreas Platschek (2):
  trace-cmd: Makefile - link all trace-* objects into ctracecmd.so
  trace-cmd: python interface: add global variables to swig interface

 Makefile    |    3 ++-
 ctracecmd.i |    2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

-- 
1.7.10.4

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

* [PATCH 1/2] trace-cmd: Makefile - link all trace-* objects into ctracecmd.so
  2016-11-14 11:55 [PATCH 0/2] trace-cmd: fix building of the python interface Andreas Platschek
@ 2016-11-14 11:55 ` Andreas Platschek
  2016-11-15 21:49   ` Steven Rostedt
  2016-11-14 11:55 ` [PATCH 2/2] trace-cmd: python interface: add global variables to swig interface Andreas Platschek
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Platschek @ 2016-11-14 11:55 UTC (permalink / raw)
  To: rostedt; +Cc: linux-kernel, Andreas Platschek

Got a few undefined symbols when using the Python interface to trace-cmd,
the first one was:

root@wheezy:~/trace-cmd# python tracecmd.py
Traceback (most recent call last):
  File "tracecmd.py", line 22, in <module>
    from ctracecmd import *
ImportError: /home/andi/working_git/trace-cmd/ctracecmd.so: undefined symbol: get_file_content

linking the objects that contain those symbols fixes the problem.

Signed-off-by: Andreas Platschek <andreas.platschek@opentech.at>
---
 Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 62cb25b..f86cb77 100644
--- a/Makefile
+++ b/Makefile
@@ -344,7 +344,8 @@ TCMD_LIB_OBJS = $(PEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \
 			trace-output.o trace-record.o trace-recorder.o \
 			trace-restore.o trace-usage.o trace-blk-hack.o \
 			kbuffer-parse.o event-plugin.o trace-hooks.o \
-			trace-msg.o
+			trace-msg.o trace-stat.o trace-listen.o trace-stream.o \
+			trace-read.o trace-profile.o trace-hash.o
 
 PLUGIN_OBJS =
 PLUGIN_OBJS += plugin_jbd2.o
-- 
1.7.10.4

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

* [PATCH 2/2] trace-cmd: python interface: add global variables to swig interface
  2016-11-14 11:55 [PATCH 0/2] trace-cmd: fix building of the python interface Andreas Platschek
  2016-11-14 11:55 ` [PATCH 1/2] trace-cmd: Makefile - link all trace-* objects into ctracecmd.so Andreas Platschek
@ 2016-11-14 11:55 ` Andreas Platschek
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Platschek @ 2016-11-14 11:55 UTC (permalink / raw)
  To: rostedt; +Cc: linux-kernel, Andreas Platschek

Since trace-read.o is now linked into the python library, the global
variable silence_warnings and show_status (defined in trace-cmd.c for
trace-cmd) used in trace-read.c are also defined in the swig interface.

This way the two variables are exposed to python as
tracecmd.cvar.silence_warnings and tracecmd.cvar.show_status .

If this is not done, running tracecmd.py will fail due to undefined
symbols:

root@wheezy:/home/andi/working_git/trace-cmd# python tracecmd.py
Traceback (most recent call last):
  File "tracecmd.py", line 22, in <module>
    from ctracecmd import *
ImportError: /home/andi/working_git/trace-cmd/ctracecmd.so: undefined symbol: silence_warnings

Signed-off-by: Andreas Platschek <andreas.platschek@opentech.at>
---
 ctracecmd.i |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/ctracecmd.i b/ctracecmd.i
index e91d068..7800470 100644
--- a/ctracecmd.i
+++ b/ctracecmd.i
@@ -35,6 +35,8 @@ static int python_callback(struct trace_seq *s,
 			   void *context);
 
 static int skip_output = 0;
+int silence_warnings;
+int show_status;
 
 static void py_supress_trace_output(void)
 {
-- 
1.7.10.4

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

* Re: [PATCH 1/2] trace-cmd: Makefile - link all trace-* objects into ctracecmd.so
  2016-11-14 11:55 ` [PATCH 1/2] trace-cmd: Makefile - link all trace-* objects into ctracecmd.so Andreas Platschek
@ 2016-11-15 21:49   ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2016-11-15 21:49 UTC (permalink / raw)
  To: Andreas Platschek; +Cc: linux-kernel

On Mon, 14 Nov 2016 11:55:42 +0000
Andreas Platschek <andreas.platschek@opentech.at> wrote:

> Got a few undefined symbols when using the Python interface to trace-cmd,
> the first one was:
> 
> root@wheezy:~/trace-cmd# python tracecmd.py
> Traceback (most recent call last):
>   File "tracecmd.py", line 22, in <module>
>     from ctracecmd import *
> ImportError: /home/andi/working_git/trace-cmd/ctracecmd.so: undefined symbol: get_file_content
> 
> linking the objects that contain those symbols fixes the problem.
> 
> Signed-off-by: Andreas Platschek <andreas.platschek@opentech.at>
> ---
>  Makefile |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 62cb25b..f86cb77 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -344,7 +344,8 @@ TCMD_LIB_OBJS = $(PEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \
>  			trace-output.o trace-record.o trace-recorder.o \
>  			trace-restore.o trace-usage.o trace-blk-hack.o \
>  			kbuffer-parse.o event-plugin.o trace-hooks.o \
> -			trace-msg.o
> +			trace-msg.o trace-stat.o trace-listen.o trace-stream.o \
> +			trace-read.o trace-profile.o trace-hash.o

Actually, I can't do this. The files in the library are licensed under
LGPL, but these files you added are all GPL.

There's a reason I separated them as such. I guess we may be able to
move things out of the files if they are properly authored. That is, if
I wrote them. Some code I took and used in trace-cmd came from GPL v2
code, so those must remain GPL v2.

-- Steve

>  
>  PLUGIN_OBJS =
>  PLUGIN_OBJS += plugin_jbd2.o

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

end of thread, other threads:[~2016-11-15 21:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-14 11:55 [PATCH 0/2] trace-cmd: fix building of the python interface Andreas Platschek
2016-11-14 11:55 ` [PATCH 1/2] trace-cmd: Makefile - link all trace-* objects into ctracecmd.so Andreas Platschek
2016-11-15 21:49   ` Steven Rostedt
2016-11-14 11:55 ` [PATCH 2/2] trace-cmd: python interface: add global variables to swig interface Andreas Platschek

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).