Opened 16 months ago
Closed 16 months ago
#2534 closed defect (wontfix)
Build error with clang 16 on Alpine
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-core | Version: | 1.25.x |
Keywords: | Cc: | kenballus@… | |
uname -a: | Linux 7c234f30133d 6.4.11-arch2-1 #1 SMP PREEMPT_DYNAMIC Sat, 19 Aug 2023 15:38:34 +0000 x86_64 Linux | ||
nginx -V: |
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: """ |
Description (last modified by )
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:
- Get a fresh Alpine Linux container:
docker run --rm --workdir /repro -it alpine:3.18.0
- Get dependencies:
apk add mercurial clang musl-dev pcre-dev zlib-dev make
- Clone nginx:
hg clone "https://hg.nginx.org/nginx"
- Configure:
cd nginx && ./auto/configure --with-cc=clang
- Try to build:
make
- 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.
Change History (2)
comment:1 by , 16 months ago
Description: | modified (diff) |
---|
comment:2 by , 16 months ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
That's a known issue with clang and musl, see here:
https://www.openwall.com/lists/musl/2016/10/10/1
I don't think we can/should try to fix this. This is an obvious issue in the system headers, which a) should be fixed in the system headers, not in nginx, and b) shouldn't be reported by compiler at all.
An obvious workaround on nginx side is to use
--with-cc-opt="-Wno-error"
.