static-glibc-nginx icon indicating copy to clipboard operation
static-glibc-nginx copied to clipboard

Fix /usr/bin/ld --with-ld-opt="-static" not found

Open crestone opened this issue 9 years ago • 5 comments

Fix error with /usr/bin/ld

checking for OS
+ Linux 3.10.0-327.el7.x86_64 x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 4.8.5 20150623 (Red Hat 4.8.5-4) (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"

make: *** [nginx/nginx] Error 1

crestone avatar Aug 07 '16 01:08 crestone

Can you tell me more about your build environment? What Linux distribution are you using? When I build NGINX on Debian 8.3 with GCC 4.9.2, I don't run into this problem. If you use the version of the build rules I just pushed (6b88b318108fa05204b1d7921ee38854882defa9), do you still get the same error?

ericpruitt avatar Aug 07 '16 03:08 ericpruitt

Environment

# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 
# uname -a
Linux centos7 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
# ld -v
GNU ld version 2.23.52.0.1-55.el7 20130226

CentOS was running on VirtualBox but in this case it's doesn't matter

crestone avatar Aug 07 '16 11:08 crestone

I have an same error with nginx-1.11.3 and openssl-1.0.2h too but I'll try with https://github.com/ericpruitt/static-nginx/commit/6b88b318108fa05204b1d7921ee38854882defa9

crestone avatar Aug 07 '16 11:08 crestone

It's the same errors:

...
mkdir -p nginx
wget -O pcre.tar.gz http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
wget -O nginx.tar.gz http://nginx.org/download/nginx-1.9.15.tar.gz
--2016-08-06 23:09:47--  http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
Resolving ftp.csx.cam.ac.uk (ftp.csx.cam.ac.uk)... --2016-08-06 23:09:47--  http://nginx.org/download/nginx-1.9.15.tar.gz
Resolving nginx.org (nginx.org)... wget -O openssl.tar.gz http://www.openssl.org/source/openssl-1.0.1t.tar.gz
...
touch .openssl-patched
cd src && ./configure --with-cc-opt=-static --with-ld-opt=-static \
    --with-cpu-opt=generic --with-pcre=../pcre --with-mail \
    --with-ipv6 --with-poll_module --with-select_module \
...
checking for OS
 + Linux 3.10.0-327.el7.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.8.5 20150623 (Red Hat 4.8.5-4) (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"

make: *** [nginx/nginx] Error 1

As I said earlier I think a problem with /usr/bin/ld but param -static available

# /usr/bin/ld --help
...
  -assert KEYWORD             Ignored for SunOS compatibility
  -Bdynamic, -dy, -call_shared
                              Link against shared libraries
  -Bstatic, -dn, -non_shared, -static
                              Do not link against shared libraries
  -Bsymbolic                  Bind global references locally
...

crestone avatar Aug 07 '16 12:08 crestone

Can you check a version of /usr/bin/ld are you using? and try build on http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso

crestone avatar Aug 07 '16 12:08 crestone