On Fri, Dec 23, 2022 at 12:03:38AM -0500, Steven Rostedt wrote: > On Wed, 21 Dec 2022 18:08:44 +0100 > Daniel Wagner <dwagner@xxxxxxx> wrote: > > > Add support for building the project with meson. > > > > trace-cmd depends on a statically linked libtracecmd > > (e.g. trace_perf_open, trace_perf_close, trace_perf_init). > > > > That means before kicking off the trace-cmd build a statically build > > libtracecmd needs to be available: > > > > cd lib > > meson setup --prefix=/tmp/trace-cmd --default-library=static .build > > meson compile -C .build > > meson install -C .build > > > > I get this: > > Run-time dependency audit found: NO (tried pkgconfig and cmake) > > meson.build:77:0: ERROR: Dependency "audit" not found, tried pkgconfig and cmake > > audit is an optional dependency. Is there a way to do that? And add > defines set if it is not? Yes sure. I've just got it wrong in the meson_option.txt file: instead option('audit', type : 'boolean', value : true, description : 'build with audit support') it should be option('audit', type : 'boolean', value : false, description : 'build with audit support') Then this here audit_dep = dependency('audit', required: get_option('audit')) will not fail. Though if the system has audit-devel install it will still use it (this is a Meson feature). > What's the reason for the "get_option('audit')"? Oh, you are right. we could just do audit_dep = dependency('audit', required: false) here. > Doesn't seem to be working as expected. There is one thing to keep in mind. If you don't want Meson to use a dependency 'required: false' will not do the trick. This has been discussed in github issues in the Meson project many times and the outcome is that is on purpose. There are workaround for this but I expect that Meson's developer would tell us it's wrong to workaround :) > > +libtraceevent_dep = dependency('libtraceevent', version: '>= 1.7.0', required: true) > > +libtracefs_dep = dependency('libtracefs', version: '>= 1.6.3', required: true) > > +libtracecmd_dep = dependency('libtracecmd', version: '>= 1.3.0', required: true, > > I'm guessing you just looked at the latest version and added them? Yes, that's correct. > Min versions are: > > libtraceevent is 1.5 > libtracefs 1.6 Okay, I'll change this accordingly. > And since this holds libtracecmd, does it really need a dependency? IIRC, I saw that the CFLAGS from libtraceevent are used for the trace-cmd, but I might just miss something. If trace-cmd doesn't use libtraceevent or libtracefs directly than it should be possible to drop these direct dependencies. Daniel