Welcome! Log In Create A New Profile

Advanced

NGX_MODULE_SIGNATURE : Nginx module not binary compatible Alpine 3.20 nginx 1.26.2

Posted by laurodd 
NGX_MODULE_SIGNATURE : Nginx module not binary compatible Alpine 3.20 nginx 1.26.2
October 22, 2024 06:40AM
Hello all

I am facing a problem that I don't understand the origin of it, but I was able to solve the issue.
Maybe any of you have an idea how to look for the root of the difference?
Any reasons why the same configure flags can result in a different NGX_MODULE_SIGNATURE?
I did the same thing on a Debian 12 + nginx 1.26.2 and I don't have the problem, so something related to the OS?


Step by step of the problem and resolution:


- When migrating a docker image from alpine 3.19 + nginx 1.24.0 to alpine 3.20 + nginx 1.26.2, we started receiving "is not binary compatible" after a startup of nginx with our module


- This is normally related with different configure options between the nginx binary and the dynamic lib


- We double checked the flags and they are actually the same between nginx 1.24 for alpine 3.19 and nginx 1.26.3 for alpine 20
-- nginx_flags="$(nginx -V 2>&1 | grep -oP 'configure arguments: \K(.*)' | sed -e 's/--add-dynamic-module=\S*//g')"


- We checked the gcc version, everything ok as well


- So, checking the source code we found the NGX_MODULE_SIGNATURE def and it seems to be the root of the message


- To find the difference, we did:
-- strings /usr/sbin/nginx| grep -F '8,4,8'
-- strings /etc/nginx/modules/foo_module.so | grep -F '8,4,8'

8,4,8,0010111111010111001111111111111110
8,4,8,0010111111010111001111111111101110


- The 30th value was different, meaning that NGX_MODULE_SIGNATURE_30 was not set:
-- #if (NGX_HTTP_HEADERS)
-- #define NGX_MODULE_SIGNATURE_30 "1"


- Solution: add the following line to the config of the module, the compilation worked and Nginx started as expected.
-- have=NGX_HTTP_HEADERS . auto/have
It seems like the auto/modules changed between versions:

1.26.2: we only have this on the NGX_COMPAT condition

if [ $NGX_COMPAT = YES ]; then
have=NGX_COMPAT . auto/have
have=NGX_HTTP_GZIP . auto/have
have=NGX_HTTP_DAV . auto/have
have=NGX_HTTP_REALIP . auto/have
have=NGX_HTTP_X_FORWARDED_FOR . auto/have
have=NGX_HTTP_HEADERS . auto/have
have=NGX_HTTP_UPSTREAM_ZONE . auto/have
have=NGX_STREAM_UPSTREAM_ZONE . auto/have
fi



1.24.0 : we have it on the HTTP_V2 and NGX_COMPAT condition

if [ $HTTP_V2 = YES ]; then
have=NGX_HTTP_V2 . auto/have
have=NGX_HTTP_HEADERS . auto/have

ngx_module_name=ngx_http_v2_module
ngx_module_incs=src/http/v2
ngx_module_deps="src/http/v2/ngx_http_v2.h \
src/http/v2/ngx_http_v2_module.h"
ngx_module_srcs="src/http/v2/ngx_http_v2.c \
src/http/v2/ngx_http_v2_table.c \
src/http/v2/ngx_http_v2_encode.c \
src/http/v2/ngx_http_v2_module.c"
ngx_module_libs=
ngx_module_link=$HTTP_V2

. auto/module
fi


if [ $NGX_COMPAT = YES ]; then
have=NGX_COMPAT . auto/have
have=NGX_HTTP_GZIP . auto/have
have=NGX_HTTP_DAV . auto/have
have=NGX_HTTP_REALIP . auto/have
have=NGX_HTTP_X_FORWARDED_FOR . auto/have
have=NGX_HTTP_HEADERS . auto/have
have=NGX_HTTP_UPSTREAM_ZONE . auto/have
have=NGX_STREAM_UPSTREAM_ZONE . auto/have
fi
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 145
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready