Nginx openssl compilation problem

Hello, I’m desparately trying to compile the latest nginx with the
latest
OpenSSL.

In short I’m grabbing the latest nginx tar.gz (1.4.0 but had the same
problem with 1.3.16) and the latest OpenSSL tar.gz (1.0.1e but have the
same
problem with 1.0.1d) extract them and want to compile them. Everything
wents
smooth until the following point:

/usr/lib/gcc/x86_64-linux-gnu/4.7/…/…/…/x86_64-linux-gnu/crt1.o: In
function _start': (.text+0x20): undefined reference tomain’
collect2: error: ld returned 1 exit status
make[4]: *** [link_app.] Error 1
make[4]: Leaving directory /tmp/openssl-1.0.1e/test' make[3]: *** [md2test] Error 2 make[3]: Leaving directory/tmp/openssl-1.0.1e/test’
make[2]: *** [build_tests] Error 1
make[2]: Leaving directory /tmp/openssl-1.0.1e' make[1]: *** [/tmp/openssl-1.0.1e/.openssl/include/openssl/ssl.h] Error 2 make[1]: Leaving directory/tmp/nginx-1.4.0’
make: *** [build] Error 2

My ./configure line looks like the following:

./configure --prefix=/usr/local --sbin-path=/usr/local/sbin
–conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid
–lock-path=/var/lock/nginx.lock
–error-log-path=/var/log/nginx/error.log
–http-log-path=/var/log/nginx/access.log
–http-client-body-temp-path=/dev/shm/nginx/client-body/tmp
–http-fastcgi-temp-path=/dev/shm/nginx/fastcgi/tmp
–with-pcre=/tmp/pcre-8.32 --with-openssl=/tmp/openssl-1.0.1e
–with-zlib=/tmp/zlib --with-cc-opt=’-O3 -m64’ --with-ld-opt=’-m64’
–with-ipv6 --with-http_gzip_static_module --with-http_ssl_module
–with-http_spdy_module --with-md5=/tmp/openssl-1.0.1e --with-md5-asm
–with-sha1=/tmp/openssl-1.0.1e --with-sha1-asm --with-pcre-jit
–without-http_autoindex_module --without-http_auth_basic_module
–without-http_browser_module --without-http_geo_module
–without-http_limit_conn_module --without-http_limit_req_module
–without-http_map_module --without-http_memcached_module
–without-http_proxy_module --without-http_referer_module
–without-http_scgi_module --without-http_split_clients_module
–without-http_ssi_module --without-http_upstream_ip_hash_module
–without-http_userid_module --without-http_uwsgi_module
–without-mail_pop3_module --without-mail_imap_module
–without-mail_smtp_module
–add-module=/tmp/nginx-upload-progress-module
–add-module=/tmp/nginx-upstream-fair

Of course the PCRE, Zlib, nginx-upload-progress-module and
nginx-upstream-fair sources are in place and working just fine. Some
more
info on the environment:

gcc (Debian 4.7.2-5) 4.7.2
cpp (Debian 4.7.2-5) 4.7.2
pcre 8.32
zlib and additional modules from github master

I know that this is some gcc linker problem and I tryed several -lxxx
options or leaving the -O3 / -m64 options, nothing seems to help and I
hope
somebody can point me in the right direction.

Many thanks in advance!
Richard

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,238671,238671#msg-238671

Finally I was able to compile nginx and of course I’d like to share this
with you. Seems like the order of the configure options was the problem.
I
used the following configure argument order and it compiled without any
problems.

nginx version: nginx/1.4.0
built by gcc 4.7.2 (Debian 4.7.2-5)
TLS SNI support enabled
configure arguments: --user=www-data --group=www-data
–prefix=/usr/local
–sbin-path=/usr/local/sbin --conf-path=/etc/nginx/nginx.conf
–pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock
–error-log-path=/var/log/nginx/error.log
–http-log-path=/var/log/nginx/access.log
–http-client-body-temp-path=/dev/shm/nginx/client-body/tmp
–http-fastcgi-temp-path=/dev/shm/nginx/fastcgi/tmp --with-ipv6
–with-http_gzip_static_module --with-http_ssl_module
–with-http_spdy_module
–with-openssl=/usr/local/src/nginx/openssl-1.0.1e
–with-md5=/usr/local/src/nginx/openssl-1.0.1e --with-md5-asm
–with-sha1=/usr/local/src/nginx/openssl-1.0.1e --with-sha1-asm
–with-pcre=/usr/local/src/nginx/pcre-8.32 --with-pcre-jit
–with-zlib=/usr/local/src/nginx/zlib --without-http_autoindex_module
–without-http_auth_basic_module --without-http_browser_module
–without-http_geo_module --without-http_limit_conn_module
–without-http_limit_req_module --without-http_map_module
–without-http_memcached_module --without-http_proxy_module
–without-http_referer_module --without-http_scgi_module
–without-http_split_clients_module --without-http_ssi_module
–without-http_upstream_ip_hash_module --without-http_userid_module
–without-http_uwsgi_module --without-mail_pop3_module
–without-mail_imap_module --without-mail_smtp_module
–add-module=/usr/local/src/nginx/nginx-upload-progress-module
–add-module=/usr/local/src/nginx/nginx-upstream-fair

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,238671,238705#msg-238705