linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why does libtracevent pkg-config detection wipe PKG_CONFIG_PATH?
@ 2024-05-27  0:56 Mateusz Kowalczyk
  2024-05-28 16:09 ` James Clark
  2024-06-04 13:26 ` [PATCH] " Leo Yan
  0 siblings, 2 replies; 7+ messages in thread
From: Mateusz Kowalczyk @ 2024-05-27  0:56 UTC (permalink / raw)
  To: linux-perf-users

Hi,

To build recent perf, I'm having to apply the below patch.

```diff
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 7f1e016a9253..b70fef12a977 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -1181,7 +1181,7 @@ ifneq ($(NO_LIBTRACEEVENT),1)
     CFLAGS += -DHAVE_LIBTRACEEVENT $(LIBTRACEEVENT_CFLAGS)
     LDFLAGS += $(LIBTRACEEVENT_LDFLAGS)
     EXTLIBS += ${TRACEEVENTLIBS}
-    LIBTRACEEVENT_VERSION := $(shell PKG_CONFIG_PATH=$(LIBTRACEEVENT_DIR) $(PKG_CONFIG) --modversion libtraceevent)
+    LIBTRACEEVENT_VERSION := $(shell $(PKG_CONFIG) --modversion libtraceevent)
     LIBTRACEEVENT_VERSION_1 := $(word 1, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
     LIBTRACEEVENT_VERSION_2 := $(word 2, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
     LIBTRACEEVENT_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
```

I don't understand why `PKG_CONFIG_PATH` is overwritten this way. `grep`ing for PKG_CONFIG_PATH reveals that this isn't done anywhere else in the kernel tree. All other uses of `$(PKG_CONFIG)` in the file simply invoke the tool.

Of course, I do actually have `libtraceevent.pc` available, it's just that `LIBTRACEVENT_DIR` is empty which stops it from finding it.

```
[shana@aya:~/programming/linux/tools/perf]$ pkg-config --modversion libtraceevent
1.8.2
```

If I do not apply the patch, I'm getting the below errors during build.

I'm not sure how others are getting it to build, maybe I'm doing something wrong? Please let me know. If the diff is fine, it'd be great if anyone could apply it.

Thanks!

```
Perhaps you should add the directory containing `libtraceevent.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libtraceevent' found
expr: syntax error: unexpected argument ‘255’

Auto-detecting system features:
...                                   dwarf: [ on  ]
...                      dwarf_getlocations: [ on  ]
...                                   glibc: [ on  ]
...                                  libbfd: [ on  ]
...                          libbfd-buildid: [ on  ]
...                                  libcap: [ on  ]
...                                  libelf: [ on  ]
...                                 libnuma: [ on  ]
...                  numa_num_possible_cpus: [ on  ]
...                                 libperl: [ on  ]
...                               libpython: [ on  ]
...                               libcrypto: [ on  ]
...                               libunwind: [ on  ]
...                      libdw-dwarf-unwind: [ on  ]
...                             libcapstone: [ OFF ]
...                                    zlib: [ on  ]
...                                    lzma: [ on  ]
...                               get_cpuid: [ on  ]
...                                     bpf: [ on  ]
...                                  libaio: [ on  ]
...                                 libzstd: [ on  ]

  INSTALL libsubcmd_headers
  PERF_VERSION = 6.10.rc1.g1613e604df0c
  GEN     perf-archive
  GEN     perf-iostat
  INSTALL libsymbol_headers
  INSTALL libapi_headers
  INSTALL libperf_headers
  INSTALL libbpf_headers
  TEST    pmu-events/metric_test.log
  CC      builtin-bench.o
  CC      builtin-annotate.o
  CC      builtin-config.o
  CC      builtin-diff.o
  CC      builtin-evlist.o
  CC      builtin-ftrace.o
  CC      builtin-help.o
  CC      builtin-buildid-list.o
  CC      builtin-buildid-cache.o
  CC      builtin-kallsyms.o
  CC      builtin-list.o
  GEN     pmu-events/pmu-events.c
In file included from util/session.h:5,
                 from builtin-buildid-list.c:17:
util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
In file included from util/session.h:5,
                 from builtin-evlist.c:15:
util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
In file included from util/session.h:5,
                 from builtin-buildid-cache.c:24:
util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
  CC      builtin-record.o
In file included from util/session.h:5,
                 from builtin-diff.c:15:
util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
  CC      builtin-report.o
  CC      builtin-stat.o
make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.build:105: builtin-buildid-list.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.build:105: builtin-evlist.o] Error 1
In file included from util/session.h:5,
                 from builtin-annotate.c:32:
util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.build:105: builtin-buildid-cache.o] Error 1
make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.build:105: builtin-annotate.o] Error 1
make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.build:105: builtin-diff.o] Error 1
In file included from util/session.h:5,
                 from builtin-record.c:27:
util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
In file included from util/session.h:5,
                 from builtin-stat.c:60:
util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
In file included from util/session.h:5,
                 from builtin-report.c:35:
util/trace-event.h:152:62: error: operator '&&' has no right operand
  152 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
      |                                                              ^~
make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.build:105: builtin-record.o] Error 1
make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.build:105: builtin-report.o] Error 1
make[3]: *** [/home/shana/programming/linux/tools/build/Makefile.build:105: builtin-stat.o] Error 1
make[2]: *** [Makefile.perf:727: perf-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....
  CC      pmu-events/pmu-events.o
  LD      pmu-events/pmu-events-in.o
make[1]: *** [Makefile.perf:264: sub-make] Error 2
make: *** [Makefile:70: all] Error 2
perf version 6.10.rc1.g5f00d82dec63

```

--
Mateusz K.

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

end of thread, other threads:[~2024-06-05 13:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27  0:56 Why does libtracevent pkg-config detection wipe PKG_CONFIG_PATH? Mateusz Kowalczyk
2024-05-28 16:09 ` James Clark
2024-05-29  0:05   ` Mateusz Kowalczyk
2024-05-29  8:34     ` James Clark
2024-06-04 13:26 ` [PATCH] " Leo Yan
2024-06-04 23:53   ` Mateusz Kowalczyk
2024-06-05 13:00     ` Leo Yan

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