trinib / AdGuard-WireGuard-Unbound-DNScrypt

Linux ultimate self-hosted network security guide ║ Linux 终极自托管网络安全指南 ║ Guía definitiva de seguridad de red autohospedada de Linux ║ लिनक्स परम स्व-होस्टेड नेटवर्क सुरक्षा गाइड ║ Окончательное руководство по безопасности собственной сети Linux
MIT License
765 stars 60 forks source link

Unbound self-compiling from latest source #66

Closed MossNotFound closed 1 year ago

MossNotFound commented 1 year ago

Operating System

Ubuntu, Other (explain in description)

Architecture

64-bit

Platform

Linux

Project

Unbound

Browser

Other

Issue

No response

Issue Description

OS: Ubuntu and Debian from VPS

Hi, i'm trying to self-compile unbound from source following steps in the wiki but encounter this error

wireshark@localhost:~/unbound-1.17.0$ ./configure --prefix=/usr --sysconfdir=/etc --with-conf-file=/etc/unbound/unbound.conf.d/unbound.conf --with-run-dir=/var/lib/unbound --with-rootkey-file=/var/lib/unbound/root.key --enable-subnet --enable-ipset --enable-cachedb --enable-checking --with-libhiredis --with-libevent --enable-systemd \ 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 we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define EXTENSIONS... yes checking for an ANSI C-conforming const... yes checking whether gcc supports -g... yes checking whether gcc supports -O2... yes checking for gcc... (cached) gcc checking whether we are using the GNU C compiler... (cached) yes checking whether gcc accepts -g... (cached) yes checking for gcc option to accept ISO C89... (cached) none needed checking gcc dependency flag... -MM checking whether gcc supports -Werror... yes checking whether gcc supports -Wall... yes checking whether gcc supports -std=c99... yes checking whether gcc supports -xc99... no checking for getopt.h... yes checking for time.h... yes checking whether we need -std=c99 -DEXTENSIONS -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE as a flag for gcc... failed checking whether we need -std=c99 -DEXTENSIONS -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE as a flag for gcc... failed checking whether we need -std=c99 as a flag for gcc... no checking whether we need -D_BSD_SOURCE -D_DEFAULT_SOURCE as a flag for gcc... no checking whether we need -D_GNU_SOURCE as a flag for gcc... yes checking whether we need -D_GNU_SOURCE -D_FRSRESGID as a flag for gcc... no checking whether we need -D_POSIX_C_SOURCE=200112 as a flag for gcc... no checking whether we need -DEXTENSIONS as a flag for gcc... failed checking whether gcc supports -W... yes checking whether gcc supports -Wall... (cached) yes checking whether gcc supports -Wextra... yes checking whether gcc supports -Wdeclaration-after-statement... yes checking if gcc supports -flto... yes checking for inline... inline checking whether the C compiler (gcc) accepts the "format" attribute... yes checking whether the C compiler (gcc) accepts the "unused" attribute... yes checking whether the C compiler (gcc) accepts the "weak" attribute... yes checking whether the C compiler (gcc) accepts the "noreturn" attribute... yes checking for flex... flex checking lex output file root... lex.yy checking lex library... -lfl checking whether yytext is a pointer... yes checking for yylex_destroy... yes checking for lex %option... yes checking for bison... bison -y checking for doxygen... no checking for strip... strip checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for ar... /usr/bin/ar checking how to print strings... printf checking for a sed that does not truncate output... /usr/bin/sed 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 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 archiver @FILE support... @ checking for strip... (cached) strip checking for ranlib... ranlib checking for gawk... no checking for mawk... mawk 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 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 pkg-config... no checking for stdarg.h... yes checking for stdbool.h... yes checking for netinet/in.h... yes checking for netinet/tcp.h... yes checking for sys/param.h... yes checking for sys/select.h... yes checking for sys/socket.h... yes checking for sys/un.h... yes checking for sys/uio.h... yes checking for sys/resource.h... yes checking for arpa/inet.h... yes checking for syslog.h... yes checking for netdb.h... yes checking for sys/wait.h... yes checking for pwd.h... yes checking for glob.h... yes checking for grp.h... yes checking for login_cap.h... no checking for winsock2.h... no checking for ws2tcpip.h... no checking for endian.h... yes checking for sys/endian.h... no checking for libkern/OSByteOrder.h... no checking for sys/ipc.h... yes checking for sys/shm.h... yes checking for ifaddrs.h... yes checking for poll.h... yes checking for net/if.h... yes checking for TargetConditionals.h... no checking for netioapi.h... no checking for int8_t... yes checking for int16_t... yes checking for int32_t... yes checking for int64_t... yes checking for uint8_t... yes checking for uint16_t... yes checking for uint32_t... yes checking for uint64_t... yes checking for size_t... yes checking for ssize_t... yes checking for uid_t in sys/types.h... yes checking for pid_t... yes checking for off_t... yes checking for u_char... yes checking for rlim_t... yes checking for socklen_t... yes checking for in_addr_t... yes checking for in_port_t... yes checking if memcmp compares unsigned... yes checking size of time_t... 8 checking size of size_t... 8 checking for library containing inet_pton... none required checking for library containing socket... none required checking for unistd.h... (cached) yes checking for working chown... yes checking vfork.h usability... no checking vfork.h presence... no checking for vfork.h... no checking for fork... yes checking for vfork... yes checking for working fork... yes checking for working vfork... (cached) yes checking for _LARGEFILE_SOURCE value needed for large files... no checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... no checking whether we need -D_LARGEFILE_SOURCE=1 as a flag for gcc... no checking if nonblocking sockets work... yes checking whether mkdir has one arg... no checking for strptime... yes checking whether strptime works... yes checking for SYSTEMD... no checking for SYSTEMD_DAEMON... no configure: error: systemd enabled but libsystemd not found

Tried again on a clean ubuntu instance, running as root and sudo, reinstalling libsystemd and downgrading to 1.16.0 but still the same error.

Next I tried removing --enable-systemd flag and got thru swiftly till the service part which i can't seem to get it working.

welcome[bot] commented 1 year ago

Thanks for opening your first issue here 🙋🕵️

trinib commented 1 year ago

try installing

sudo apt-get install libudev-dev
MossNotFound commented 1 year ago

Already installed. Reinstalled for good measure but that still didn't do the trick. libudev-dev is already the newest version (247.3-7+deb11u1).

trinib commented 1 year ago

@MossNotFound can you install older version systemd to see if that is the issue..

sudo apt install systemd=245.4-4ubuntu3

or build newer versions https://github.com/systemd/systemd/releases

MossNotFound commented 1 year ago

can't seem to get that command working on any ubuntu version so I just tried on ubuntu 18.04 which had a version of like 239 smth and debian sid with systemd v252.3-2 and still getting the same error, I tried building systemd but the dependencies are such a pain and when I actually got to build it just gave out unsearchable errors. Thinking of just moving everything over to Arch Linux with precompiled Unbound 1.17.0

MossNotFound commented 1 year ago

oh, I just saw that debian sid also has unbound 1.17.0 so my issue is solved now, Thank you for your help.

trinib commented 1 year ago

@MossNotFound I build unbound 1.17.0 with no issues on Debian 11 bullseye. systemd 247 version is installed

L0T8 commented 1 year ago

I have the same problem as above. I'm running DietPi v8.16.2 x86_64 (Debian 11 bullseye) via VirtualBox on my Mac. Tried both systemd (247.3-7+deb11u1) and systemd (252.5-2~bpo11+1) to no avail. Also tried libudev-dev and libsystemd-dev in both bullseye and bullseye-backport.

Take a look at line 11 and line 19 to 26 in https://github.com/NLnetLabs/unbound/blob/master/systemd.m4

Line 11:

PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [have_systemd=yes], [have_systemd=no])

Line 19 - 26:

    AS_CASE([$enable_systemd:$have_systemd],
    [yes:no],
        [AC_MSG_ERROR([systemd enabled but libsystemd not found])],
    [*:yes],
        [AC_DEFINE([HAVE_SYSTEMD], [1], [Define to 1 if systemd should be used])
        LIBS="$LIBS $SYSTEMD_LIBS"
        ]
    )

It seems that it's not detecting libsystemd correctly. 🤔

L0T8 commented 1 year ago

UPDATE

IT WORKS!! @MossNotFound

Here's how...

  1. Run this apt command.

    sudo apt install pkg-config
  2. Compile Unbound by running a ./configure... line

  3. Done!

I figured it out after reading how PKG_CHECK_MODULES works. It requires pkg-config which doesn't come with a fresh install of Linux (DietPi Debian bullseye for me).

trinib commented 1 year ago

UPDATE

IT WORKS!! @MossNotFound

Here's how...

1. Run this apt command.
sudo apt install pkg-config
2. Compile Unbound by running a ./configure... line

3. Done!

I figured it out after reading how PKG_CHECK_MODULES works. It requires pkg-config which doesn't come with a fresh install of Linux (DietPi Debian bullseye for me).

good one . yes dietpi misses alot of package to make a lite OS.