lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 16 Jan 2024 13:38:21 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Yang Jihong <yangjihong1@...wei.com>
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org, 
	mark.rutland@....com, alexander.shishkin@...ux.intel.com, jolsa@...nel.org, 
	irogers@...gle.com, adrian.hunter@...el.com, linux-perf-users@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf build: Check whether pkg-config is installed when
 libtraceevent is linked

Hello,

On Thu, Jan 11, 2024 at 7:44 PM Yang Jihong <yangjihong1@...wei.com> wrote:
>
> If pkg-config is not installed when libtraceevent is linked, the build fails.
>
> The error information is as follows:
>
>   $ make
>   <SNIP>
>   In file included from /home/yjh/projects_linux/perf-tool-next/linux/tools/perf/util/evsel.c:43:
>   /home/yjh/projects_linux/perf-tool-next/linux/tools/perf/util/trace-event.h:149:62: error: operator '&&' has no right operand
>     149 | #if defined(LIBTRACEEVENT_VERSION) &&  LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0)
>         |                                                              ^~
>   error: command '/usr/bin/gcc' failed with exit code 1
>   cp: cannot stat 'python_ext_build/lib/perf*.so': No such file or directory
>   make[2]: *** [Makefile.perf:668: python/perf.cpython-310-x86_64-linux-gnu.so] Error 1
>   make[2]: *** Waiting for unfinished jobs....
>
> Because pkg-config is not installed, fail to get libtraceevent version in
> Makefile.config file. As a result, LIBTRACEEVENT_VERSION is empty.
> However, the preceding error information is not user-friendly.
>
> Identify errors in advance by checking that pkg-config is installed at
> compile time.

Thanks for working on this.  I also think we can disable it when
pkg-config is not installed and continue to build.  But I guess it's
usual to have pkg-config on a build environment so it'd be better
to stop the build and warn the user.

>
> The build results of various scenarios are as follows:
>
> 1. build successful when libtraceevent is not linked and pkg-config is not installed
>
>   $ pkg-config --version
>   -bash: /usr/bin/pkg-config: No such file or directory
>   $ make clean >/dev/null
>   $ make NO_LIBTRACEEVENT=1 >/dev/null
>   Makefile.config:1133: No alternatives command found, you need to set JDIR= to point to the root of your Java directory
>     PERF_VERSION = 6.7.rc6.gd988c9f511af
>   $ echo $?
>   0
>
> 2. dummy pkg-config is missing when libtraceevent is linked
>
>   $ pkg-config --version
>   -bash: /usr/bin/pkg-config: No such file or directory
>   $ make clean >/dev/null
>   $ make >/dev/null
>   Makefile.config:221: *** Error: pkg-config needed by libtraceevent is missing on this system, please install it.  Stop.
>   make[1]: *** [Makefile.perf:251: sub-make] Error 2
>   make: *** [Makefile:70: all] Error 2
>   $ echo $?
>   2
>
> 3. build successful when libtraceevent is linked and pkg-config is installed
>
>   $ pkg-config --version
>   0.29.2
>   $ make clean >/dev/null
>   $ make >/dev/null
>   Makefile.config:1133: No alternatives command found, you need to set JDIR= to point to the root of your Java directory
>     PERF_VERSION = 6.7.rc6.gd988c9f511af
>   $ echo $?
>   0
>
> Signed-off-by: Yang Jihong <yangjihong1@...wei.com>

Acked-by: Namhyung Kim <namhyung@...nel.org>

Thanks,
Namhyung


> ---
>  tools/perf/Makefile.config | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index aa55850fbc21..70c33c935a98 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -216,6 +216,12 @@ ifeq ($(call get-executable,$(BISON)),)
>    dummy := $(error Error: $(BISON) is missing on this system, please install it)
>  endif
>
> +ifneq ($(NO_LIBTRACEEVENT),1)
> +  ifeq ($(call get-executable,$(PKG_CONFIG)),)
> +  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
> +  endif
> +endif
> +
>  ifneq ($(OUTPUT),)
>    ifeq ($(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 371), 1)
>      BISON_FILE_PREFIX_MAP := --file-prefix-map=$(OUTPUT)=
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ