Compile NGINX as Position Independent Executable (Compile Error)

vincent.schwarzer at vincent.schwarzer at
Sat Oct 24 14:25:22 UTC 2015

Hey NGINX Devs,
I want to compile and run NGINX on OSv from Cloudius cloudius-systems/osv.For that I have to compile NGINX as Position Independent Code (-fPIC / -fPIE).

The issue I currently have is that when I run 'make build' after executing the ./configure script in the source folder I get following error:

cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -fPIE -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs  -o objs/src/os/unix/ngx_process_ cycle.o \ src/os/unix/ngx_process_cycle. o src/os/unix/ngx_process_cycle. c: In function ‘ngx_master_process_cycle’:

src/os/unix/ngx_process_cycle. c:124:5: error: implicit declaration of function ‘setproctitle’ [-Werror=implicit-function- declaration]
cc1: all warnings being treated as errors
make[1]: *** [objs/src/os/unix/ngx_process_ cycle.o] Error 1
make[1]: Leaving directory `/tmp/thesis_vs/osv_proj/ nginx/upstream/nginx-1.8.0'
make: *** [build] Error 2

My current workflow to compile NGNIX with fPIE is as follows:
   - Load Sources (1.8 Stable Release)
   - Patch source files from buildroot/tree/package/nginx to pass some of the configure checks and adjust as needed for OSv Operating System.
   - Export flags for configure script as required for OSv   

export ngx_force_gcc_have_atomic=yes \

export ngx_force_c99_have_variadic_ macros=yes \

export ngx_force_gcc_have_variadic_ macros=yes \

export ngx_force_have_epoll=yes \

export ngx_force_have_sendfile=yes \

export ngx_force_have_sendfile64=yes \ ?!??!

export ngx_force_have_pr_set_ dumpable=yes \ ?!?!

export ngx_force_sys_nerr=100 \

export ngx_force_have_map_anon=yes \

export ngx_force_have_posix_sem=yes\

export ngx_force_have_sysvshm=yes\

export ngx_force_have_map_devzero=no

4. ./configure --with-cc-opt="-fPIE" \

--with-ld-opt="-shared" \
--prefix=/none \
--conf-path=/data/conf/nginx. conf \
--sbin-path=/none \
--pid-path=/tmp/ \
--lock-path=/tmp/nginx.lock \
--error-log-path=/tmp/error. log \
--http-log-path=/tmp/access. log \
--http-client-body-temp-path=/ tmp/client-body \
--http-proxy-temp-path=/tmp/ proxy \
--http-fastcgi-temp-path=/tmp/ fastcgi \
--http-scgi-temp-path=/tmp/ scgi \
--http-uwsgi-temp-path=/tmp/ uwsgi \
--without-http_rewrite_module \
--with-http_ssl_module \
--with-ipv6 \

5. make build

Im using Ubuntu 14.04 and gcc-4.8 to compile NGINX
I have no idea if / what I'm doing wrong here. Any help is highly appreciated. :) 
Kind regards,
P.S.: Sorry for sending it on both lists but I wasn't sure which is the right one for this kind of question.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list