uNetworking / uNetworking/uWebSockets

Compiler fail when I set WITH_BORINGSSL=1 and WITH_IO_URING=1 make

Open
#1,848 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
19k
Forks
1.9k
Avg merge
3h 24m
Merged PRs (30d)
5

Description

I have installed the libraries:

apt-get install libasio-dev libfmt-dev libuv1-dev zlib1g-dev libssl-dev liburing-dev

I have downloaded the last version with:

git clone --recursive https://github.com/uNetworking/uWebSockets

I have build uSockets/boringssl with CMAKE

mkdir build
cd build
cmake ..
make

cd /uWebSockets

So, if I set only "WITH_BORINGSSL=1 make", it compiles without problems.

If I set only "WITH_IO_URING=1 make", it also compiles without problems.

But if I set them together like "WITH_BORINGSSL=1 WITH_IO_URING=1 make", I get the following compilation errors:

cc -flto -Iboringssl/include -pthread -DLIBUS_USE_OPENSSL -DLIBUS_USE_IO_URING -std=c11 -Isrc -O3 -c src/.c src/eventing/.c src/crypto/.c src/io_uring/.c
src/crypto/openssl.c:61:32: error: field ‘sc’ has incomplete type
61 | struct us_socket_context_t sc;
| ^~
src/crypto/openssl.c:84:24: error: field ‘s’ has incomplete type
84 | struct us_socket_t s;
| ^
src/crypto/openssl.c: In function ‘ssl_on_open’:
src/crypto/openssl.c:155:72: error: invalid use of undefined type ‘struct us_loop_t’
155 | struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) loop->data.ssl_data;
| ^~
src/crypto/openssl.c: In function ‘ssl_on_data’:
src/crypto/openssl.c:202:72: error: invalid use of undefined type ‘struct us_loop_t’
202 | struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) loop->data.ssl_data;
| ^~
src/crypto/openssl.c: In function ‘us_internal_init_loop_ssl_data’:
src/crypto/openssl.c:355:14: error: invalid use of undefined type ‘struct us_loop_t’
355 | if (!loop->data.ssl_data) {
| ^~
src/crypto/openssl.c:373:13: error: invalid use of undefined type ‘struct us_loop_t’
373 | loop->data.ssl_data = loop_ssl_data;
| ^~
src/crypto/openssl.c: In function ‘us_internal_free_loop_ssl_data’:
src/crypto/openssl.c:379:72: error: invalid use of undefined type ‘struct us_loop_t’
379 | struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) loop->data.ssl_data;
| ^~
src/crypto/openssl.c: In function ‘us_internal_create_child_ssl_socket_context’:
src/crypto/openssl.c:410:209: error: invalid application of ‘sizeof’ to incomplete type ‘struct us_socket_context_t’
410 | struct us_internal_ssl_socket_context_t *child_context = (struct us_internal_ssl_socket_context_t *) us_create_socket_context(0, context->sc.loop, sizeof(struct us_internal_ssl_socket_context_t) - sizeof(struct us_socket_context_t) + context_ext_size, options);
| ^~~~~~
src/crypto/openssl.c: In function ‘us_internal_create_ssl_socket_context’:
src/crypto/openssl.c:648:191: error: invalid application of ‘sizeof’ to incomplete type ‘struct us_socket_context_t’
648 | struct us_internal_ssl_socket_context_t *context = (struct us_internal_ssl_socket_context_t *) us_create_socket_context(0, loop, sizeof(struct us_internal_ssl_socket_context_t) - sizeof(struct us_socket_context_t) + context_ext_size, options);
| ^~~~~~
src/crypto/openssl.c: In function ‘us_internal_ssl_socket_context_listen’:
src/crypto/openssl.c:690:124: error: invalid application of ‘sizeof’ to incomplete type ‘struct us_socket_t’
690 | return us_socket_context_listen(0, &context->sc, host, port, options, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size);
| ^~~~~~
src/crypto/openssl.c: In function ‘us_internal_ssl_socket_context_listen_unix’:
src/crypto/openssl.c:694:123: error: invalid application of ‘sizeof’ to incomplete type ‘struct us_socket_t’
694 | return us_socket_context_listen_unix(0, &context->sc, path, options, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size);
| ^~~~~~
src/crypto/openssl.c: In function ‘us_internal_ssl_adopt_accepted_socket’:
src/crypto/openssl.c:699:152: error: invalid application of ‘sizeof’ to incomplete type ‘struct us_socket_t’
699 | return (struct us_internal_ssl_socket_t *) us_adopt_accepted_socket(0, &context->sc, accepted_fd, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size, addr_ip, addr_ip_length);
| ^~~~~~
src/crypto/openssl.c: In function ‘us_internal_ssl_socket_context_connect’:
src/crypto/openssl.c:703:174: error: invalid application of ‘sizeof’ to incomplete type ‘struct us_socket_t’
703 | return (struct us_internal_ssl_socket_t *) us_socket_context_connect(0, &context->sc, host, port, source_host, options, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size);
| ^~~~~~
src/crypto/openssl.c: In function ‘us_internal_ssl_socket_context_connect_unix’:
src/crypto/openssl.c:707:167: error: invalid application of ‘sizeof’ to incomplete type ‘struct us_socket_t’
707 | return (struct us_internal_ssl_socket_t *) us_socket_context_connect_unix(0, &context->sc, server_path, options, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + socket_ext_size);
| ^~~~~~
src/crypto/openssl.c: In function ‘us_internal_ssl_socket_write’:
src/crypto/openssl.c:764:72: error: invalid use of undefined type ‘struct us_loop_t’
764 | struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) loop->data.ssl_data;
| ^~
src/crypto/openssl.c: In function ‘us_internal_ssl_socket_shutdown’:
src/crypto/openssl.c:817:76: error: invalid use of undefined type ‘struct us_loop_t’
817 | struct loop_ssl_data *loop_ssl_data = (struct loop_ssl_data *) loop->data.ssl_data;
| ^~
src/crypto/openssl.c: In function ‘us_internal_ssl_socket_context_adopt_socket’:
src/crypto/openssl.c:855:152: error: invalid application of ‘sizeof’ to incomplete type ‘struct us_socket_t’
855 | return (struct us_internal_ssl_socket_t *) us_socket_context_adopt_socket(0, &context->sc, &s->s, sizeof(struct us_internal_ssl_socket_t) - sizeof(struct us_socket_t) + ext_size);
| ^~~~~~
src/io_uring/io_loop.c: In function ‘us_create_loop’:
src/io_uring/io_loop.c:343:20: warning: passing argument 1 of ‘posix_memalign’ from incompatible pointer type [-Wincompatible-pointer-types]
343 | posix_memalign(&reg.ring_addr, 1024 * 4, sizeof(struct io_uring_buf) * 4096);
| ^~~~~~~~~~~~~~
| |
| __u64 * {aka long long unsigned int *}
In file included from src/io_uring/internal.h:5,
from src/io_uring/io_loop.c:23:
/usr/include/stdlib.h:599:35: note: expected ‘void **’ but argument is of type ‘__u64 *’ {aka ‘long long unsigned int *’}
599 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
| ~~~~~~~^~~~~~~~
src/io_uring/io_loop.c:346:20: warning: assignment to ‘struct io_uring_buf_ring *’ from ‘__u64’ {aka ‘long long unsigned int’} makes pointer from integer without a cast [-Wint-conversion]
346 | loop->buf_ring = reg.ring_addr;

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the combined build with WITH_BORINGSSL=1 WITH_IO_URING=1, then compare it with the two successful single-option builds. Inspect src/crypto/openssl.c and src/io_uring/io_loop.c, focusing on the incomplete-type errors and pointer warnings. Done means the combined command compiles without those errors and warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
build-system, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.