vel21ripn / nDPI

Open Source Deep Packet Inspection Software Toolkit
http://www.ntop.org
GNU Lesser General Public License v3.0
121 stars 59 forks source link

No pkg-config --variable=xtlibdir xtables #172

Closed houmie closed 1 year ago

houmie commented 1 year ago

Describe the bug

While trying to compile it on Debian 12:

sudo -E apt install -y dh-dkms
sudo -E apt install -y autoconf automake libtool libpcap-dev xtables-addons-common module-assistant
sudo -E module-assistant auto-install xtables-addons-source

echo "Compiling nDPI"
cd ~
git clone https://github.com/vel21ripn/nDPI.git
cd nDPI
./autogen.sh
cd src/lib
make ndpi_network_list.c.inc
cd ..
cd ..
cd ndpi-netfilter
make
sudo make modules_install
sudo make install
sudo modprobe xt_ndpi
echo "xt_ndpi" | sudo tee /etc/modules >/dev/null
echo
echo "DPI successfully installed."

I get this error:

Compiling nDPI Cloning into 'nDPI'... remote: Enumerating objects: 52682, done. remote: Counting objects: 100% (10707/10707), done. remote: Compressing objects: 100% (799/799), done. remote: Total 52682 (delta 10133), reused 10233 (delta 9888), pack-reused 41975 Receiving objects: 100% (52682/52682), 204.06 MiB | 24.14 MiB/s, done. Resolving deltas: 100% (40211/40211), done. autoreconf: export WARNINGS= autoreconf: Entering directory '.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal --force -I m4 autoreconf: configure.ac: tracing autoreconf: running: libtoolize --copy --force libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, '.'. libtoolize: copying file './ltmain.sh' libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'. libtoolize: copying file 'm4/libtool.m4' [112/1470] libtoolize: copying file 'm4/ltoptions.m4' libtoolize: copying file 'm4/ltsugar.m4' libtoolize: copying file 'm4/ltversion.m4' libtoolize: copying file 'm4/lt~obsolete.m4' autoreconf: configure.ac: not using Intltool autoreconf: configure.ac: not using Gtkdoc autoreconf: running: aclocal --force -I m4 autoreconf: running: /usr/bin/autoconf --force autoreconf: running: /usr/bin/autoheader --force autoreconf: running: automake --add-missing --copy --force-missing configure.ac:87: installing './compile' configure.ac:87: installing './config.guess' configure.ac:87: installing './config.sub' configure.ac:6: installing './install-sh' configure.ac:6: installing './missing' fuzz/Makefile.am: installing './depcomp' parallel-tests: installing './test-driver' autoreconf: Leaving directory '.' ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a race-free mkdir -p... /usr/bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking how to print strings... printf checking whether make supports the include directive... yes (GNU style) checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether the compiler supports GNU C... yes checking whether gcc accepts -g... yes checking for gcc option to enable C11 features... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking for a sed that does not truncate output... /usr/bin/sed checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B checking the name lister (/usr/bin/nm -B) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 1572864 checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop checking for /usr/bin/ld option to reload object files... -r checking for file... file checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -B output from gcc object... ok checking for sysroot... no checking for a working dd... /usr/bin/dd checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1 checking for mt... mt checking if mt is a manifest tool... no checking for stdio.h... yes checking for stdlib.h... yes checking for string.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for strings.h... yes checking for sys/stat.h... yes checking for sys/types.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC -DPIC checking if gcc PIC flag -fPIC -DPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking for cos in -lm... yes checking for pkg-config... /usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking for gcc... (cached) gcc checking whether the compiler supports GNU C... (cached) yes checking whether gcc accepts -g... (cached) yes checking for gcc option to enable C11 features... (cached) none needed checking whether gcc understands -c and -o together... (cached) yes checking dependency style of gcc... (cached) gcc3 checking how to run the C preprocessor... gcc -E checking for inline... inline checking whether gcc and cc understand -c and -o together... yes checking for g++... g++ checking whether the compiler supports GNU C++... yes checking whether g++ accepts -g... yes checking for g++ option to enable C++11 features... none needed checking dependency style of g++... gcc3 checking for ar... (cached) ar Setting API version to 9100 checking for json-c... no configure: WARNING: JSON-C not available. Disabled unit test. checking for json_object_put in -ljson-c... no configure: WARNING: JSON-C not available. Disabled unit test. checking whether gcc is Clang... no checking whether pthreads work with "-pthread" and "-lpthread"... yes checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE checking whether more special flags are required for pthreads... no checking for PTHREAD_PRIO_INHERIT... yes checking for netinet/in.h... yes checking for stdint.h... (cached) yes checking for stdlib.h... (cached) yes checking for string.h... (cached) yes checking for unistd.h... (cached) yes checking for math.h... yes checking for float.h... yes checking for sqrt in -lm... no checking for rrd_fetch_r in -lrrd... no checking DPDK (used by ndpiReader)... no (missing /home/admin/DPDK) checking for numa_available in -lnuma... no checking PF_RING nBPF (/home/admin/nDPI/../PF_RING/userland/nbpf)... no checking for pcap_open_live in -lpcap... yes checking for pthread_setaffinity_np in -lpthread... yes checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating example/Makefile config.status: creating example/Makefile.dpdk config.status: creating tests/Makefile config.status: creating tests/unit/Makefile config.status: creating tests/performance/Makefile config.status: creating tests/dga/Makefile config.status: creating rrdtool/Makefile config.status: creating influxdb/Makefile config.status: creating libndpi.pc config.status: creating src/include/ndpi_define.h config.status: creating src/lib/Makefile config.status: creating fuzz/Makefile config.status: creating doc/Doxyfile.cfg config.status: creating tests/do.sh config.status: creating src/include/ndpi_config.h config.status: executing depfiles commands config.status: executing libtool commands depbase=echo ndpi_network_list_compile.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';\ gcc -DHAVE_CONFIG_H -I. -I../../src/include -I../../src/include/ -I../../src/lib/third_party/include/ -g -O2 -fPIC -DPIC -DNDPI_LIB_COMPILATION -MT ndpi_network_list_compile.o -MD -MP -MF $depbase.Tpo -c -o ndpi_network_list_compile.o ndpi_network_list_compile.c &&\ mv -f $depbase.Tpo $depbase.Po /bin/bash ../../libtool --tag=CC --mode=link gcc -g -O2 -fPIC -DPIC -DNDPI_LIB_COMPILATION -o ndpi_network_list_compile ndpi_network_list_compile.o libtool: link: gcc -g -O2 -fPIC -DPIC -DNDPI_LIB_COMPILATION -o ndpi_network_list_compile ndpi_network_list_compile.o ./ndpi_network_list_compile -o ndpi_network_list.c.inc ndpi_network_list_amazon_aws.yaml ndpi_network_list_cloudflare.yaml ndpi_network_list_microsoft_365.yaml ndpi_network_list_microsoft_azure.yaml ndpi_network_list_mining.yaml ndpi_network_list_ms_one_drive.yaml ndpi_network_list_ms_outlook.yaml ndpi_network_list_other.yaml ndpi_network_list_skype_teams.yaml ndpi_network_list_tor.yaml ndpi_network_list_whatsapp.yaml ndpi_network_list_zoom.yaml Warning: line 227: '239.255.102.18/32' is multicast address! make -C ipt make[1]: Entering directory '/home/admin/nDPI/ndpi-netfilter/ipt' Makefile:10: No pkg-config --variable=xtlibdir xtables. Stop. make[1]: Leaving directory '/home/admin/nDPI/ndpi-netfilter/ipt' make: [Makefile:2: all] Error 2

Expected behavior

It should compile it as expected.

nDPI Environment (please complete the following information):

config.log

Thank you

houmie commented 1 year ago

Hi Vitaly @vel21ripn

Just to add more details. I just tested it once again with Debian 12. It seems that nDPI is incompatible with Iptables v1.8.9.

It complains that No pkg-config --variable=xtlibdir xtables.

admin@server:~/nDPI/ndpi-netfilter$ make
make -C ipt
make[1]: Entering directory '/home/admin/nDPI/ndpi-netfilter/ipt'
Makefile:10: *** No pkg-config --variable=xtlibdir xtables.  Stop.
make[1]: Leaving directory '/home/admin/nDPI/ndpi-netfilter/ipt'
make: *** [Makefile:2: all] Error 2

This works all fine with Debian 11. It should be the same issue with latest Ubuntu, as Ubuntu is based on Debian. Do you think you could kindly provide a fix for this?

Debian 11 is slowly getting deprecated. Thank you, Houman

houmie commented 1 year ago

A bit more details:

Even though xtables is installed, pkg-config can't find it.

admin@server: sudo apt install xtables-addons-common
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
xtables-addons-common is already the newest version (3.23-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

pkg-config --variable=xtlibdir xtables shows nothing.

houmie commented 1 year ago

Great news. It seems on Debian 12 we need to explicitly install:

sudo apt install libxtables-dev

Now it works. Yeeees!

There is only a small warning, not sure if this matters much: Warning: modules_install: missing 'System.map' file. Skipping depmod.

admin@server:~/nDPI/ndpi-netfilter$ sudo make modules_install
make -C src modules_install
make[1]: Entering directory '/home/admin/nDPI/ndpi-netfilter/src'
make -C /lib/modules/6.1.0-12-amd64/build M=$PWD modules_install;
make[2]: Entering directory '/usr/src/linux-headers-6.1.0-12-amd64'
  INSTALL /lib/modules/6.1.0-12-amd64/extra/xt_ndpi.ko
  DEPMOD  /lib/modules/6.1.0-12-amd64
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make[2]: Leaving directory '/usr/src/linux-headers-6.1.0-12-amd64'
if [ "" != "true" ]; then depmod -a; fi
make[1]: Leaving directory '/home/admin/nDPI/ndpi-netfilter/src'