Comments (13)
That's their perogative. I don't see a compelling reason why we shouldn't.
from unit.
Lets move this to a separate issue...
from unit.
A long known issue between musl libc and clang.
One way to workaround this would be to create our own wrapper around CMSG_NXTHDR and do the #pragma thing...
Something like the following perhaps...
diff --git a/src/nxt_socket_msg.h b/src/nxt_socket_msg.h
index 04de1761..fca82f05 100644
--- a/src/nxt_socket_msg.h
+++ b/src/nxt_socket_msg.h
@@ -69,6 +69,19 @@ NXT_EXPORT ssize_t nxt_recvmsg(nxt_socket_t s,
nxt_iobuf_t *iob, nxt_uint_t niob, nxt_recv_oob_t *oob);
+static inline struct cmsghdr *
+NXT_CMSG_NXTHDR(struct msghdr *msg, struct cmsghdr *cmsg)
+{
+#ifndef __GLIBC__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wsign-compare"
+#endif
+ return CMSG_NXTHDR(msg, cmsg);
+#ifndef __GLIBC__
+#pragma clang diagnostic pop
+#endif
+}
+
nxt_inline void
nxt_socket_msg_oob_init(nxt_send_oob_t *oob, int *fds)
{
@@ -135,7 +148,7 @@ nxt_socket_msg_oob_get_fds(nxt_recv_oob_t *oob, nxt_fd_t *fd
)
for (cmsg = CMSG_FIRSTHDR(&msg);
cmsg != NULL;
- cmsg = CMSG_NXTHDR(&msg, cmsg))
+ cmsg = NXT_CMSG_NXTHDR(&msg, cmsg))
{
size = cmsg->cmsg_len - CMSG_LEN(0);
@@ -174,7 +187,7 @@ nxt_socket_msg_oob_get(nxt_recv_oob_t *oob, nxt_fd_t *fd, nx
t_pid_t *pid)
for (cmsg = CMSG_FIRSTHDR(&msg);
cmsg != NULL;
- cmsg = CMSG_NXTHDR(&msg, cmsg))
+ cmsg = NXT_CMSG_NXTHDR(&msg, cmsg))
{
size = cmsg->cmsg_len - CMSG_LEN(0);
from unit.
Hi,
@ac000 @andypost
Could you try NGINX with the same OS?
> git clone https://github.com/nginx/nginx.git
> cd nginx
> ./auto/configure && make
@andrey-zelenkov Do we need to add it to BB?
from unit.
nginx has the same issue
$ auto/configure --with-cc=clang && make -j4
...
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_connect.o \
src/event/ngx_event_connect.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.
from unit.
Good catch, thanks.
from unit.
See https://trac.nginx.org/nginx/ticket/2534 for the related issue in nginx. They decided not to fix that.
from unit.
@ac000 thank you for patch! it allows to build meantime exposed issues on armv7 and armv8 and riscv64
checking for GCC __builtin_expect() ... not found
checking for GCC __builtin_unreachable() ... not found
checking for GCC __builtin_prefetch() ... not found
checking for GCC __builtin_clz() ... not found
checking for GCC __builtin_popcount() ... not found
checking for GCC __attribute__ visibility ... not found
checking for GCC __attribute__ aligned ... not found
checking for GCC __attribute__ malloc ... not found
checking for GCC __attribute__ packed ... not found
checking for GCC __attribute__ unused ... not found
checking for GCC builtin atomic operations ... not found
checking for Solaris builtin atomic operations ... not found
checking for xlC builtin atomic operations ... not found
./configure: error: no atomic operations found.
maybe it's related to clang for this arches but at least "GCC" prefix for atomics is confusing when building with clang
from unit.
Using clang 15.0.7 I'm getting the same error
from unit.
Thanks for testing.
@ac000 thank you for patch! it allows to build meantime exposed issues on armv7 and armv8 and riscv64
checking for GCC __builtin_expect() ... not found checking for GCC __builtin_unreachable() ... not found checking for GCC __builtin_prefetch() ... not found checking for GCC __builtin_clz() ... not found checking for GCC __builtin_popcount() ... not found checking for GCC __attribute__ visibility ... not found checking for GCC __attribute__ aligned ... not found checking for GCC __attribute__ malloc ... not found checking for GCC __attribute__ packed ... not found checking for GCC __attribute__ unused ... not found checking for GCC builtin atomic operations ... not found checking for Solaris builtin atomic operations ... not found checking for xlC builtin atomic operations ... not found ./configure: error: no atomic operations found.
maybe it's related to clang for this arches but at least "GCC" prefix for atomics is confusing when building with clang
Hmm, we just have the three above checks here, one for GCC 4.1+ (heh, I'm just quoting the auto/atomic script), Solaris 10 & AIX xlC. The mind boggles, I suspect these just came straight from nginx...
It's also weird that it failed to find all the builtins and attributes...
I assume GCC builds Unit fine on such systems?
Some more investigation is probably required...
from unit.
Yes, using GCC it builds/works fine, I just attempted to use clang to see effect
from unit.
Thanks for confirming.
No, sure, while GCC is my compiler of choice I see value in also testing with clang, they both find different issues in code.
from unit.
Fix was committed.
from unit.
Related Issues (20)
- Proxy protocol support? HOT 1
- How to use underscores_in_headers in Nginx Unit HOT 1
- single unit alone or not? HOT 5
- no error hang 'Applying configuration' in case of aplication error HOT 1
- Proxy TCP, UDP HOT 3
- Nginx reverse proxy works on localhost but not on IP HOT 3
- Issues with Zend Framework (1.x) app in Unit HOT 4
- OpenAPI service discovery document
- YAML configuration support HOT 6
- Nextcloud Pretty URLs HOT 11
- Cannot install node unit on macos HOT 2
- Cannot add js module names HOT 3
- Error 503 when using URI rewrite with query parameters HOT 13
- Some bogus may be used uninitialized [-Wmaybe-uninitialized] warnings when compiling with -Og HOT 5
- Python 3.11 Package for Ubuntu 22.04 (Jammy) HOT 3
- [Homebrew/Golang] Default paths for Apple Silicon
- Access to environment variables in Unit config HOT 6
- [PHP] Allow additional php.ini files instead of overwriting via options.file HOT 5
- Not possible to run `unitd` with `sudo` on macOS due to fork() safety HOT 10
- GitHub Discussions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unit.