Since the nginx package comes without http_v3_module on alpine I tried to compile it. There are some articles on the internet about this.
I did this inside of an alpine 3.20 docker container.
So first I downloaded and compiled boringssl. This step worked without problems.
Next I got ngx_brotli, ngx_headers_more and nginx.
My build script looks like this:
#!/bin/sh
BORINGSSL_DIR='/usr/local/src/boringssl'
NGINX_VERSION='1.27.1'
cd /usr/local/src/nginx-$NGINX_VERSION
./configure \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--modules-path=/usr/lib/nginx/modules \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-http_xslt_module=dynamic \
--with-http_image_filter_module=dynamic \
--with-http_geoip_module=dynamic \
--with-http_perl_module=dynamic \
--with-threads \
--with-stream \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-stream_realip_module \
--with-stream_geoip_module=dynamic \
--with-http_slice_module \
--with-mail \
--with-mail_ssl_module \
--with-compat \
--with-file-aio \
--with-http_v2_module \
--with-http_v3_module \
--add-dynamic-module=/usr/local/src/ngx_headers_more \
--add-dynamic-module=/usr/local/src/ngx_brotli \
--add-dynamic-module=/usr/local/src/njs/nginx \
--with-openssl="${BORINGSSL_DIR}" \
--with-ld-opt="-L${BORINGSSL_DIR}/build/ssl -L${BORINGSSL_DIR}/build/crypto" \
--with-cc-opt="-I${BORINGSSL_DIR}/include"
touch ${BORINGSSL_DIR}/.openssl/include/openssl/ssl.h
make -j$(getconf _NPROCESSORS_ONLN)
All this results in a bunch of error messages regarding conflicting ssl declarations.
So far I could not figure out what I am doing wrong.
Here the output of the build from the point were the error messages start to appear:
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I/usr/local/src/boringssl/include -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I src/http/modules/perl -I /usr/local/src/ngx_brotli/deps/brotli/c/include -I /usr/local/src/njs/nginx/../src -I /usr/local/src/njs/nginx/../build -I /usr/local/src/njs/nginx/../src -I /usr/local/src/njs/nginx/../build -I /usr/local/src/boringssl/.openssl/include -I /usr/include/libxml2 -I objs \
-o objs/src/event/quic/ngx_event_quic_transport.o \
src/event/quic/ngx_event_quic_transport.c
In file included from src/event/quic/ngx_event_quic_connection.h:29,
from src/event/quic/ngx_event_quic.c:10:
src/event/quic/ngx_event_quic_openssl_compat.h:23:6: error: redeclaration of 'enum ssl_encryption_level_t'
23 | enum ssl_encryption_level_t {
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/event/ngx_event_openssl.h:17,
from src/core/ngx_core.h:85,
from src/event/quic/ngx_event_quic.c:8:
/usr/local/src/boringssl/include/openssl/ssl.h:3425:6: note: originally defined here
3425 | enum ssl_encryption_level_t BORINGSSL_ENUM_INT {
| ^~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:24:5: error: redeclaration of enumerator 'ssl_encryption_initial'
24 | ssl_encryption_initial = 0,
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3426:3: note: previous definition of 'ssl_encryption_initial' with type 'enum ssl_encryption_level_t'
3426 | ssl_encryption_initial = 0,
| ^~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:25:5: error: redeclaration of enumerator 'ssl_encryption_early_data'
25 | ssl_encryption_early_data,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3427:3: note: previous definition of 'ssl_encryption_early_data' with type 'enum ssl_encryption_level_t'
3427 | ssl_encryption_early_data,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:26:5: error: redeclaration of enumerator 'ssl_encryption_handshake'
26 | ssl_encryption_handshake,
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3428:3: note: previous definition of 'ssl_encryption_handshake' with type 'enum ssl_encryption_level_t'
3428 | ssl_encryption_handshake,
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:27:5: error: redeclaration of enumerator 'ssl_encryption_application'
27 | ssl_encryption_application
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3429:3: note: previous definition of 'ssl_encryption_application' with type 'enum ssl_encryption_level_t'
3429 | ssl_encryption_application,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:31:16: error: redefinition of 'struct ssl_quic_method_st'
31 | typedef struct ssl_quic_method_st {
| ^~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3433:8: note: originally defined here
3433 | struct ssl_quic_method_st {
| ^~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:43:3: error: conflicting types for 'SSL_QUIC_METHOD'; have 'struct ssl_quic_method_st'
43 | } SSL_QUIC_METHOD;
| ^~~~~~~~~~~~~~~
In file included from /usr/local/src/boringssl/include/openssl/ssl.h:145:
/usr/local/src/boringssl/include/openssl/base.h:366:35: note: previous declaration of 'SSL_QUIC_METHOD' with type 'SSL_QUIC_METHOD' {aka 'struct ssl_quic_method_st'}
366 | typedef struct ssl_quic_method_st SSL_QUIC_METHOD;
| ^~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:48:5: error: conflicting types for 'SSL_set_quic_method'; have 'int(SSL *, const SSL_QUIC_METHOD *)' {aka 'int(struct ssl_st *, const struct ssl_quic_method_st *)'}
48 | int SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method);
| ^~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3547:20: note: previous declaration of 'SSL_set_quic_method' with type 'int(SSL *, const SSL_QUIC_METHOD *)' {aka 'int(struct ssl_st *, const struct ssl_quic_method_st *)'}
3547 | OPENSSL_EXPORT int SSL_set_quic_method(SSL *ssl,
| ^~~~~~~~~~~~~~~~~~~
make[1]: *** [objs/Makefile:1154: objs/src/event/quic/ngx_event_quic.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from src/event/quic/ngx_event_quic_connection.h:29,
from src/event/quic/ngx_event_quic_udp.c:11:
src/event/quic/ngx_event_quic_openssl_compat.h:23:6: error: redeclaration of 'enum ssl_encryption_level_t'
23 | enum ssl_encryption_level_t {
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/event/ngx_event_openssl.h:17,
from src/core/ngx_core.h:85,
from src/event/quic/ngx_event_quic_udp.c:9:
/usr/local/src/boringssl/include/openssl/ssl.h:3425:6: note: originally defined here
3425 | enum ssl_encryption_level_t BORINGSSL_ENUM_INT {
| ^~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:24:5: error: redeclaration of enumerator 'ssl_encryption_initial'
24 | ssl_encryption_initial = 0,
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3426:3: note: previous definition of 'ssl_encryption_initial' with type 'enum ssl_encryption_level_t'
3426 | ssl_encryption_initial = 0,
| ^~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:25:5: error: redeclaration of enumerator 'ssl_encryption_early_data'
25 | ssl_encryption_early_data,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3427:3: note: previous definition of 'ssl_encryption_early_data' with type 'enum ssl_encryption_level_t'
3427 | ssl_encryption_early_data,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:26:5: error: redeclaration of enumerator 'ssl_encryption_handshake'
26 | ssl_encryption_handshake,
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3428:3: note: previous definition of 'ssl_encryption_handshake' with type 'enum ssl_encryption_level_t'
3428 | ssl_encryption_handshake,
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:27:5: error: redeclaration of enumerator 'ssl_encryption_application'
27 | ssl_encryption_application
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3429:3: note: previous definition of 'ssl_encryption_application' with type 'enum ssl_encryption_level_t'
3429 | ssl_encryption_application,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:31:16: error: redefinition of 'struct ssl_quic_method_st'
31 | typedef struct ssl_quic_method_st {
| ^~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3433:8: note: originally defined here
3433 | struct ssl_quic_method_st {
| ^~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:43:3: error: conflicting types for 'SSL_QUIC_METHOD'; have 'struct ssl_quic_method_st'
43 | } SSL_QUIC_METHOD;
| ^~~~~~~~~~~~~~~
In file included from /usr/local/src/boringssl/include/openssl/ssl.h:145:
/usr/local/src/boringssl/include/openssl/base.h:366:35: note: previous declaration of 'SSL_QUIC_METHOD' with type 'SSL_QUIC_METHOD' {aka 'struct ssl_quic_method_st'}
366 | typedef struct ssl_quic_method_st SSL_QUIC_METHOD;
| ^~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:48:5: error: conflicting types for 'SSL_set_quic_method'; have 'int(SSL *, const SSL_QUIC_METHOD *)' {aka 'int(struct ssl_st *, const struct ssl_quic_method_st *)'}
48 | int SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method);
| ^~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3547:20: note: previous declaration of 'SSL_set_quic_method' with type 'int(SSL *, const SSL_QUIC_METHOD *)' {aka 'int(struct ssl_st *, const struct ssl_quic_method_st *)'}
3547 | OPENSSL_EXPORT int SSL_set_quic_method(SSL *ssl,
| ^~~~~~~~~~~~~~~~~~~
make[1]: *** [objs/Makefile:1161: objs/src/event/quic/ngx_event_quic_udp.o] Error 1
In file included from src/event/quic/ngx_event_quic_connection.h:29,
from src/event/quic/ngx_event_quic_transport.c:10:
src/event/quic/ngx_event_quic_openssl_compat.h:23:6: error: redeclaration of 'enum ssl_encryption_level_t'
23 | enum ssl_encryption_level_t {
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/event/ngx_event_openssl.h:17,
from src/core/ngx_core.h:85,
from src/event/quic/ngx_event_quic_transport.c:8:
/usr/local/src/boringssl/include/openssl/ssl.h:3425:6: note: originally defined here
3425 | enum ssl_encryption_level_t BORINGSSL_ENUM_INT {
| ^~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:24:5: error: redeclaration of enumerator 'ssl_encryption_initial'
24 | ssl_encryption_initial = 0,
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3426:3: note: previous definition of 'ssl_encryption_initial' with type 'enum ssl_encryption_level_t'
3426 | ssl_encryption_initial = 0,
| ^~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:25:5: error: redeclaration of enumerator 'ssl_encryption_early_data'
25 | ssl_encryption_early_data,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3427:3: note: previous definition of 'ssl_encryption_early_data' with type 'enum ssl_encryption_level_t'
3427 | ssl_encryption_early_data,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:26:5: error: redeclaration of enumerator 'ssl_encryption_handshake'
26 | ssl_encryption_handshake,
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3428:3: note: previous definition of 'ssl_encryption_handshake' with type 'enum ssl_encryption_level_t'
3428 | ssl_encryption_handshake,
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:27:5: error: redeclaration of enumerator 'ssl_encryption_application'
27 | ssl_encryption_application
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3429:3: note: previous definition of 'ssl_encryption_application' with type 'enum ssl_encryption_level_t'
3429 | ssl_encryption_application,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:31:16: error: redefinition of 'struct ssl_quic_method_st'
31 | typedef struct ssl_quic_method_st {
| ^~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3433:8: note: originally defined here
3433 | struct ssl_quic_method_st {
| ^~~~~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:43:3: error: conflicting types for 'SSL_QUIC_METHOD'; have 'struct ssl_quic_method_st'
43 | } SSL_QUIC_METHOD;
| ^~~~~~~~~~~~~~~
In file included from /usr/local/src/boringssl/include/openssl/ssl.h:145:
/usr/local/src/boringssl/include/openssl/base.h:366:35: note: previous declaration of 'SSL_QUIC_METHOD' with type 'SSL_QUIC_METHOD' {aka 'struct ssl_quic_method_st'}
366 | typedef struct ssl_quic_method_st SSL_QUIC_METHOD;
| ^~~~~~~~~~~~~~~
src/event/quic/ngx_event_quic_openssl_compat.h:48:5: error: conflicting types for 'SSL_set_quic_method'; have 'int(SSL *, const SSL_QUIC_METHOD *)' {aka 'int(struct ssl_st *, const struct ssl_quic_method_st *)'}
48 | int SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method);
| ^~~~~~~~~~~~~~~~~~~
/usr/local/src/boringssl/include/openssl/ssl.h:3547:20: note: previous declaration of 'SSL_set_quic_method' with type 'int(SSL *, const SSL_QUIC_METHOD *)' {aka 'int(struct ssl_st *, const struct ssl_quic_method_st *)'}
3547 | OPENSSL_EXPORT int SSL_set_quic_method(SSL *ssl,
| ^~~~~~~~~~~~~~~~~~~
make[1]: *** [objs/Makefile:1168: objs/src/event/quic/ngx_event_quic_transport.o] Error 1
make[1]: Leaving directory '/usr/local/src/nginx-1.27.1'
make: *** [Makefile:10: build] Error 2