evanmiller / mod_zip

Streaming ZIP archiver for nginx 📦
https://www.nginx.com/resources/wiki/modules/zip/
BSD 3-Clause "New" or "Revised" License
215 stars 64 forks source link

Can't compile under FreeBSD #75

Closed nanaya closed 4 years ago

nanaya commented 5 years ago

nginx version: tip FreeBSD version: 12.0-RELEASE

compile options (from hg repository):

./auto/configure --add-module="${PWD}/../../git/mod_zip"

error:

In file included from /home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_file.c:5:
/home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_endian.h:46:10: error: 'be16toh' macro redefined [-Werror,-Wmacro-redefined]
#       define be16toh betoh16
               ^
/usr/include/sys/endian.h:77:9: note: previous definition is here
#define be16toh(x)      bswap16((x))
        ^
In file included from /home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_file.c:5:
/home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_endian.h:47:10: error: 'le16toh' macro redefined [-Werror,-Wmacro-redefined]
#       define le16toh letoh16
               ^
/usr/include/sys/endian.h:80:9: note: previous definition is here
#define le16toh(x)      ((uint16_t)(x))
        ^
In file included from /home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_file.c:5:
/home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_endian.h:49:10: error: 'be32toh' macro redefined [-Werror,-Wmacro-redefined]
#       define be32toh betoh32
               ^
/usr/include/sys/endian.h:78:9: note: previous definition is here
#define be32toh(x)      bswap32((x))
        ^
In file included from /home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_file.c:5:
/home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_endian.h:50:10: error: 'le32toh' macro redefined [-Werror,-Wmacro-redefined]
#       define le32toh letoh32
               ^
/usr/include/sys/endian.h:81:9: note: previous definition is here
#define le32toh(x)      ((uint32_t)(x))
        ^
In file included from /home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_file.c:5:
/home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_endian.h:52:10: error: 'be64toh' macro redefined [-Werror,-Wmacro-redefined]
#       define be64toh betoh64
               ^
/usr/include/sys/endian.h:79:9: note: previous definition is here
#define be64toh(x)      bswap64((x))
        ^
In file included from /home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_file.c:5:
/home/edho/hg/nginx/../../git/mod_zip/ngx_http_zip_endian.h:53:10: error: 'le64toh' macro redefined [-Werror,-Wmacro-redefined]
#       define le64toh letoh64
               ^
/usr/include/sys/endian.h:82:9: note: previous definition is here
#define le64toh(x)      ((uint64_t)(x))
        ^
6 errors generated.
gmake[1]: *** [objs/Makefile:1225: objs/addon/mod_zip/ngx_http_zip_file.o] Error 1
gmake[1]: Leaving directory '/home/edho/hg/nginx'
gmake: *** [Makefile:8: build] Error 2

Removing the definitions in ngx_http_zip_endian.h seems to fix it...? I'm not even sure for which FreeBSD version was it for as {be,le}{16,32,64}toh functions are available since 5.0 which was released centuries ago.

Note I only tested whether or not it compiles; I haven't tested whether the module actually works or not.

evanmiller commented 4 years ago

Should be fixed in 1.2.0, thanks