2013-04-26 24 views
0

我正在嘗試使用最新的OpenSSL構建最新的nginx版本。生成過程退出並顯示以下消息。構建nginx和OpenSSL時出錯

/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 

我的配置Nginx調用看起來如下:

./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 

我知道,這是某種gcc連接的問題,我已經嘗試了幾種-lxxx標誌(從其他StackOverflow的線程都得到了他們類似於我的問題),但沒有任何幫助。我也嘗試過使用較老的nginx/OpenSSL版本,但沒有運氣。留下-O3-m64編譯器標誌也是如此。

對環境有一些更多的信息:

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 

回答

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