G
G
govunuvo2020-07-28 12:00:04
Nginx
govunuvo, 2020-07-28 12:00:04

nginx static build?

Build a static nginx binary:

./configure --prefix=nginx-static --with-cc-opt="-static -static-libgcc" \
            --with-ld-opt="-static" --with-cpu-opt=generic \
            --with-mail --with-ipv6 --with-poll_module --with-select_module \
            --with-select_module --with-poll_module \
            --with-http_ssl_module --with-http_realip_module \
            --with-http_addition_module --with-http_sub_module --with-http_dav_module \
            --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module \
            --with-http_gzip_static_module --with-http_auth_request_module \
            --with-http_random_index_module --with-http_secure_link_module \
            --with-http_degradation_module --with-http_stub_status_module \
            --with-mail --with-mail_ssl_module --with-openssl=./openssl-${OPENSSL_VERSION} \
            --with-pcre=./pcre-${PCRE_VERSION}


and when building on Centos 6.10 I get an error:
checking for OS
 + Linux 2.6.32-754.30.2.el6.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) 
checking for gcc -pipe switch ... found
checking for --with-ld-opt="-static" ... not found
./configure: error: the invalid value in --with-ld-opt="-static"


Mistake:
cat autoconf.err 


----------------------------------------
checking for C compiler


----------------------------------------
checking for gcc -pipe switch


----------------------------------------
checking for --with-ld-opt="-static"

/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
----------

#include <sys/types.h>



int main(void) {
    ;
    return 0;
}

----------
cc -static -static-libgcc -o objs/autotest objs/autotest.c -static
----------


The problem is in the assembly only in Centos 6, for example, in Archlinux everything was assembled without problems.
I'm probably dumb, but what's wrong here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Official account of the Timeweb team, 2020-08-19
@timeweb_team

Apparently, installing the
yum install glibc-static package should solve the problem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question