Bug 218647 - stable kernels 6.6.23 and 6.1.83 fails to build: error: unknown type name 'u32'
Summary: stable kernels 6.6.23 and 6.1.83 fails to build: error: unknown type name 'u32'
Status: RESOLVED CODE_FIX
Alias: None
Product: Linux
Classification: Unclassified
Component: Kernel (show other bugs)
Hardware: All Linux
: P3 normal
Assignee: Virtual assignee for kernel bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-27 08:07 UTC by ncopa
Modified: 2024-04-04 12:14 UTC (History)
1 user (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description ncopa 2024-03-27 08:07:42 UTC
The latest releases fails to build with musl libc (Alpine Linux edge and v3.19):

```
rm -f -f /home/ncopa/aports/main/linux-lts/src/build-lts.x86_64/tools/bpf/resolve_btfids/libbpf/libbpf.a; ar rcs /home/ncopa/aports/main/linux-lts/src/build-lts.x86_64/tool
s/bpf/resolve_btfids/libbpf/libbpf.a /home/ncopa/aports/main/linux-lts/src/build-lts.x86_64/tools/bpf/resolve_btfids/libbpf/staticobjs/libbpf-in.o
In file included from main.c:73:
/home/ncopa/aports/main/linux-lts/src/linux-6.6/tools/include/linux/btf_ids.h:7:9: error: unknown type name 'u32'
    7 |         u32 cnt;                                                              
      |         ^~~                
/home/ncopa/aports/main/linux-lts/src/linux-6.6/tools/include/linux/btf_ids.h:8:9: error: unknown type name 'u32'
    8 |         u32 ids[];         
      |         ^~~                    
/home/ncopa/aports/main/linux-lts/src/linux-6.6/tools/include/linux/btf_ids.h:12:9: error: unknown type name 'u32'
   12 |         u32 cnt;   
      |         ^~~                        
/home/ncopa/aports/main/linux-lts/src/linux-6.6/tools/include/linux/btf_ids.h:13:9: error: unknown type name 'u32'
   13 |         u32 flags;
      |         ^~~
/home/ncopa/aports/main/linux-lts/src/linux-6.6/tools/include/linux/btf_ids.h:15:17: error: unknown type name 'u32'
   15 |                 u32 id;
      |                 ^~~
/home/ncopa/aports/main/linux-lts/src/linux-6.6/tools/include/linux/btf_ids.h:16:17: error: unknown type name 'u32'
   16 |                 u32 flags;
      |                 ^~~
/home/ncopa/aports/main/linux-lts/src/linux-6.6/tools/include/linux/btf_ids.h:215:8: error: unknown type name 'u32'
  215 | extern u32 btf_tracing_ids[];
      |        ^~~
make[4]: *** [/home/ncopa/aports/main/linux-lts/src/linux-6.6/tools/build/Makefile.build:98: /home/ncopa/aports/main/linux-lts/src/build-lts.x86_64/tools/bpf/resolve_btfids
/main.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [Makefile:83: /home/ncopa/aports/main/linux-lts/src/build-lts.x86_64/tools/bpf/resolve_btfids//resolve_btfids-in.o] Error 2
make[2]: *** [Makefile:76: bpf/resolve_btfids] Error 2
make[1]: *** [/home/ncopa/aports/main/linux-lts/src/linux-6.6/Makefile:1354: tools/bpf/resolve_btfids] Error 2
make: *** [/home/ncopa/aports/main/linux-lts/src/linux-6.6/Makefile:234: __sub-make] Error 2
```
Comment 1 ncopa 2024-03-28 09:23:04 UTC
in linux-6.6.y, it was introduced with:

commit 29d1ee8e7aa219c99187fe13c342d267b731dfe3
Author: Viktor Malik <vmalik@redhat.com>
Date:   Tue Feb 6 13:46:09 2024 +0100

    tools/resolve_btfids: Refactor set sorting with types from btf_ids.h
    
    [ Upstream commit 9707ac4fe2f5bac6406d2403f8b8a64d7b3d8e43 ]
Comment 2 ncopa 2024-03-28 09:37:02 UTC
The fix is:

diff --git a/tools/include/linux/btf_ids.h b/tools/include/linux/btf_ids.h
index 72535f00572f..72ea363d434d 100644
--- a/tools/include/linux/btf_ids.h
+++ b/tools/include/linux/btf_ids.h
@@ -3,6 +3,8 @@
 #ifndef _LINUX_BTF_IDS_H
 #define _LINUX_BTF_IDS_H
 
+#include <linux/types.h> /* for u32 */
+
 struct btf_id_set {
        u32 cnt;
        u32 ids[];
Comment 3 Bagas Sanjaya 2024-04-01 14:12:46 UTC
Forwarded to mailing list at [1].

[1]: https://lore.kernel.org/regressions/ZgrAM4NjZQWZ2Jq6@archie.me/
Comment 4 ncopa 2024-04-04 12:14:28 UTC
this is fixed in 6.6.24 and 6.1.84

Note You need to log in before you can comment on or make changes to this bug.