radxa / apt

radxa debian packages repository
http://radxa.com/Rabian
35 stars 6 forks source link

linux-headers-4.4.143-57 contains x86_64 fixdep binary #11

Open MichaIng opened 3 years ago

MichaIng commented 3 years ago

I'm trying to build a kernel module (WireGuard via DKMS) on ROCK Pi S with linux-headers-4.4.143-57-rockchip-g4b8d0571d76e headers package but the build fails as the contained fixdep binary is for x86_64 instead of aarch64:

root@ROCKPiS:/usr/src/linux-headers-4.4.143-57-rockchip-g4b8d0571d76e# file scripts/basic/fixdep
scripts/basic/fixdep: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=34ad80d3b402859d4bf7f9340b69625a9186246e, not stripped

I guess this is due to cross-compiling the kernel/headers on an x86_64 machine.

MichaIng commented 3 years ago

I'll give it a try with the new kernel package build: https://github.com/radxa/apt/tree/gh-pages/buster-stable/pool/main/l/linux-4.4.143-65-rockchip-g58431d38f8f3 Many thanks for providing those 👍.

MichaIng commented 3 years ago

The issue is still present:

# file /usr/src/linux-headers-4.4.143-65-rockchip-g58431d38f8f3/scripts/basic/fixdep
/usr/src/linux-headers-4.4.143-65-rockchip-g58431d38f8f3/scripts/basic/fixdep: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=34ad80d3b402859d4bf7f9340b69625a9186246e, not stripped

EDIT: Testing new packages in testing repo as well: https://github.com/radxa/apt/commit/d0e6cc12f3724146445b106788c0f19e2ce4f778 EDIT2: Upload of this commit is still outstanding, the (buster-testing) repo ships still 4.4.143-65.

MichaIng commented 2 years ago

Issue remains with 4.4.143-66 kernel and headers:

DKMS make.log for wireguard-1.0.20210219 for kernel 4.4.143-66-rockchip-g01bbbc5d1312 (aarch64)
Mon Sep 13 15:15:26 CEST 2021
make: Entering directory '/usr/src/linux-headers-4.4.143-66-rockchip-g01bbbc5d1312'
  LD      /var/lib/dkms/wireguard/1.0.20210219/build/built-in.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20210219/build/main.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20210219/build/noise.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20210219/build/device.o
  CC [M]  /var/lib/dkms/wireguard/1.0.20210219/build/peer.o
/bin/sh: 1: scripts/basic/fixdep: not found
make[1]: *** [scripts/Makefile.build:277: /var/lib/dkms/wireguard/1.0.20210219/build/main.o] Error 127
make[1]: *** Waiting for unfinished jobs....
/bin/sh: 1: scripts/basic/fixdep: not found
make[1]: *** [scripts/Makefile.build:277: /var/lib/dkms/wireguard/1.0.20210219/build/peer.o] Error 127
/bin/sh: 1: scripts/basic/fixdep: not found
make[1]: *** [scripts/Makefile.build:277: /var/lib/dkms/wireguard/1.0.20210219/build/device.o] Error 127
/bin/sh: 1: scripts/basic/fixdep: not found
make[1]: *** [scripts/Makefile.build:277: /var/lib/dkms/wireguard/1.0.20210219/build/noise.o] Error 127
make: *** [Makefile:1471: _module_/var/lib/dkms/wireguard/1.0.20210219/build] Error 2
make: Leaving directory '/usr/src/linux-headers-4.4.143-66-rockchip-g01bbbc5d1312'

The error message is misleading, as the file exists, but it is an x86_64 binary:

# file /usr/src/linux-headers-4.4.143-66-rockchip-g01bbbc5d1312/scripts/basic/fixdep
/usr/src/linux-headers-4.4.143-66-rockchip-g01bbbc5d1312/scripts/basic/fixdep: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=34ad80d3b402859d4bf7f9340b69625a9186246e, not stripped

This is the result of building the package on an x86_64 system without forcing cross-compiling for aarch64 of included binaries.

hipboi commented 2 years ago

We've ordered an ARM server, please wait for our new native build. Currently it takes too long to compile on ROCK Pi.

MichaIng commented 2 years ago

Great to hear. Probably there would be build flag to perform cross-compiling as well, but I lack the experience with kernel building. Many thanks for addressing the issue 👍.

RadxaYuntian commented 2 years ago

Fixed in 2741ce5446b03a2d742dc50944022662473b430c.

MichaIng commented 2 years ago

@RadxaYuntian The issue was with the ROCK Pi S kernel (as well) 😉.

RadxaYuntian commented 2 years ago

@StephenInVamrs Please see the comment above.

MichaIng commented 2 years ago

I tested with the latest kernel from the here: https://github.com/radxa/apt/tree/gh-pages/buster-testing/pool/main/l/linux-4.4.143-67-rockchip-g01bbbc5d1312

This is not shipped with the live buster-testing repo yet. The fixdep issue is solved. However the build fails with a different error:

Traceback (most recent call last):
  File "./scripts/gcc-wrapper.py", line 113, in <module>
    status = run_gcc()
  File "./scripts/gcc-wrapper.py", line 96, in run_gcc
    print (line.decode("utf-8"), end="")
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 39: ordinal not in range(128)

That Python 2 is used at all, which is EOL, unsupported and not shipped with current distro versions, is another pain. Not sure whether it's possible to remove those Python 2 calls, otherwise I can only recommend to use mainline kernel. This one is causing more and more trouble (aside of the inability of building custom kernel modules), and mainline kernel ships with WireGuard module since a long time 😉.

StephenInVamrs commented 2 years ago

All the latest kernel packages in Radxa APT are built on ARM Server.

When compiling kernel module on Radxa boards, you don't need to recompile dependent libraries.

 $ cd /usr/src/linux-headers-$(uname -r)
 $ make scripts
MichaIng commented 2 years ago

The above was done automatically by DKMS, used by WireGuard and others to have rebuilds done automatically on kernel upgrades. Not sure whether there is a way to tell DKMS to not recompile dependent libraries (when only this was the issue), I couldn't find one in the man pages at least.