You are not logged in.

#1 2023-06-17 20:01:13

orbit1849
Member
Registered: 2022-10-13
Posts: 13

[SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

I'm in /usr/src/linux

I have the kernel-headers installed.

Both with the previous kernel and after updating to the latest 6.3.8-arch1-1 I get this:

# make menuconfig
  HOSTCC  scripts/kconfig/mconf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/mconf
crypto/Kconfig:1393: can't open file "arch/arm/crypto/Kconfig"
make[1]: *** [scripts/kconfig/Makefile:48: menuconfig] Error 1
make: *** [Makefile:692: menuconfig] Error 2

What's going on?

Why does it complain about missing ARM stuff on an x86-64 system?

I didn't install any arm specific tooling to my knowledge. I've looked through /var/log/pacman.log without seeing anything obvious.

Last edited by orbit1849 (2023-07-02 19:19:40)

Offline

#2 2023-06-17 20:15:53

loqs
Member
Registered: 2014-03-06
Posts: 18,884

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

linux-headers provide the headers required to build out of tree modules.  Why are you running `make menuconfig` in /usr/src/linux?

Offline

#3 2023-06-17 20:46:48

orbit1849
Member
Registered: 2022-10-13
Posts: 13

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

loqs wrote:

linux-headers provide the headers required to build out of tree modules.  Why are you running `make menuconfig` in /usr/src/linux?

In order to get to the root cause of why a certain kernel module didn't build. I thought it was related to something weird with the kernel module, when I discovered that I cannot even run make menuconfig in my own /usr/src/linux -- which indicates a broader or deeper problem, if you will.

In any case, I don't think it is likely to assume this other module is related to the problem, it will just add unnecessary complexity.

If I manually download linux-6.3.8, I can run make menuconfig.

It is very strange, it seems like my existing (newly installed!) linux source tree (from pacman), wants to process other architectures. If I manually go into Kconfig files and remove references to ARM, it starts to complain about MIPS, then x86 (regular x86, not x86-64, which is what I have):

Here's an excerpt, I'm in Arch Linux's original folder:

/lib/modules/6.3.8-arch1-1/build

And I'm trying to get "make clean" to work (note, when it complains about "Documentation" missing as well, I copy it from /usr/src/linux, which is where I now, have a manually downloaded 6.3.8 kernel from kernel.org):

[root@ryzen build]# !grep
grep -Ri "arch/arm/crypto/Kconfig" *
crypto/Kconfig:source "arch/arm/crypto/Kconfig"
include/config/auto.conf.cmd:	arch/arm/crypto/Kconfig \
[root@ryzen build]# pwd
/lib/modules/6.3.8-arch1-1/build
[root@ryzen build]# vim crypto/Kconfig
[root@ryzen build]# vim crypto/Kconfig
[root@ryzen build]# vim include/config/auto.conf.cmd
[root@ryzen build]# pwd
/lib/modules/6.3.8-arch1-1/build
[root@ryzen build]# make clean
  SYNC    include/config/auto.conf
crypto/Kconfig:1399: can't open file "arch/mips/crypto/Kconfig"
make[3]: *** [scripts/kconfig/Makefile:77: syncconfig] Error 1
make[2]: *** [Makefile:692: syncconfig] Error 2
make[1]: *** [Makefile:793: include/config/auto.conf] Error 2
make: *** [Makefile:2030: _clean_.] Error 2
[root@ryzen build]# vim crypto/Kconfig
[root@ryzen build]# make clean
  SYNC    include/config/auto.conf
Kconfig:32: can't open file "Documentation/Kconfig"
make[3]: *** [scripts/kconfig/Makefile:77: syncconfig] Error 1
make[2]: *** [Makefile:692: syncconfig] Error 2
make[1]: *** [Makefile:793: include/config/auto.conf] Error 2
make: *** [Makefile:2030: _clean_.] Error 2
[root@ryzen build]# vim Kconfig
[root@ryzen build]# make clean
  SYNC    include/config/auto.conf
scripts/Makefile.clean:12: Documentation/Makefile: No such file or directory
make[1]: *** No rule to make target 'Documentation/Makefile'.  Stop.
make: *** [Makefile:2030: _clean_Documentation] Error 2
[root@ryzen build]# vim scripts/Makefile.clean
[root@ryzen build]# cp -Rv /usr/src/linux-6.3.8/Documentation ./
...
[root@ryzen build]# make clean
scripts/Makefile.clean:12: arch/x86/math-emu/Makefile: No such file or directory
make[1]: *** No rule to make target 'arch/x86/math-emu/Makefile'.  Stop.
make: *** [Makefile:2030: _clean_arch/x86/math-emu] Error 2

Offline

#4 2023-06-17 20:55:16

loqs
Member
Registered: 2014-03-06
Posts: 18,884

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

orbit1849 wrote:

In order to get to the root cause of why a certain kernel module didn't build. I thought it was related to something weird with the kernel module, when I discovered that I cannot even run make menuconfig in my own /usr/src/linux -- which indicates a broader or deeper problem, if you will.

No this expected behavior when using linux-headers rather than a full kernel source tree,  as building external modules does not requiring regenerating the kernel's config so is not supported when using linux-headers.
What is the module that does not build?  Have you built it successfully on linux 6.3.8 on another distribution?

Last edited by loqs (2023-06-17 20:55:42)

Offline

#5 2023-06-17 21:08:23

orbit1849
Member
Registered: 2022-10-13
Posts: 13

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

loqs wrote:
orbit1849 wrote:

In order to get to the root cause of why a certain kernel module didn't build. I thought it was related to something weird with the kernel module, when I discovered that I cannot even run make menuconfig in my own /usr/src/linux -- which indicates a broader or deeper problem, if you will.

No this expected behavior when using linux-headers rather than a full kernel source tree,  as building external modules does not requiring regenerating the kernel's config so is not supported when using linux-headers.
What is the module that does not build?  Have you built it successfully on linux 6.3.8 on another distribution?

I have linux as well as linux-headers installed, so in just to be clear, I have:

└[/lib/modules/6.3.8-arch1-1/build]> ls -al
total 111072
drwxr-xr-x 1 root root       444 Jun 17 23:01 .
drwxr-xr-x 1 root root       518 Jun 17 21:53 ..
drwxr-xr-x 1 root root        20 Jun 17 21:43 arch
drwxr-xr-x 1 root root        64 Jun 17 21:43 block
drwxr-xr-x 1 root root        14 Jun 17 21:43 certs
-rw-r--r-- 1 root root    263098 Jun 17 23:01 .config
-rw-r--r-- 1 root root    263095 Jun 14 22:10 .config.old
drwxr-xr-x 1 root root        60 Jun 17 22:35 crypto
drwxr-xr-x 1 root root      1462 Jun 17 22:36 Documentation
drwxr-xr-x 1 root root      1354 Jun 17 21:43 drivers
drwxr-xr-x 1 root root       730 Jun 17 21:43 fs
drwxr-xr-x 1 root root       322 Jun 17 21:43 include
drwxr-xr-x 1 root root        14 Jun 17 21:43 init
-rw-r--r-- 1 root root       556 Jun 17 22:35 Kconfig
drwxr-xr-x 1 root root       212 Jun 17 21:43 kernel
drwxr-xr-x 1 root root       248 Jun 17 21:43 lib
-rw-r--r-- 1 root root         3 Jun 14 22:10 localversion.10-pkgrel
-rw-r--r-- 1 root root         1 Jun 14 22:10 localversion.20-pkgname
-rw-r--r-- 1 root root     71726 Jun 14 22:10 Makefile
drwxr-xr-x 1 root root        50 Jun 17 21:43 mm
-rw-r--r-- 1 root root   1881797 Jun 14 22:10 Module.symvers
drwxr-xr-x 1 root root       688 Jun 17 21:43 net
drwxr-xr-x 1 root root        22 Jun 17 21:43 samples
drwxr-xr-x 1 root root      4708 Jun 17 21:43 scripts
drwxr-xr-x 1 root root       198 Jun 17 21:43 security
drwxr-xr-x 1 root root       210 Jun 17 21:43 sound
-rw-r--r-- 1 root root   7683190 Jun 14 22:10 System.map
drwxr-xr-x 1 root root        20 Jun 17 21:43 tools
drwxr-xr-x 1 root root        14 Jun 17 21:43 usr
-rw-r--r-- 1 root root        14 Jun 14 22:10 version
drwxr-xr-x 1 root root        12 Jun 17 21:43 virt
-rw-r--r-- 1 root root 103545536 Jun 14 22:10 vmlinux

And ... I was just about to write that this is the kernel, and not just the headers ... but, it looks like it isn't.

Looks like I've confused myself.

The kernel module: It is a simple netfilter based kernel module that I'm writing.

Edit: In any case:

Why doesn't make clean work? This can't be expected behavior!

Last edited by orbit1849 (2023-06-17 21:09:01)

Offline

#6 2023-06-17 21:13:17

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,652

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

It is very strange, it seems like my existing (newly installed!) linux source tree (from pacman) make menuconfig, wants to process other architectures.

What does

make menuconfig

do?
Does limiting the architecture make sense at this stage?

Why doesn't make clean work? This can't be expected behavior!

the kernel, and not just the headers ... but, it looks like it isn't

Clean *what*?

Offline

#7 2023-06-17 21:37:57

loqs
Member
Registered: 2014-03-06
Posts: 18,884

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

See https://docs.kernel.org/kbuild/modules.html
Which means the following is expected to work with your module,  when invoked in the directory containing your module:

make -C /lib/modules/"$(</usr/src/linux/version)"/build M=$PWD

Last edited by loqs (2023-06-17 21:38:23)

Offline

#8 2023-06-17 23:24:17

orbit1849
Member
Registered: 2022-10-13
Posts: 13

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

seth wrote:

It is very strange, it seems like my existing (newly installed!) linux source tree (from pacman) make menuconfig, wants to process other architectures.

What does

make menuconfig

do?
Does limiting the architecture make sense at this stage?

Why doesn't make clean work? This can't be expected behavior!

the kernel, and not just the headers ... but, it looks like it isn't

Clean *what*?

Make menuconfig works for both the stock Arch Linux "kernel" in /lib/modules/6.3.8-arch1-1/build (I say "kernel" as there are no .c files for the actual kernel here), and for the actual kernel I downloaded manually from kernel.org. I can also build the kernel I downloaded from kernel.org, so everything's good in that sense.

Limiting the architecture at this stage doesn't really make sense, I suppose.

Good question about what to clean, I see your point, at the same time though, the architecture should be derived from the build environment, it is implicitly x86_64, even without passing in make ARCH=x86_64 (although I've tried this too, same result). When make clean doesn't work and it starts visiting all the architectures, it just feels like something is broken, am I wrong? I'm also surprised to see almost no results on Google for this (hence why I asked here). I can't be the only one confused about this and that get this issue when building certain modules?

Offline

#9 2023-06-17 23:26:43

orbit1849
Member
Registered: 2022-10-13
Posts: 13

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

loqs wrote:

See https://docs.kernel.org/kbuild/modules.html
Which means the following is expected to work with your module,  when invoked in the directory containing your module:

make -C /lib/modules/"$(</usr/src/linux/version)"/build M=$PWD

I have a minimally reproducible example now, hello world module code follows:

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Your Name");
MODULE_DESCRIPTION("A simple Hello, World! kernel module");
MODULE_VERSION("0.1");

static int __init hello_init(void)
{
    printk(KERN_INFO "Hello, World!\n");
    return 0;
}

static void __exit hello_exit(void)
{
    printk(KERN_INFO "Goodbye, World!\n");
}

module_init(hello_init);
module_exit(hello_exit);

And the Makefile:

obj-m := netlogging.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

This gives:

[root@ryzen hello_kernel]# make
make -C /lib/modules/6.3.8-arch1-1/build SUBDIRS=/home/user/hello_kernel modules
scripts/Makefile.build:41: arch/x86/entry/syscalls/Makefile: No such file or directory
make[2]: *** No rule to make target 'arch/x86/entry/syscalls/Makefile'.  Stop.
make[1]: *** [arch/x86/Makefile:248: archheaders] Error 2
make: *** [Makefile:5: default] Error 2

Note that if I don't run it as root, I get:

> make
make -C /lib/modules/6.3.8-arch1-1/build SUBDIRS=/home/user/hello_kernel modules
mkdir: cannot create directory ‘.tmp_845929’: Permission denied
mkdir: cannot create directory ‘.tmp_845939’: Permission denied
mkdir: cannot create directory ‘.tmp_845949’: Permission denied
mkdir: cannot create directory ‘.tmp_845959’: Permission denied
mkdir: cannot create directory ‘.tmp_845969’: Permission denied
mkdir: cannot create directory ‘.tmp_845979’: Permission denied
mkdir: cannot create directory ‘.tmp_845989’: Permission denied
mkdir: cannot create directory ‘.tmp_846003’: Permission denied
mkdir: cannot create directory ‘.tmp_846013’: Permission denied
mkdir: cannot create directory ‘.tmp_846023’: Permission denied
mkdir: cannot create directory ‘.tmp_846033’: Permission denied
mkdir: cannot create directory ‘.tmp_846053’: Permission denied
mkdir: cannot create directory ‘.tmp_846063’: Permission denied
mkdir: cannot create directory ‘.tmp_846073’: Permission denied
mkdir: cannot create directory ‘.tmp_846083’: Permission denied
mkdir: cannot create directory ‘.tmp_846097’: Permission denied
mkdir: cannot create directory ‘.tmp_846107’: Permission denied
mkdir: cannot create directory ‘.tmp_846117’: Permission denied
mkdir: cannot create directory ‘.tmp_846127’: Permission denied
mkdir: cannot create directory ‘.tmp_846144’: Permission denied
mkdir: cannot create directory ‘.tmp_846163’: Permission denied
mkdir: cannot create directory ‘.tmp_846173’: Permission denied
mkdir: cannot create directory ‘.tmp_846183’: Permission denied
mkdir: cannot create directory ‘.tmp_846193’: Permission denied
mkdir: cannot create directory ‘.tmp_846207’: Permission denied
mkdir: cannot create directory ‘.tmp_846217’: Permission denied
mkdir: cannot create directory ‘.tmp_846227’: Permission denied
mkdir: cannot create directory ‘.tmp_846237’: Permission denied
mkdir: cannot create directory ‘.tmp_846247’: Permission denied
mkdir: cannot create directory ‘.tmp_846257’: Permission denied
mkdir: cannot create directory ‘.tmp_846267’: Permission denied
scripts/Makefile.build:41: arch/x86/entry/syscalls/Makefile: No such file or directory
make[2]: *** No rule to make target 'arch/x86/entry/syscalls/Makefile'.  Stop.
make[1]: *** [arch/x86/Makefile:248: archheaders] Error 2
make: *** [Makefile:5: default] Error 2

Something is broken. Again notice how it visits regular x86, not x86_64!

And why permission denied? I'm used to being able to build kernel modules without being root, and only need root for insmod.

Offline

#10 2023-06-17 23:33:23

loqs
Member
Registered: 2014-03-06
Posts: 18,884

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

Please read the current kernel modules documentation that I linked to.  SUBDIRS support was removed in https://git.kernel.org/pub/scm/linux/ke … 0c05ffe93d
Edit:
Although the command I supplied would still work as it overrides the default:

$ make -C /lib/modules/"$(</usr/src/linux/version)"/build M=$PWD
  CC [M]  /tmp/demo/netlogging.o
  MODPOST /tmp/demo/Module.symvers
  CC [M]  /tmp/demo/netlogging.mod.o
  LD [M]  /tmp/demo/netlogging.ko
  BTF [M] /tmp/demo/netlogging.ko

Last edited by loqs (2023-06-17 23:46:44)

Offline

#11 2023-06-18 00:06:59

orbit1849
Member
Registered: 2022-10-13
Posts: 13

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

loqs wrote:

Please read the current kernel modules documentation that I linked to.  SUBDIRS support was removed in https://git.kernel.org/pub/scm/linux/ke … 0c05ffe93d
Edit:
Although the command I supplied would still work as it overrides the default:

$ make -C /lib/modules/"$(</usr/src/linux/version)"/build M=$PWD
  CC [M]  /tmp/demo/netlogging.o
  MODPOST /tmp/demo/Module.symvers
  CC [M]  /tmp/demo/netlogging.mod.o
  LD [M]  /tmp/demo/netlogging.ko
  BTF [M] /tmp/demo/netlogging.ko

Sorry, thanks. I'm old and tired.

Offline

#12 2023-06-18 00:20:09

orbit1849
Member
Registered: 2022-10-13
Posts: 13

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

loqs wrote:

Please read the current kernel modules documentation that I linked to.  SUBDIRS support was removed in https://git.kernel.org/pub/scm/linux/ke … 0c05ffe93d
Edit:
Although the command I supplied would still work as it overrides the default:

$ make -C /lib/modules/"$(</usr/src/linux/version)"/build M=$PWD
  CC [M]  /tmp/demo/netlogging.o
  MODPOST /tmp/demo/Module.symvers
  CC [M]  /tmp/demo/netlogging.mod.o
  LD [M]  /tmp/demo/netlogging.ko
  BTF [M] /tmp/demo/netlogging.ko

Thanks for your help, really.

I still have an issue though:

While the hello world module compiles with this command, a simple netfilter example doesn't compile with the same command. It complains about this:

In file included from <command-line>:
././include/linux/kconfig.h:5:10: fatal error: generated/autoconf.h: No such file or directory
    5 | #include <generated/autoconf.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~

However, now it feels like we're back to the original problem. To get this I'm used to just having to do make menuconfig or similar to make it produce it.

Although, as I'm writing this, it seems like just doing:

pacman -S linux-headers

Fixed it.

Strange, why would I need to do this? I've already installed linux-headers, including on my latest pacman -Syu.

Offline

#13 2023-06-18 00:42:08

loqs
Member
Registered: 2014-03-06
Posts: 18,884

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

orbit1849 wrote:

Strange, why would I need to do this? I've already installed linux-headers, including on my latest pacman -Syu.

You ran make commands as root in /lib/modules/6.3.8-arch1-1/build  (most likely make clean) which removed the files provided linux-headers.

Last edited by loqs (2023-06-18 00:42:37)

Offline

#14 2023-06-18 05:52:52

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,652

Re: [SOLVED]Weird complaining about missing ARM stuff on an x86-64 system?

Your fundamenal misconception here is that installing linux-headers would enable you to build the kernel itself.
This is wrong, get that out out of your head https://wiki.archlinux.org/title/Kernel#Compilation
(inb4 you complain about the path: how many passwords do you see in /etc/passwd?)

linux provides the kernel image, linux-headers the headers for out-of-tree build, the kernel sources are not installed this way and running "make whateverconfig" in this directory makes zero sense.
You cannot build anything there because of that and because of that "make whateverconfig" fails when it's looking for non-present (foreign architecture) config instructions and "make whateverconfig" doesn't care about the local architecture; you're generating stuff to configure the build and the later build might very well concern other architectures.
("make ARCH=x86 menuconfig" might actually work, no idea * BUT NOT IN /usr/src/linux - you still cannot build anything there!!)


Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB