kernel build error during ubuntu linux kernel build
Hello, all I have a strange problem in building the linux kernel from ubuntu. (I want to replace the kernel in ubuntu to debug install failure on qemu virtual machine) I downloaded ubuntu source by "git clone git://kernel.ubuntu.com/ubuntu/ubuntu-focal.git". and because I wanted to use a specific version, I did "git checkout Ubuntu-5.4.0-42.46" (this version is the one used in a ubuntu installation .iso. And you can see related askubuntu question here : https://askubuntu.com/questions/1347390/what-ubuntu-source-version-should-i- use-to-add-some-debug-prints-for-ubuntu-bo ) After git-checkout, the `git log` shows this result : commit 98c4545e2d65ed35c31056f72c4da20f6b5ea0d0 (HEAD, tag: Ubuntu-5.4.0-42.46) Author: Khalid Elmously <khalid.elmously@canonical.com> Date: Thu Jul 9 19:50:26 2020 -0400 UBUNTU: Ubuntu-5.4.0-42.46 Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com> To build the kernel, I did `ARCH=arm64 CROSS_COMPILE=aarch64-none-elf- make defconfig` and `ARCH=arm64 CROSS_COMPILE=aarch64-none-elf- make -j24 Image`. But this gives me a compile error below. What can be wrong? . . CC mm/interval_tree.o CC drivers/base/regmap/regcache.o CC kernel/time/posix-cpu-timers.o CC mm/list_lru.o CC block/blk-mq.o AS arch/arm64/lib/memchr.o CC fs/ext4/migrate.o security/security.c: In function 'security_add_hooks': security/security.c:477:25: error: 'struct security_hook_heads' has no member named 'socket_getpeersec_stream' 477 | &security_hook_heads.socket_getpeersec_stream) | ^ CC kernel/time/posix-clock.o AS arch/arm64/lib/memcmp.o security/security.c: In function 'security_setprocattr': CC arch/arm64/kvm/../../../virt/kvm/arm/vgic/vgic-v2.o security/security.c:2058:27: error: 'union security_list_options' has no member named 'socket_getpeersec_stream' 2058 | socket_getpeersec_stream.socket_getpeersec_stream = NULL; | ^ In file included from ./include/linux/timer.h:5, from ./include/linux/workqueue.h:9, from ./include/linux/bpf.h:9, from security/security.c:13: security/security.c:2060:25: error: 'struct security_hook_heads' has no member named 'socket_getpeersec_stream' 2060 | &security_hook_heads.socket_getpeersec_stream, | ^ ./include/linux/list.h:857:12: note: in definition of macro 'hlist_entry_safe' 857 | ({ typeof(ptr) ____ptr = (ptr); \ | ^~~ security/security.c:2059:3: note: in expansion of macro 'hlist_for_each_entry' 2059 | hlist_for_each_entry(hp, | ^~~~~~~~~~~~~~~~~~~~ security/security.c:2060:25: error: 'struct security_hook_heads' has no member named 'socket_getpeersec_stream' 2060 | &security_hook_heads.socket_getpeersec_stream, | ^ ./include/linux/list.h:857:28: note: in definition of macro 'hlist_entry_safe' 857 | ({ typeof(ptr) ____ptr = (ptr); \ | ^~~ security/security.c:2059:3: note: in expansion of macro 'hlist_for_each_entry' 2059 | hlist_for_each_entry(hp, | ^~~~~~~~~~~~~~~~~~~~ In file included from ./include/linux/list.h:9, from ./include/linux/timer.h:5, from ./include/linux/workqueue.h:9, from ./include/linux/bpf.h:9, from security/security.c:13: ./include/linux/kernel.h:993:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 993 | void *__mptr = (void *)(ptr); \ | ^ ./include/linux/list.h:847:40: note: in expansion of macro 'container_of' 847 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member) | ^~~~~~~~~~~~ . . BTW, when I do the same with linux-5.4.21 vanila source, it compiles ok. Can anyone give me an advice? Could this Ubuntu-5.4.0-42.46 version have a bug and maybe I need a patch? Thank you! Chan Kim
I found from https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel, the correct method to build ubuntu is (for ARCH=arm64 case) * LANG=C fakeroot debian/rules ARCH=arm64 clean * # quicker build: * LANG=C fakeroot debian/rules ARCH=arm64 binary-headers binary-generic binary-perarch * # if you need linux-tools or lowlatency kernel, run instead: * LANG=C fakeroot debian/rules ARCH=arm64 binary But when I tried it, it went far longer but eventually it failed with error. .. Creating symlink /home/ckim/prj1/QEMU/qemu_test/test_ubuntu-20.04-build/focal/ubuntu-focal/de bian/build/builddkms/build/zfs/0.8.3/source -> /home/ckim/prj1/QEMU/qemu_test/test_ubuntu-20.04-build/focal/ubuntu-focal/de bian/build/builddkms/source/zfs-0.8.3 DKMS: add completed. Running the pre_build script: checking for gawk... gawk checking metadata... META file checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking whether to enable maintainer-specific portions of Makefiles... no checking whether make supports nested variables... yes checking for a BSD-compatible install... /bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p ... checking kernel source version... 5.4.0-42-generic checking kernel file name for module symbols... Module.symvers checking whether modules can be built... no configure: error: *** Unable to build an empty module. Building module: cleaning build area...(bad exit status: 2) make -j28 KERNELRELEASE=5.4.0-42-generic...(bad exit status: 2) ERROR (dkms apport): binary package for zfs: 0.8.3 not found Error! Bad return status for module build on kernel: 5.4.0-42-generic (x86_64) Consult /home/ckim/prj1/QEMU/qemu_test/test_ubuntu-20.04-build/focal/ubuntu-focal/de bian/build/builddkms/build/zfs/0.8.3/build/make.log for more information. DKMS make.log for zfs-0.8.3 for kernel 5.4.0-42-generic (x86_64) Tue Jun 29 11:43:02 KST 2021 make[1]: Entering directory '<<DKMSDIR>>/build/zfs/0.8.3/build' make[1]: *** No targets specified and no makefile found. Stop. make[1]: Leaving directory '<<DKMSDIR>>/build/zfs/0.8.3/build' make: *** [debian/rules.d/2-binary-arch.mk:223: install-generic] Error 1 And according to the guide, I'm supposed to see in ../ directory two linux headers .deb files and a linux-image .deb file but I see only linux-headers-5.4.0-42_5.4.0-42.46_all.deb Can anyone give me an advice? Any suggestion will be appreciated. Thank you! Chan Kim From: ckim@etri.re.kr <ckim@etri.re.kr> Sent: Tuesday, June 29, 2021 10:04 AM To: kernelnewbies@kernelnewbies.org Subject: kernel build error during ubuntu linux kernel build Hello, all I have a strange problem in building the linux kernel from ubuntu. (I want to replace the kernel in ubuntu to debug install failure on qemu virtual machine) I downloaded ubuntu source by "git clone git://kernel.ubuntu.com/ubuntu/ubuntu-focal.git". and because I wanted to use a specific version, I did "git checkout Ubuntu-5.4.0-42.46" (this version is the one used in a ubuntu installation .iso. And you can see related askubuntu question here : https://askubuntu.com/questions/1347390/what-ubuntu-source-version-should-i- use-to-add-some-debug-prints-for-ubuntu-bo ) After git-checkout, the `git log` shows this result : commit 98c4545e2d65ed35c31056f72c4da20f6b5ea0d0 (HEAD, tag: Ubuntu-5.4.0-42.46) Author: Khalid Elmously <khalid.elmously@canonical.com <mailto:khalid.elmously@canonical.com> > Date: Thu Jul 9 19:50:26 2020 -0400 UBUNTU: Ubuntu-5.4.0-42.46 Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com <mailto:khalid.elmously@canonical.com> > To build the kernel, I did `ARCH=arm64 CROSS_COMPILE=aarch64-none-elf- make defconfig` and `ARCH=arm64 CROSS_COMPILE=aarch64-none-elf- make -j24 Image`. But this gives me a compile error below. What can be wrong? . . CC mm/interval_tree.o CC drivers/base/regmap/regcache.o CC kernel/time/posix-cpu-timers.o CC mm/list_lru.o CC block/blk-mq.o AS arch/arm64/lib/memchr.o CC fs/ext4/migrate.o security/security.c: In function 'security_add_hooks': security/security.c:477:25: error: 'struct security_hook_heads' has no member named 'socket_getpeersec_stream' 477 | &security_hook_heads.socket_getpeersec_stream) | ^ CC kernel/time/posix-clock.o AS arch/arm64/lib/memcmp.o security/security.c: In function 'security_setprocattr': CC arch/arm64/kvm/../../../virt/kvm/arm/vgic/vgic-v2.o security/security.c:2058:27: error: 'union security_list_options' has no member named 'socket_getpeersec_stream' 2058 | socket_getpeersec_stream.socket_getpeersec_stream = NULL; | ^ In file included from ./include/linux/timer.h:5, from ./include/linux/workqueue.h:9, from ./include/linux/bpf.h:9, from security/security.c:13: security/security.c:2060:25: error: 'struct security_hook_heads' has no member named 'socket_getpeersec_stream' 2060 | &security_hook_heads.socket_getpeersec_stream, | ^ ./include/linux/list.h:857:12: note: in definition of macro 'hlist_entry_safe' 857 | ({ typeof(ptr) ____ptr = (ptr); \ | ^~~ security/security.c:2059:3: note: in expansion of macro 'hlist_for_each_entry' 2059 | hlist_for_each_entry(hp, | ^~~~~~~~~~~~~~~~~~~~ security/security.c:2060:25: error: 'struct security_hook_heads' has no member named 'socket_getpeersec_stream' 2060 | &security_hook_heads.socket_getpeersec_stream, | ^ ./include/linux/list.h:857:28: note: in definition of macro 'hlist_entry_safe' 857 | ({ typeof(ptr) ____ptr = (ptr); \ | ^~~ security/security.c:2059:3: note: in expansion of macro 'hlist_for_each_entry' 2059 | hlist_for_each_entry(hp, | ^~~~~~~~~~~~~~~~~~~~ In file included from ./include/linux/list.h:9, from ./include/linux/timer.h:5, from ./include/linux/workqueue.h:9, from ./include/linux/bpf.h:9, from security/security.c:13: ./include/linux/kernel.h:993:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 993 | void *__mptr = (void *)(ptr); \ | ^ ./include/linux/list.h:847:40: note: in expansion of macro 'container_of' 847 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member) | ^~~~~~~~~~~~ . . BTW, when I do the same with linux-5.4.21 vanila source, it compiles ok. Can anyone give me an advice? Could this Ubuntu-5.4.0-42.46 version have a bug and maybe I need a patch? Thank you! Chan Kim
On Tue, Jun 29, 2021 at 7:07 AM <ckim@etri.re.kr> wrote:
I found from https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel, the correct method to build ubuntu is (for ARCH=arm64 case)
- LANG=C fakeroot debian/rules ARCH=arm64 clean - # quicker build: - LANG=C fakeroot debian/rules ARCH=arm64 binary-headers binary-generic binary-perarch - # if you need linux-tools or lowlatency kernel, run instead: - LANG=C fakeroot debian/rules ARCH=arm64 binary
But when I tried it, it went far longer but eventually it failed with error.
….
Creating symlink /home/ckim/prj1/QEMU/qemu_test/test_ubuntu-20.04-build/focal/ubuntu-focal/debian/build/builddkms/build/zfs/0.8.3/source ->
/home/ckim/prj1/QEMU/qemu_test/test_ubuntu-20.04-build/focal/ubuntu-focal/debian/build/builddkms/source/zfs-0.8.3
DKMS: add completed.
Running the pre_build script:
checking for gawk... gawk
checking metadata... META file
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
…..
checking kernel source version... 5.4.0-42-generic
checking kernel file name for module symbols... Module.symvers
checking whether modules can be built... no
configure: error:
*** Unable to build an empty module.
Building module:
cleaning build area...(bad exit status: 2)
make -j28 KERNELRELEASE=5.4.0-42-generic...(bad exit status: 2)
ERROR (dkms apport): binary package for zfs: 0.8.3 not found
Based on the error message above you may not have the zfs-dkms package installed.
Error! Bad return status for module build on kernel: 5.4.0-42-generic (x86_64)
Consult /home/ckim/prj1/QEMU/qemu_test/test_ubuntu-20.04-build/focal/ubuntu-focal/debian/build/builddkms/build/zfs/0.8.3/build/make.log for more information.
DKMS make.log for zfs-0.8.3 for kernel 5.4.0-42-generic (x86_64)
Tue Jun 29 11:43:02 KST 2021
make[1]: Entering directory '<<DKMSDIR>>/build/zfs/0.8.3/build'
make[1]: *** No targets specified and no makefile found. Stop.
make[1]: Leaving directory '<<DKMSDIR>>/build/zfs/0.8.3/build'
make: *** [debian/rules.d/2-binary-arch.mk:223: install-generic] Error 1
And according to the guide, I’m supposed to see in ../ directory two linux headers .deb files and a linux-image .deb file but I see only linux-headers-5.4.0-42_5.4.0-42.46_all.deb
Can anyone give me an advice? Any suggestion will be appreciated.
Thank you!
Chan Kim
*From:* ckim@etri.re.kr <ckim@etri.re.kr> *Sent:* Tuesday, June 29, 2021 10:04 AM *To:* kernelnewbies@kernelnewbies.org *Subject:* kernel build error during ubuntu linux kernel build
Hello, all
I have a strange problem in building the linux kernel from ubuntu. (I want to replace the kernel in ubuntu to debug install failure on qemu virtual machine)
I downloaded ubuntu source by “git clone git:// kernel.ubuntu.com/ubuntu/ubuntu-focal.git”. and because I wanted to use a specific version, I did “git checkout Ubuntu-5.4.0-42.46” (this version is the one used in a ubuntu installation .iso.
And you can see related askubuntu question here : https://askubuntu.com/questions/1347390/what-ubuntu-source-version-should-i-... )
After git-checkout, the `git log` shows this result :
commit 98c4545e2d65ed35c31056f72c4da20f6b5ea0d0 (HEAD, tag: Ubuntu-5.4.0-42.46)
Author: Khalid Elmously <khalid.elmously@canonical.com>
Date: Thu Jul 9 19:50:26 2020 -0400
UBUNTU: Ubuntu-5.4.0-42.46
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
To build the kernel, I did `ARCH=arm64 CROSS_COMPILE=aarch64-none-elf- make defconfig` and `ARCH=arm64 CROSS_COMPILE=aarch64-none-elf- make -j24 Image`. But this gives me a compile error below. What can be wrong?
.
.
CC mm/interval_tree.o
CC drivers/base/regmap/regcache.o
CC kernel/time/posix-cpu-timers.o
CC mm/list_lru.o
CC block/blk-mq.o
AS arch/arm64/lib/memchr.o
CC fs/ext4/migrate.o
security/security.c: In function 'security_add_hooks':
security/security.c:477:25: error: 'struct security_hook_heads' has no member named 'socket_getpeersec_stream'
477 | &security_hook_heads.socket_getpeersec_stream)
| ^
CC kernel/time/posix-clock.o
AS arch/arm64/lib/memcmp.o
security/security.c: In function 'security_setprocattr':
CC arch/arm64/kvm/../../../virt/kvm/arm/vgic/vgic-v2.o
security/security.c:2058:27: error: 'union security_list_options' has no member named 'socket_getpeersec_stream'
2058 | socket_getpeersec_stream.socket_getpeersec_stream = NULL;
| ^
In file included from ./include/linux/timer.h:5,
from ./include/linux/workqueue.h:9,
from ./include/linux/bpf.h:9,
from security/security.c:13:
security/security.c:2060:25: error: 'struct security_hook_heads' has no member named 'socket_getpeersec_stream'
2060 | &security_hook_heads.socket_getpeersec_stream,
| ^
./include/linux/list.h:857:12: note: in definition of macro 'hlist_entry_safe'
857 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
security/security.c:2059:3: note: in expansion of macro 'hlist_for_each_entry'
2059 | hlist_for_each_entry(hp,
| ^~~~~~~~~~~~~~~~~~~~
security/security.c:2060:25: error: 'struct security_hook_heads' has no member named 'socket_getpeersec_stream'
2060 | &security_hook_heads.socket_getpeersec_stream,
| ^
./include/linux/list.h:857:28: note: in definition of macro 'hlist_entry_safe'
857 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
security/security.c:2059:3: note: in expansion of macro 'hlist_for_each_entry'
2059 | hlist_for_each_entry(hp,
| ^~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/list.h:9,
from ./include/linux/timer.h:5,
from ./include/linux/workqueue.h:9,
from ./include/linux/bpf.h:9,
from security/security.c:13:
./include/linux/kernel.h:993:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
993 | void *__mptr = (void *)(ptr); \
| ^
./include/linux/list.h:847:40: note: in expansion of macro 'container_of'
847 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
| ^~~~~~~~~~~~
.
.
BTW, when I do the same with linux-5.4.21 vanila source, it compiles ok.
Can anyone give me an advice? Could this Ubuntu-5.4.0-42.46 version have a bug and maybe I need a patch?
Thank you!
Chan Kim
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Hello Alexander Kapshuk, Thanks for the reply. Following your advice, I installed `sudo apt install zfs-dkms` ( it gave me this scary-looking warning below I just installed it, because I’ll not distribute anything) It installs sources for zfs-dkms and I understand it contains bash script to automatically compile it when the kernel changes. I later found I had to do these commands. export $(dpkg-architecture -aarm64); export CROSS_COMPILE=arm-linux-gnueabihf- LANG=C fakeroot debian/rules ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- clean LANG=C fakeroot debian/rules ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- binary-headers binary-generic binary-perarch Before this, I had to download gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu from https://developer.arm.com/tools-and-software/open-source-software/developer-... because I saw some compiler error related to STACKPROTECTOR compile option when I used gcc tool from linaro which was based on gcc 7.5 (I remember, the new toolchain is gcc 10.2 based). With these, I could finally compile ubuntu 20.04! (For those interested, please see https://unix.stackexchange.com/questions/656263/how-to-build-ubuntu-for-arm6...) Thank you! Chan Kim _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org <mailto:Kernelnewbies@kernelnewbies.org> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Thu, Jul 1, 2021 at 4:03 AM <ckim@etri.re.kr> wrote:
Hello Alexander Kapshuk,
Thanks for the reply. Following your advice, I installed `sudo apt install zfs-dkms` ( it gave me this scary-looking warning below I just installed it, because I’ll not distribute anything)
It installs sources for zfs-dkms and I understand it contains bash script to automatically compile it when the kernel changes.
I later found I had to do these commands.
export $(dpkg-architecture -aarm64); export CROSS_COMPILE=arm-linux-gnueabihf-
LANG=C fakeroot debian/rules ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- clean
LANG=C fakeroot debian/rules ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- binary-headers binary-generic binary-perarch
Before this, I had to download gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu from https://developer.arm.com/tools-and-software/open-source-software/developer-... because I saw some compiler error related to STACKPROTECTOR compile option when I used gcc tool from linaro which was based on gcc 7.5 (I remember, the new toolchain is gcc 10.2 based).
With these, I could finally compile ubuntu 20.04!
Great to hear. Thanks for letting us know.
(For those interested, please see https://unix.stackexchange.com/questions/656263/how-to-build-ubuntu-for-arm6... )
Thank you!
Chan Kim
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
participants (2)
-
Alexander Kapshuk -
ckim@etri.re.kr