Building nginx deb package with custom openssl

I'm trying to build nginx packages from a deb package source (from the popular, semi-official nginx mainline PPA) but linked to an openssl fork that contains ChaCha20 and Poly1305 additions.

I configured openssl with ./config no-ssl2 no-ssl3 shared -fPIC (I also set CFLAGS="-fPIC"), which worked and built successfully, and I can see -fPIC appearing in all the compilation steps during the build. When I build the nginx package with dpkg-buildpackage -b pointing at it (I edited auto/options and set OPENSSL=/home/admin/openssl), I get this error:

objs/ngx_modules.o \ -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -ldl -lpthread -lpthread -lcrypt -lpam -lexpat -lpcre /root/openssl/.openssl/lib/libssl.a  /home/admin/openssl/.openssl/lib/libcrypto.a -ldl -lz -lxml2 -lxslt -lexslt -lgd -lGeoIP \ -Wl,-E /usr/bin/ld: /home/admin/openssl/.openssl/lib/libssl.a(s23_meth.o):  relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC /home/admin/openssl/.openssl/lib/libssl.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status 

Any idea what I'm doing wrong, since I did build it with -fPIC?


I managed to make this work. It turns out that when building nginx this way, it does not use the pre-built openssl libraries, but compiles them anew, and at this point it's missing the configure options that I'd provided in the separate build. I spotted an OPENSSL_OPT property in the auto/options file. So the options I set in there were:

OPENSSL_OPT="no-ssl2 no-ssl3 -fPIC"

With those set, the compile completed successfully, and I was able to install the resulting packages.

Category: compiling Time: 2016-07-29 Views: 1

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.193 (s). 12 q(s)