* [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path @ 2022-07-07 12:15 Daniel Wagner 2022-07-07 12:15 ` [RFC v1 2/2] libtracefs: Add initial support for meson Daniel Wagner 2022-07-07 13:47 ` [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path Steven Rostedt 0 siblings, 2 replies; 5+ messages in thread From: Daniel Wagner @ 2022-07-07 12:15 UTC (permalink / raw) To: linux-trace-users; +Cc: Daniel Wagner The libtraceevent pkg-config generated by meson is not adding the subdirectory to the CLFAGS. This is generally a good idea in order to avoid any file name collisions. Hence use explicit include paths for libtraceevent. Signed-off-by: Daniel Wagner <dwagner@suse.de> --- include/tracefs.h | 2 +- src/tracefs-events.c | 2 +- src/tracefs-filter.c | 2 +- src/tracefs-sqlhist.c | 2 +- src/tracefs-utils.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/tracefs.h b/include/tracefs.h index 693860d47a56..dd339464ca0e 100644 --- a/include/tracefs.h +++ b/include/tracefs.h @@ -8,7 +8,7 @@ #include <fcntl.h> #include <sched.h> -#include <event-parse.h> +#include <libtraceevent/event-parse.h> char *tracefs_get_tracing_file(const char *name); void tracefs_put_tracing_file(char *name); diff --git a/src/tracefs-events.c b/src/tracefs-events.c index 65d5707362c6..ebff59e4cb7a 100644 --- a/src/tracefs-events.c +++ b/src/tracefs-events.c @@ -15,7 +15,7 @@ #include <fcntl.h> #include <limits.h> -#include <kbuffer.h> +#include <libtraceevent/kbuffer.h> #include "tracefs.h" #include "tracefs-local.h" diff --git a/src/tracefs-filter.c b/src/tracefs-filter.c index 85d0be17f6b7..cac4e255d7d4 100644 --- a/src/tracefs-filter.c +++ b/src/tracefs-filter.c @@ -6,7 +6,7 @@ * Copyright (C) 2021, VMware, Tzvetomir Stoyanov <tz.stoyanov@gmail.com> * */ -#include <trace-seq.h> +#include <libtraceevent/trace-seq.h> #include <stdlib.h> #include <ctype.h> #include <errno.h> diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c index 27c9c82647e4..fbdf29d5bebb 100644 --- a/src/tracefs-sqlhist.c +++ b/src/tracefs-sqlhist.c @@ -6,7 +6,7 @@ * Copyright (C) 2021, VMware, Tzvetomir Stoyanov <tz.stoyanov@gmail.com> * */ -#include <trace-seq.h> +#include <libtraceevent/trace-seq.h> #include <stdlib.h> #include <stdarg.h> #include <ctype.h> diff --git a/src/tracefs-utils.c b/src/tracefs-utils.c index 22f82afe032b..c1260d3c7c8a 100644 --- a/src/tracefs-utils.c +++ b/src/tracefs-utils.c @@ -15,8 +15,8 @@ #include <unistd.h> #include <errno.h> -#include <event-parse.h> -#include <event-utils.h> +#include <libtraceevent/event-parse.h> +#include <libtraceevent/event-utils.h> #include "tracefs.h" #include "tracefs-local.h" -- 2.36.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [RFC v1 2/2] libtracefs: Add initial support for meson 2022-07-07 12:15 [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path Daniel Wagner @ 2022-07-07 12:15 ` Daniel Wagner 2022-07-07 13:47 ` [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path Steven Rostedt 1 sibling, 0 replies; 5+ messages in thread From: Daniel Wagner @ 2022-07-07 12:15 UTC (permalink / raw) To: linux-trace-users; +Cc: Daniel Wagner Add support for building the project with meson. It's not complete yet, for example building and installing the documentation is missing. The rest should work as expected. The only thing I was not really clear what the purpose is the libtraceevent-dynamic-list which seems not be used or installed. The meson build will also generate the file but using the host nm and not the cross tool chain if any is used. I didn't want to invest too much time figuring out this detail if it is actually not used. Obviously, meson is not make and there are some changes in how to use this build system. The meson documentation is outstanding good and usually has good tips and tricks to solve problems. But sure there is learning curve but hopefully not so step. Anyway, as pure user the build steps are (in source tree builds are not supported): # configure using .build as build directory and install destination # /tmp/test meson .build --prefix=/tmp/test # trigger the build ninja -C .build # install the library ninja -C .build install I am using an alias for 'ninja -C .build' which is called 'ni'. This makes way more convenient to use. Signed-off-by: Daniel Wagner <dwagner@suse.de> --- include/meson.build | 9 ++++++++ meson.build | 32 +++++++++++++++++++++++++++ src/meson.build | 53 +++++++++++++++++++++++++++++++++++++++++++++ utest/meson.build | 14 ++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 include/meson.build create mode 100644 meson.build create mode 100644 src/meson.build create mode 100644 utest/meson.build diff --git a/include/meson.build b/include/meson.build new file mode 100644 index 000000000000..1bbfe8afb280 --- /dev/null +++ b/include/meson.build @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: LGPL-2.1 + +headers = [ + 'tracefs.h', +] + +foreach h : headers + install_headers(h, subdir : 'libtracefs') +endforeach diff --git a/meson.build b/meson.build new file mode 100644 index 000000000000..2138d2f149f1 --- /dev/null +++ b/meson.build @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: LGPL-2.1 + +project( + 'libtracefs', ['c'], + meson_version: '>= 0.47.0', + license: 'LGPL-2.1', + version: '1.4.0', + default_options: [ + 'c_std=gnu99', + 'buildtype=release', + 'prefix=/usr', + 'warning_level=1', + ] +) + +library_version = meson.project_version() + +libtraceevent_dep = dependency('libtraceevent', required: true) +cunit_dep = dependency('cunit', required : false) + +add_project_arguments( + [ + '-D_GNU_SOURCE', + ], + language : 'c', +) + +incdir = include_directories(['include']) + +subdir('src') +subdir('include') +subdir('utest') diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 000000000000..36d3be359fae --- /dev/null +++ b/src/meson.build @@ -0,0 +1,53 @@ +# SPDX-License-Identifier: LGPL-2.1 + +sources= [ + 'tracefs-dynevents.c', + 'tracefs-eprobes.c', + 'tracefs-events.c', + 'tracefs-filter.c', + 'tracefs-hist.c', + 'tracefs-instance.c', + 'tracefs-kprobes.c', + 'tracefs-marker.c', + 'tracefs-sqlhist.c', + 'tracefs-tools.c', + 'tracefs-uprobes.c', + 'tracefs-utils.c', +] + +flex = find_program('flex', required: true) +bison = find_program('bison', required: true) + +lgen = generator(flex, +output : '@PLAINNAME@.yy.c', +arguments : ['-o', '@OUTPUT@', '@INPUT@']) + +pgen = generator(bison, +output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'], +arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@']) + +lfiles = lgen.process('sqlhist.l') +pfiles = pgen.process('sqlhist.y') + +libtracefs = library( + 'tracefs', + sources, lfiles, pfiles, + version: library_version, + dependencies: [libtraceevent_dep], + include_directories: [incdir], + install: true, +) + +pkg = import('pkgconfig') +pkg.generate(libtracefs, + filebase: meson.project_name(), + name: meson.project_name(), + version: meson.project_version(), + description: 'Manage trace fs', + url: 'https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/', +) + +libtracefs_dep = declare_dependency( + include_directories: ['.'], + link_with: libtracefs, +) diff --git a/utest/meson.build b/utest/meson.build new file mode 100644 index 000000000000..07058afb5f9b --- /dev/null +++ b/utest/meson.build @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: LGPL-2.1 + +source = [ + 'trace-utest.c', + 'tracefs-utest.c', +] + +e = executable( + 'trace-utest', + source, + include_directories: [incdir], + dependencies: [libtracefs_dep, libtraceevent_dep, cunit_dep]) + +test('trace-utest', e) -- 2.36.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path 2022-07-07 12:15 [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path Daniel Wagner 2022-07-07 12:15 ` [RFC v1 2/2] libtracefs: Add initial support for meson Daniel Wagner @ 2022-07-07 13:47 ` Steven Rostedt 2022-07-07 14:07 ` Daniel Wagner 1 sibling, 1 reply; 5+ messages in thread From: Steven Rostedt @ 2022-07-07 13:47 UTC (permalink / raw) To: Daniel Wagner; +Cc: linux-trace-users On Thu, 7 Jul 2022 14:15:41 +0200 Daniel Wagner <dwagner@suse.de> wrote: > The libtraceevent pkg-config generated by meson is not adding the > subdirectory to the CLFAGS. This is generally a good idea in order to > avoid any file name collisions. Hence use explicit include paths for > libtraceevent. Is there a way to fix this. Honestly, I hate the libtraceevent name (should at least be traceevent), and I have been thinking of changing it. If we do not have pkg-config working and everything needs to add explicit include paths, then I'll never be able to change it, or even just get rid of the subdirectory. -- Steve ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path 2022-07-07 13:47 ` [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path Steven Rostedt @ 2022-07-07 14:07 ` Daniel Wagner 2022-07-07 14:26 ` Steven Rostedt 0 siblings, 1 reply; 5+ messages in thread From: Daniel Wagner @ 2022-07-07 14:07 UTC (permalink / raw) To: Steven Rostedt; +Cc: linux-trace-users On Thu, Jul 07, 2022 at 09:47:52AM -0400, Steven Rostedt wrote: > On Thu, 7 Jul 2022 14:15:41 +0200 > Daniel Wagner <dwagner@suse.de> wrote: > > > The libtraceevent pkg-config generated by meson is not adding the > > subdirectory to the CLFAGS. This is generally a good idea in order to > > avoid any file name collisions. Hence use explicit include paths for > > libtraceevent. > > Is there a way to fix this. Honestly, I hate the libtraceevent name (should > at least be traceevent), and I have been thinking of changing it. I suppose we can change pkg-config so that the complete path is included, with the downside that file name collisions are more likely to happen. E.g. the kbuffer.h is very a generic name. In libnvme/nvme-cli we had some troubles consuming libuuid because of inconsistent use of include paths. As far I can tell we just need to state what the correct includes paths are. > If we do not have pkg-config working and everything needs to add explicit > include paths, then I'll never be able to change it, or even just get rid > of the subdirectory. I am not really expert how to structure the include paths. As said, I think the most important bit is that we use it consistent. Let me try to add the include path to pkg-config. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path 2022-07-07 14:07 ` Daniel Wagner @ 2022-07-07 14:26 ` Steven Rostedt 0 siblings, 0 replies; 5+ messages in thread From: Steven Rostedt @ 2022-07-07 14:26 UTC (permalink / raw) To: Daniel Wagner; +Cc: linux-trace-users On Thu, 7 Jul 2022 16:07:23 +0200 Daniel Wagner <dwagner@suse.de> wrote: > On Thu, Jul 07, 2022 at 09:47:52AM -0400, Steven Rostedt wrote: > > On Thu, 7 Jul 2022 14:15:41 +0200 > > Daniel Wagner <dwagner@suse.de> wrote: > > > > > The libtraceevent pkg-config generated by meson is not adding the > > > subdirectory to the CLFAGS. This is generally a good idea in order to > > > avoid any file name collisions. Hence use explicit include paths for > > > libtraceevent. > > > > Is there a way to fix this. Honestly, I hate the libtraceevent name (should > > at least be traceevent), and I have been thinking of changing it. > > I suppose we can change pkg-config so that the complete path is > included, with the downside that file name collisions are more likely to > happen. E.g. the kbuffer.h is very a generic name. Sorta-of ;-) That's actually the file I want to "claim" first! > > In libnvme/nvme-cli we had some troubles consuming libuuid because of > inconsistent use of include paths. As far I can tell we just need to > state what the correct includes paths are. > > > If we do not have pkg-config working and everything needs to add explicit > > include paths, then I'll never be able to change it, or even just get rid > > of the subdirectory. > > I am not really expert how to structure the include paths. As said, I > think the most important bit is that we use it consistent. Let me try to > add the include path to pkg-config. Thanks, -- Steve ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-07-07 14:26 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-07-07 12:15 [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path Daniel Wagner 2022-07-07 12:15 ` [RFC v1 2/2] libtracefs: Add initial support for meson Daniel Wagner 2022-07-07 13:47 ` [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path Steven Rostedt 2022-07-07 14:07 ` Daniel Wagner 2022-07-07 14:26 ` Steven Rostedt
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).