build: Make the build work on Debian 11 03/35203/2
authorAndrew Yourtchenko <ayourtch@gmail.com>
Wed, 2 Feb 2022 19:32:18 +0000 (19:32 +0000)
committerDave Wallace <dwallacelf@gmail.com>
Mon, 7 Feb 2022 18:40:51 +0000 (18:40 +0000)
Debian 11 has some packages that have changed, and need adjustment.
Also - its default compiler is gcc 10, which, contrary to either gcc 8
or gcc 11 prints a bunch of warnings, which fails compilation.
And there is no gcc 11 package.

Therefore, use clang for this build.

Additionally, python 3.9 has exposed this issue:
https://bugs.python.org/issue42580

Therefore, make a local patch to scapy to tackle it.

Type: feature
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: I7b9c0f852ab97fe3c1feca3f22020ac0970ba3e2

Makefile
test/patches/scapy-2.4.3/issue42580.patch [new file with mode: 0644]

index fd211f8..fb5bd1d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -72,7 +72,7 @@ DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml
 DEB_DEPENDS += python3-venv  # ensurepip
 DEB_DEPENDS += python3-dev   # needed for python3 -m pip install psutil
 DEB_DEPENDS += libnl-3-dev libnl-route-3-dev libmnl-dev
-DEB_DEPENDS += enchant  # for docs
+DEB_DEPENDS += enchant  # for docs
 DEB_DEPENDS += python3-virtualenv
 DEB_DEPENDS += libssl-dev
 DEB_DEPENDS += libelf-dev # for libbpf (af_xdp)
@@ -96,6 +96,10 @@ else ifeq ($(OS_VERSION_ID),20.10)
        LIBFFI=libffi8ubuntu1
 else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-10)
        DEB_DEPENDS += virtualenv
+else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-11)
+       DEB_DEPENDS += virtualenv
+       DEB_DEPENDS += clang-11 clang-format-11
+       LIBFFI=libffi7
 else
        # TODO: change CLANG_FORMAT_VER default in extras/scripts/checkstyle.sh
        #       when clang-format-10 is removed
diff --git a/test/patches/scapy-2.4.3/issue42580.patch b/test/patches/scapy-2.4.3/issue42580.patch
new file mode 100644 (file)
index 0000000..1269cb9
--- /dev/null
@@ -0,0 +1,19 @@
+*** a/scapy/arch/bpf/core.py.orig      2022-02-02 16:25:51.475845472 +0000
+--- b/scapy/arch/bpf/core.py   2022-02-02 16:26:11.868800941 +0000
+***************
+*** 28,34 ****
+  
+  # ctypes definitions
+  
+! LIBC = cdll.LoadLibrary(find_library("libc"))
+  LIBC.ioctl.argtypes = [c_int, c_ulong, c_char_p]
+  LIBC.ioctl.restype = c_int
+  
+--- 28,34 ----
+  
+  # ctypes definitions
+  
+! LIBC = cdll.LoadLibrary(find_library("c"))
+  LIBC.ioctl.argtypes = [c_int, c_ulong, c_char_p]
+  LIBC.ioctl.restype = c_int
+