0

I’m trying to build the latest nginx version with the latest OpenSSL. The build process exits with the following message.

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
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 nginx configure call 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

I know that this is some kind of gcc linker problem and I already tried several -lxxx flags (got them from other StackOverflow threads that were similar to my problem) but nothing helps. I also tried it with older nginx / OpenSSL versions, but no luck. Same goes for leaving the -O3 or -m64 compiler flags.

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 modules are cloned from git master
4

1 回答 1

1

最后我能够编译 nginx,当然我想和你分享这个。似乎配置选项的顺序是问题所在。我使用了以下配置参数顺序,它编译没有任何问题。

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
于 2013-04-29T09:40:18.707 回答