Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkdep does not detect compiler failures #1177

Open
infrastation opened this issue Apr 22, 2024 · 1 comment
Open

mkdep does not detect compiler failures #1177

infrastation opened this issue Apr 22, 2024 · 1 comment

Comments

@infrastation
Copy link
Member

This problem stands for all instances of mkdep, but it manifests in tcpdump only (tcpdump-4.99 commit 0bdde63):

> ./build_matrix.sh 
Haiku haikudev 1 hrev57709 Apr 21 2024 06:35:41 x86_64 x86_64 Haiku
OS identification: Haiku-hrev57709
Mon Apr 22 14:16:31 BST 2024
PREFIX set to '/boot/system/var/shared_memory/tcpdump_build_matrix.HkmGySf3'
Use system libpcap
make: *** No rule to make target 'distclean'.  Stop.
(Ignoring the make error.)
===== SETUP 1: CC=gcc BUILD_LIBPCAP=no REMOTE=? CMAKE=no CRYPTO=no SMB=no =====
$ ./build.sh
gcc (2023_08_10) 13.2.0
[...]
./mkdep -c gcc -m -M -s . -DHAVE_CONFIG_H -I. -I/packages/libpcap-1.10.4-2/.self/develop/headers fptype.c tcpdump.c <libnetdissect src list>
In file included from ./addrtoname.c:101:
./getservent.h:42:2: error: #error netdb.h and getservent.h are incompatible
   42 | #error netdb.h and getservent.h are incompatible
      |  ^~~~~
$ make -s clean
$ make -s CFLAGS=-Werror
In file included from ./missing/getservent.c:42:
./getservent.h:42:2: error: #error netdb.h and getservent.h are incompatible
   42 | #error netdb.h and getservent.h are incompatible
(and many other errors)

The reason why the script does not detect the compiler failure is because it is not the last command of a pipe:

$CC $DEPENDENCY_CFLAG $flags $sources |
sed "
        s; \./; ;g
        $SED" >> $TMP

Because the -o pipefail shell option is a bashism, a portable solution could be replacing the pipe with two independent commands and an additional temporary file.

@infrastation
Copy link
Member Author

The compiler generates an error because HAVE_GETSERVENT is not defined because in tcpdump-4.99 Autoconf does not detect getservent(), which in Haiku requires -lnetwork. This problem is not new. Currently the tcpdump recipe in HaikuPorts uses a patch to work around that, and the master branch since commit de21eda uses a version of AC_LBL_LIBRARY_NET that correctly works on Haiku.

But the matter is, the compiler failure should have caused mkdep to fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant