Cannot compile with nginx 1.13.4 and module version 1.2.6 - error: ‘MD5_DIGEST_LENGTH’ undeclared

Issue #33 new
Julio Morimoto created an issue

Just tried running my build scripts on a newer nginx version and it seems the nginx-sticky-module-ng is no longer compatible.

At some point, the build fails with the following errors:

/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c: In function ngx_http_sticky_misc_md5:
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:152:15: error: MD5_DIGEST_LENGTH undeclared (first use in this function)
   u_char hash[MD5_DIGEST_LENGTH];
               ^
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:152:15: note: each undeclared identifier is reported only once for each function it appears in
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:152:10: error: unused variable hash [-Werror=unused-variable]
   u_char hash[MD5_DIGEST_LENGTH];
          ^
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c: In function ngx_http_sticky_misc_sha1:
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:171:15: error: SHA_DIGEST_LENGTH undeclared (first use in this function)
   u_char hash[SHA_DIGEST_LENGTH];
               ^
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:171:10: error: unused variable hash [-Werror=unused-variable]
   u_char hash[SHA_DIGEST_LENGTH];
          ^
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c: In function ngx_http_sticky_misc_hmac_md5:
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:189:15: error: MD5_DIGEST_LENGTH undeclared (first use in this function)
   u_char hash[MD5_DIGEST_LENGTH];
               ^
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:190:12: error: MD5_CBLOCK undeclared (first use in this function)
   u_char k[MD5_CBLOCK];
            ^
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:190:10: error: unused variable k [-Werror=unused-variable]
   u_char k[MD5_CBLOCK];
          ^
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:189:10: error: unused variable hash [-Werror=unused-variable]
   u_char hash[MD5_DIGEST_LENGTH];
          ^
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c: In function ngx_http_sticky_misc_hmac_sha1:
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:237:15: error: SHA_DIGEST_LENGTH undeclared (first use in this function)
   u_char hash[SHA_DIGEST_LENGTH];
               ^
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:238:12: error: SHA_CBLOCK undeclared (first use in this function)
   u_char k[SHA_CBLOCK];
            ^
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:238:10: error: unused variable k [-Werror=unused-variable]
   u_char k[SHA_CBLOCK];
          ^
/modules/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c:237:10: error: unused variable hash [-Werror=unused-variable]
   u_char hash[SHA_DIGEST_LENGTH];
          ^
cc1: all warnings being treated as errors
objs/Makefile:1219: recipe for target 'objs/addon/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.o' failed
make[1]: Leaving directory '/var/src/nginx-1.13.4'
make[1]: *** [objs/addon/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.o] Error 1
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2
The command '/bin/sh -c make' returned a non-zero code: 2

Here's me hoping we get an update. I really like the module. Great work!

Comments (7)

  1. WojciechM

    Hello,

    It is possible that there is some problem with 1.13.4 but I was able to compile it with nginx-1.12.1 (current stable)

    (Ubuntu xenial)

    cd /usr/local/src

    apt-get install checkinstall

    apt-get install libpcre3-dev build-essential libssl-dev gcc

    wget http://nginx.org/download/nginx-1.12.1.tar.gz git clone https://mcompany@bitbucket.org/nginx-goodies/nginx-sticky-module-ng.git

    tar xvzf nginx-1.12.1.tar.gz

    cd nginx-1.12.1

    ./configure --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_gunzip_module --with-http_gzip_static_module --add-module=../nginx-sticky-module-ng

    checkinstall

    dpkg -i /usr/local/src/nginx-1.12.1/nginx_1.12.1-1_amd64.deb

    /usr/local/nginx/sbin/nginx -v

  2. nsddns

    Hi!

    I had the same issue with MD5_DIGEST_LENGTH undefined... I made this patch, you may give it a try :

    --- nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ngx_http_sticky_misc.c    2015-08-06 12:43:01.000000000 +0200
    +++ nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d.patched/ngx_http_sticky_misc.c    2017-10-06 11:48:16.399988930 +0200
    @@ -9,6 +9,12 @@
     #include <ngx_http.h>
     #include <ngx_md5.h>
     #include <ngx_sha1.h>
    +#ifndef MD5_DIGEST_LENGTH
    +#include <openssl/md5.h>
    +#endif
    +#ifndef SHA_DIGEST_LENGTH
    +#include <openssl/sha.h>
    +#endif
    
     #include "ngx_http_sticky_misc.h"
    
  3. Khanh Duy Pham

    I build success with nginx 1.13.4. You can try cmd below:

    ./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-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie' --add-module=nginx-goodies-nginx-sticky-module

  4. Sean Zachary Owen Marciniak

    Hi @cazjck ,

    I have tried you solution and it does not work with 1.13.4 for me :/

    Was there any other magic needed?

    Thank you,

    Sean

  5. Khanh Duy Pham

    Sorry, i can't remember but i have a short guide when i did do that in the past

    -Download source code Nginx:
        wget http://nginx.org/download/nginx-1.13.6.tar.gz
        tar -xzvf nginx-1.13.6.tar.gz
    
    -Download module sticky:
        git clone https://cazjck@bitbucket.org/nginx-goodies/nginx-sticky-module-ng.git
    -Install package build Nginx:
        sudo apt-get install build-essential zlib1g-dev libpcre3-dev libssl-dev libxslt1-dev libxml2-dev libgd2-xpm-dev libgeoip-dev libgoogle-perftools-dev libperl-dev
    -Build source Nginx with module sticky
        cd nginx-1.13.6
        ./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/local/nginx/modules --conf-path=/usr/local/nginx/nginx.conf --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/usr/local/nginx/cache/client_temp --http-proxy-temp-path=/usr/local/nginx/cache/proxy_temp --http-fastcgi-temp-path=/usr/local/nginx/cache/fastcgi_temp --http-uwsgi-temp-path=/usr/local/nginx/cache/uwsgi_temp --http-scgi-temp-path=/usr/local/nginx/cache/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie' --add-module=../nginx-sticky-module-ng
        make
        sudo make install
    -Grant permission:
        sudo chown -R cazjck:cazjck /usr/local/nginx
        sudo mkdir /usr/local/nginx/cache
    -Test Nginx: sudo nginx -t
    
    -Command Nginx:
        Start nginx:  sudo nginx -s start
        Reload Nginx: sudo nginx -s reload
        Stop Nginx:   sudo nginx -s stop
    
  6. Log in to comment