View Issue Details

IDProjectCategoryView StatusLast Update
0001385channel: kernel/el9kernel-mlpublic2023-10-06 22:09
Reportertoracat Assigned Totoracat  
PrioritynormalSeveritymajorReproducibilityhave not tried
Status resolvedResolutionfixed 
Summary0001385: kernel-ml-6.5.4-1.el9 fails to build if perf and bpftool are enabled.
Description[This ticket deals with both el8 and el9]

<el8 and el9>
This build problem started when the kernel version was updated from 6.5.3 to 6.5.4.

Without any added flags, there were 2 build errors.

    Error1: error: 'YYNOMEM' undeclared
    Error2: warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^~~~~~~

Those 2 errors were due to perf build.

<el8 only>
Disabling perf (--without perf) eliminates those errors but now leads to a linker error.

/usr/bin/ld: /home/akemi/rpmbuild/BUILD/kernel-ml-6.5.4/linux-6.5.4-1.el8.elrepo.x86_64/vmlinux.o: relocation R_X86_64_32S against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/Scrt1.o: In function `_start':
(.text+0x24): undefined reference to `main'

Successful build was achieved by disabling both perf and bpftool (--without perf --without bpftool).

<el9 only>
Disabling perf (--without perf) led to successful build. No need to disable bpftool.
Additional InformationAs a workaround, the following lines have been added to a proper location of the spec file:

%define with_perf 0
%define with_bpftool 0
TagsNo tags attached.

Relationships

related to 0001388 resolvedtoracat channel: kernel/el8 kernel-ml-6.6.0-rc1.el8 fails to build. 

Activities

toracat

2023-09-26 12:51

administrator   ~0009354

Last edited: 2023-10-02 12:19

<el8 and el9>
About Error1: error: 'YYNOMEM' undeclared:

This error seems to be related to the version of bison. Macro 'YYNOMEM' is defined in bison 3.8.1 or later.
el8 has bison 3.0.4 and el9 has bison 3.7.4.

A patch that fixes the issue has been added to linux-6.6-rc1.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/tools/perf/util/parse-events.y?id=535a265d7f0dd50d8c3a4f8b4f3a452d56bd160f

Use $(BISON_FALLBACK_FLAGS) on the bison call so that we continue
building with older bison versions, before 3.81, where YYNOMEM isn't
present.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230627181030.95608-7-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/parse-events.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'tools/perf/util/parse-events.y')

diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index b09a5fa921445..3ee351768433e 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -263,7 +263,7 @@ PE_EVENT_NAME event_def
     free($1);
     if (err) {
         free_list_evsel($2);
- YYABORT;
+ YYNOMEM;
     }
     $$ = $2;
 }

I will try asking the author to submit the commit to stable kernel as a backport.

[Note added] This is not the one that fixes the issue. See below.

toracat

2023-09-26 12:55

administrator   ~0009355

<el8 only>
About the linker error in the bpftool build:

This may be related to the gcc version.
el8 has gcc 8.5 and el9 has gcc 11.3.
No error with el9.

Need to test using a newer version of gcc (devtoolset) in el8.

toracat

2023-09-26 20:37

administrator   ~0009360

Last edited: 2023-10-02 12:18

This is the patch that needs to be backported to 6.5.x

(This patch is already in 6.6-rc1)

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/tools/perf/util?id=88cc47e24597971b05b6e94c28a2fc81d2a8d61a

author Arnaldo Carvalho de Melo <acme@redhat.com> 2023-07-28 17:26:54 -0300
committer Arnaldo Carvalho de Melo <acme@redhat.com> 2023-07-28 19:01:14 -0300
commit 88cc47e24597971b05b6e94c28a2fc81d2a8d61a (patch)
tree cd95113ab926d240ee5f4a4b3d881ec77222bc43 /tools/perf/util
parent 93d7e9c8fbb4624b7dfe8b3605b9f10f192ede98 (diff)
download linux-88cc47e24597971b05b6e94c28a2fc81d2a8d61a.tar.gz

perf build: Define YYNOMEM as YYNOABORT for bison < 3.81
YYNOMEM was introduced in bison 3.81, so define it as YYABORT for older
versions, which should provide the previous perf behaviour.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 96f4ea1d45c56..9c6c4475524b9 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -301,6 +301,12 @@ ifeq ($(BISON_GE_35),1)
 else
   bison_flags += -w
 endif
+
+BISON_LT_381 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \< 381)
+ifeq ($(BISON_LT_381),1)
+ bison_flags += -DYYNOMEM=YYABORT
+endif
+
 CFLAGS_parse-events-bison.o += $(bison_flags)
 CFLAGS_pmu-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
 CFLAGS_expr-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)

toracat

2023-09-28 14:11

administrator   ~0009362

Current status:

A request has been made to get the patch backported to the stable kernel. If this does not make it into 6.5.6, perf will remain disabled.

It looks like bpftool needs to be disabled indefinitely. Users should have no problem using the bpftool package provided by the distro-kernel.

toracat

2023-10-03 11:59

administrator   ~0009364

Last edited: 2023-10-04 11:08

The commit has been queued up by Sasha Levin. It is expected to be in the upcoming 6.5.6 release.

https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/commit/?id=a79fbfd1e7380b80f25cbaec5b07d45d89dc5122

toracat

2023-10-06 22:03

administrator   ~0009369

With the release of kernel-ml-6.5.6-1,

<el9> perf is now built with success.

<el8> perf is built but bpftool continues to fail.

toracat

2023-10-06 22:09

administrator   ~0009371

bpftool will be disabled indefinitely in el8. Users should use the package provided by the distro kernel.

Now closing as "resolved/fixed".

Issue History

Date Modified Username Field Change
2023-09-20 17:56 toracat New Issue
2023-09-20 17:56 toracat Status new => assigned
2023-09-20 17:56 toracat Assigned To => toracat
2023-09-20 22:41 toracat Description Updated
2023-09-25 13:42 toracat Description Updated
2023-09-26 12:51 toracat Note Added: 0009354
2023-09-26 12:55 toracat Note Added: 0009355
2023-09-26 20:20 toracat Relationship added related to 0001388
2023-09-26 20:37 toracat Note Added: 0009360
2023-09-26 20:45 toracat Note Edited: 0009360
2023-09-26 22:07 toracat Note Edited: 0009360
2023-09-28 14:11 toracat Note Added: 0009362
2023-10-02 12:18 toracat Note Edited: 0009360
2023-10-02 12:18 toracat Note View State: 0009360: public
2023-10-02 12:19 toracat Note Edited: 0009354
2023-10-03 11:59 toracat Note Added: 0009364
2023-10-04 11:08 toracat Note Edited: 0009364
2023-10-06 22:03 toracat Note Added: 0009369
2023-10-06 22:09 toracat Status assigned => resolved
2023-10-06 22:09 toracat Resolution open => fixed
2023-10-06 22:09 toracat Note Added: 0009371