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