U
U
Unfex2017-07-05 06:17:15
Nginx
Unfex, 2017-07-05 06:17:15

Compiling Nginx + zlib?

Hello.
I'm compiling for the first time, I don't understand anything.
I need Nginx with Zlib to compress traffic. It did not work in the finished package, probably the module was not installed.
Configuration:

./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_gunzip_module \
--with-http_gzip_static_module \
--with-zlib=/home/Downloads/zlib-1.2.11 \
--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 \
--without-http_userid_module \
--without-http_ssi_module \
--without-http_split_clients_module \
--without-http_geo_module \
--without-http_empty_gif_module \
--without-http_scgi_module \
--without-http_fastcgi_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-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' \
--with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

As written on the Nginx website
--with-zlib=path - sets the path to the sources of the zlib library. The library distribution kit (version 1.1.3 - 1.2.11) must be taken from the zlib website and unpacked. ./configure nginx and make will do the rest. The library is needed for the ngx_http_gzip_module module.

I did everything exactly the same, but with the make && make install command, it says:
/usr/bin/ld: /home/Downloads/zlib-1.2.11/libz.a(crc32.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/home/Downloads/zlib-1.2.11/libz.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
objs/Makefile:307: recipe for target 'objs/nginx' failed
make[1]: *** [objs/nginx] Error 1
make[1]: Leaving directory '/home/Downloads/nginx-1.13.2'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2

Please help, I don't understand what to do.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
Unfex, 2017-07-07
@Unfex

Problem solved by removing

--with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' \
--with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'
from ./configure

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question