记录一次失败的Nginx via cygwin编译体验

Generate make file:

Linux:

./auto/configure \
    --prefix= \
    --conf-path=conf/nginx.conf \
    --pid-path=logs/nginx.pid \
    --http-log-path=logs/access.log \
    --error-log-path=logs/error.log \
    --with-pcre=lib/pcre-8.44 \
    --with-zlib=lib/zlib-1.2.11 \
    --with-openssl=lib/openssl-OpenSSL_1_1_1i \
    --add-module=./nginx-http-flv-module

cygwin(一次不愉快的体验):

./auto/configure \
    --with-cc=gcc \
    --with-debug \
    --prefix= \
    --conf-path=conf/nginx.conf \
    --pid-path=logs/nginx.pid \
    --http-log-path=logs/access.log \
    --error-log-path=logs/error.log \
    --sbin-path=nginx.exe \
    --http-client-body-temp-path=temp/client_body_temp \
    --http-proxy-temp-path=temp/proxy_temp \
    --http-fastcgi-temp-path=temp/fastcgi_temp \
    --http-scgi-temp-path=temp/scgi_temp \
    --http-uwsgi-temp-path=temp/uwsgi_temp \
    --with-cc-opt=-DFD_SETSIZE=1024 \
    --with-pcre=objs/lib/pcre-8.44 \
    --with-zlib=objs/lib/zlib-1.2.11 \
    --with-openssl=objs/lib/openssl-OpenSSL_1_1_1h \
    --with-openssl-opt=no-asm \
    --with-http_ssl_module

报错:

configure: error: Invalid C++ compiler or C++ compiler flags
make[1]: *** [objs/Makefile:1227: objs/lib/pcre-8.44/Makefile] Error 1

移除HTTP重写模块--without-http_rewrite_module, 删除pcre依赖:

./auto/configure \
    --with-cc=gcc \
    --with-debug \
    --prefix= \
    --conf-path=conf/nginx.conf \
    --pid-path=logs/nginx.pid \
    --http-log-path=logs/access.log \
    --error-log-path=logs/error.log \
    --sbin-path=nginx.exe \
    --http-client-body-temp-path=temp/client_body_temp \
    --http-proxy-temp-path=temp/proxy_temp \
    --http-fastcgi-temp-path=temp/fastcgi_temp \
    --http-scgi-temp-path=temp/scgi_temp \
    --http-uwsgi-temp-path=temp/uwsgi_temp \
    --with-cc-opt=-DFD_SETSIZE=1024 \
    --with-zlib=objs/lib/zlib-1.2.11 \
    --with-openssl=objs/lib/openssl-OpenSSL_1_1_1h \
    --with-openssl-opt=no-asm \
    --with-http_ssl_module \
    --without-http_rewrite_module

报错:

找不到crypt()函数

添加模块

    --add-module=./nginx-http-flv-module
    --add-dynamic-module=./nginx-http-flv-module

See: http://nginx.org/en/docs/howto_build_on_win32.html

posted @ 2021-01-07 17:56  develon  阅读(191)  评论(0编辑  收藏  举报