﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
2534	Build error with clang 16 on Alpine	kenballus@…		"Nginx's current default branch (revision hash 44536076405cf79ebdd82a6a0ab27bb3aed86b04) fails to build with clang on Alpine Linux because of Werror and Wsign-compare.

Steps to reproduce:
0. Get a fresh Alpine Linux container:
`docker run --rm --workdir /repro -it alpine:3.18.0`
1. Get dependencies:
`apk add mercurial clang musl-dev pcre-dev zlib-dev make`
2. Clone nginx:
`hg clone ""https://hg.nginx.org/nginx""`
3. Configure:
`cd nginx && ./auto/configure --with-cc=clang`
4. Try to build:
`make`
5. Observe the warning->error that halts the build:
{{{
make -f objs/Makefile
make[1]: Entering directory '/repro/nginx'
...
clang -c -pipe  -O -Wall -Wextra -Wpointer-arith -Wconditional-uninitialized -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs \
	-o objs/src/event/ngx_event_udp.o \
	src/event/ngx_event_udp.c
src/event/ngx_event_udp.c:143:25: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare]
                 cmsg = CMSG_NXTHDR(&msg, cmsg))
                        ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR'
        __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [objs/Makefile:641: objs/src/event/ngx_event_udp.o] Error 1
make[1]: Leaving directory '/repro/nginx'
make: *** [Makefile:10: build] Error 2
}}}

The build succeeds with GCC 12.2.1 on Alpine, and with clang 16 on Debian. It's only clang 16 on Alpine that fails."	defect	closed	minor		nginx-core	1.25.x	wontfix		kenballus@…	Linux 7c234f30133d 6.4.11-arch2-1 #1 SMP PREEMPT_DYNAMIC Sat, 19 Aug 2023 15:38:34 +0000 x86_64 Linux	"Does not apply, since the issue is with the build.

If I build with gcc, then the output of nginx -V looks like this:
""""""
built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r10)
configure arguments:
"""""""
