NICMx / Jool

SIIT and NAT64 for Linux
GNU General Public License v2.0
326 stars 66 forks source link

jool/3.5.6 build fails with custom Debian 4.14.13 kernel #261

Closed skorpy2009 closed 6 years ago

skorpy2009 commented 6 years ago

I have build an own Debian 4.14.13 kernel. I used the Debian Stretch-Backports Source and config for the build, the only diff in the config is that I have enabled CONFIG_IPV6_SEG6_LWTUNNEL & CONFIG_IPV6_SEG6_HMAC .

Now DKMS ans kmod Build fails.

dkms autoinstall

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j4 KERNELRELEASE=4.14.13 -C /lib/modules/4.14.13/build SUBDIRS=/var/lib/dkms/jool/3.5.6/build/mod/stateful modules && make -C /lib/modules/4.14.13/build SUBDIRS=/var/lib/dkms/jool/3.5.6/build/mod/stateless modules...(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.14.13 (x86_64)
Consult /var/lib/dkms/jool/3.5.6/build/make.log for more information.
Jool-3.5.6/mod# make
make -C stateless
make[1]: Verzeichnis „/home/ffadmin/Jool-3.5.6/mod/stateless“ wird betreten
make -C /lib/modules/4.14.13/build M=$PWD JOOL_FLAGS=""
make[2]: Verzeichnis „/usr/src/linux-headers-4.14.13“ wird betreten

make[3]: *** No rule to make target '/home/ffadmin/Jool-3.5.6/mod/stateless/../../common/stateless/xlat.o', needed by '/home/ffadmin/Jool-3.5.6/mod/stateless/jool_siit.o'.  Stop.
Makefile:1525: die Regel für Ziel „_module_/home/ffadmin/Jool-3.5.6/mod/stateless“ scheiterte
make[2]: *** [_module_/home/ffadmin/Jool-3.5.6/mod/stateless] Fehler 2
make[2]: Verzeichnis „/usr/src/linux-headers-4.14.13“ wird verlassen
Makefile:5: die Regel für Ziel „all“ scheiterte
make[1]: *** [all] Fehler 2
make[1]: Verzeichnis „/home/ffadmin/Jool-3.5.6/mod/stateless“ wird verlassen
Makefile:8: die Regel für Ziel „stateless“ scheiterte
make: *** [stateless] Fehler 2
root@jool1:/home/ffadmin/Jool-3.5.6/mod# cat /var/lib/dkms/jool/3.5.6/build/make.log
DKMS make.log for jool-3.5.6 for kernel 4.14.13 (x86_64)
Do 15. Mär 16:03:15 CET 2018
make: Verzeichnis „/usr/src/linux-headers-4.14.13“ wird betreten
make[1]: *** No rule to make target '/var/lib/dkms/jool/3.5.6/build/mod/stateful/pool4/empty.o', needed by '/var/lib/dkms/jool/3.5.6/build/mod/stateful/jool.o'.  Stop.
Makefile:1525: die Regel für Ziel „_module_/var/lib/dkms/jool/3.5.6/build/mod/stateful“ scheiterte
make: *** [_module_/var/lib/dkms/jool/3.5.6/build/mod/stateful] Fehler 2
make: Verzeichnis „/usr/src/linux-headers-4.14.13“ wird verlassen
ydahhrk commented 6 years ago

It's very similar to the errors I get when I try to compile Jool on a kernel installation that lacks kernel headers. I suppose that it might also happen if make fails to find the proper location of said kernel headers.

If your headers are located somewhere hard to find, do

$ make KERNEL_DIR=/path/to/your/headers

Here are the contents of my kernel headers directory, in case it helps:

ydahhrk@Nephenee:/usr/src/linux-headers-4.4.0-79-generic$ ls
arch    Documentation  include  Kconfig   mm              scripts   tools   zfs
block   drivers        init     kernel    Module.symvers  security  ubuntu
certs   firmware       ipc      lib       net             sound     usr
crypto  fs             Kbuild   Makefile  samples         spl       virt
skorpy2009 commented 6 years ago

Defining the headers Dir also does not help:


root@jool1:/home/ffadmin/Jool-3.5.6/mod# make KERNEL_DIR=/usr/src/linux-headers-4.14.13/
make -C stateless
make[1]: Verzeichnis „/home/ffadmin/Jool-3.5.6/mod/stateless“ wird betreten
make -C /usr/src/linux-headers-4.14.13/ M=$PWD JOOL_FLAGS=""
make[2]: Verzeichnis „/usr/src/linux-headers-4.14.13“ wird betreten
make[3]: *** No rule to make target '/home/ffadmin/Jool-3.5.6/mod/stateless/../../common/stateless/xlat.o', needed by '/home/ffadmin/Jool-3.5.6/mod/stateless/jool_siit.o'.  Stop.
Makefile:1525: die Regel für Ziel „_module_/home/ffadmin/Jool-3.5.6/mod/stateless“ scheiterte
make[2]: *** [_module_/home/ffadmin/Jool-3.5.6/mod/stateless] Fehler 2
make[2]: Verzeichnis „/usr/src/linux-headers-4.14.13“ wird verlassen
Makefile:5: die Regel für Ziel „all“ scheiterte
make[1]: *** [all] Fehler 2
make[1]: Verzeichnis „/home/ffadmin/Jool-3.5.6/mod/stateless“ wird verlassen
Makefile:8: die Regel für Ziel „stateless“ scheiterte
make: *** [stateless] Fehler 2
root@jool1:/home/ffadmin/Jool-3.5.6/mod# ls /usr/src/linux-headers-4.14.13/
arch   certs   debian   firmware  include  ipc      kernel  linux-headers.revision  mm              net      scripts   sound  usr
block  crypto  drivers  fs        init     Kconfig  lib     Makefile                Module.symvers  samples  security  tools  virt
ydahhrk commented 6 years ago

Oops, my bad. KERNEL_DIR should be the build/ directory inside the headers, not the root.

Try

$ make KERNEL_DIR=/usr/src/linux-headers-4.14.13/build

Still thinking, in case it doesn't work...

ydahhrk commented 6 years ago

Sorry; I'm mistaking the kernel headers directory with the modules directory. KERNEL_DIR is supposed to be the latter.

My correct KERNEL_DIR is /lib/modules/4.4.0-79-generic/build, not /usr/src/linux-headers-4.4.0-79-generic.

The correct contents of that directory is

ydahhrk@Nephenee:/lib/modules/4.4.0-79-generic/build$ ls
arch   crypto         firmware  init    Kconfig  Makefile        net      security  tools   virt
block  Documentation  fs        ipc     kernel   mm              samples  sound     ubuntu  zfs
certs  drivers        include   Kbuild  lib      Module.symvers  scripts  spl       usr
ydahhrk commented 6 years ago

Does the file /home/ffadmin/Jool-3.5.6/common/stateless/xlat.c exist?

It's kind of like that kernel is not enabled for compiling out-of-tree modules. Will try to read a little on that Debian variant and try to install it myself.

I don't think that the problem is the flags you enabled, because it fails as soon as it attempts to find the first listed .c to compile. It doesn't even manage to read the file.

Working...

skorpy2009 commented 6 years ago
ffadmin@jool1:~$ cat /home/ffadmin/Jool-3.5.6/common/stateless/xlat.c
#include "nat64/common/xlat.h"

bool xlat_is_siit(void)
{
    return true;
}

const char *xlat_get_name(void)
{
    return "SIIT Jool";
}
ydahhrk commented 6 years ago

All right, installing this is going to take a while so...

Could you please see if this minimalistic module compiles? No need to install or run it; just see if it compiles.

Giving me the instructions to install and compile that specific kernel would speed things up, too.

And finally: Can you send me the following file? You can find my e-mail in my profile if that medium is easiest for you.

/usr/src/linux-headers-4.14.13/Makefile
christf commented 6 years ago

chipping in - I am affected by this as well and I have access to the same machine. This is what happens when trying to compile the test module

ffadmin@jool1:~/test-module$ make
make -C /lib/modules/4.14.13/build M=$PWD
make[1]: Verzeichnis „/usr/src/linux-headers-4.14.13“ wird betreten
make[2]: *** No rule to make target '/home/ffadmin/test-module/test.o', needed by '/home/ffadmin/test-module/test1.o'.  Stop.
Makefile:1525: die Regel für Ziel „_module_/home/ffadmin/test-module“ scheiterte
make[1]: *** [_module_/home/ffadmin/test-module] Fehler 2
make[1]: Verzeichnis „/usr/src/linux-headers-4.14.13“ wird verlassen
Makefile:9: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2

Edit: seeing how this module does not compile makes me think that this may not be a jool issue. Still input and help would be greatly appreciated.

christf commented 6 years ago

this is the requested makefile: http://paste.debian.net/1014987/

christf commented 6 years ago

After starting from scratch I was able to build the jool modules following the manual and your advice here to specify the location of the kernel tree. Thank you for your support.

ydahhrk commented 6 years ago

My VM is still compiling :p

ydahhrk commented 6 years ago

Works for me as well.

Just in case I need to do it again:

Did this on the latest Debian as of now. (debian-9.4.0-amd64-netinst.iso)
Based on https://www.debian.org/releases/jessie/i386/ch08s06.html.en

-- root --
    6  nano /etc/apt/sources.list
    Add the following entries:
        deb http://ftp.debian.org/debian stretch-backports main
        deb-src http://ftp.debian.org/debian stretch-backports main
    7  apt-get update
   21  apt install dpkg-dev fakeroot kernel-package
   22  apt install pkg-config ncurses-dev libelf-dev
    (Some of these apt installs might be unnecessary;
    I'm just frankensteining these commands from the
    command history of both users.)

-- unprivileged user --
   11  apt-get source linux-image-4.13.0-0.bpo.1-amd64
   13  cd linux-4.14.13/
   20  make menuconfig # Tweak IPV6_SEG6_LWTUNNEL and IPV6_SEG6_HMAC here
   26  make-kpkg clean
   27  fakeroot make-kpkg --initrd --revision=1.0.potato kernel_image

-- root --
   30  dpkg -i ../linux-image-4.14.13_1.0.potato_amd64.deb 
   31  shutdown -r now
    (Choose the new kernel in GRUB.)

-- unprivileged user --
   34  cd Downloads/Jool-3.5.6/mod/
   42  make