使用静态链接编译wget

时间:2017-06-23 08:26:25

标签: openssl centos static-libraries wget ld

我试图静态构建wget

./bootstrap
env CPPFLAGS="-I/usr/include" LDFLAGS="-L/usr/lib/ssl" ./configure --with-ssl=openssl
make CPPFLAGS="-I/usr/include" LDFLAGS="-L/usr/lib -L/usr/lib/ssl -static"
cd src/
gcc -O2 -Wall -L/usr/lib -L/usr/lib/ssl -lz -static -o wget connect.o convert.o cookies.o ftp.o css-url.o ftp-basic.o ftp-ls.o hash.o host.o html-parse.o html-url.o http.o init.o log.o main.o netrc.o progress.o ptimer.o recur.o res.o retr.o spider.o url.o utils.o exits.o build_info.o  version.o ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a  -lssl -lcrypto -ldl -lrt -lz

ld抱怨,

/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
/usr/bin/ld: cannot find -ldl
/usr/bin/ld: cannot find -lrt
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status

如何将ld指向它正在寻找的文件?

编辑:

gcc -O2 -Wall -L/usr/lib -L/usr/lib/ssl -o wget connect.o convert.o cookies.o ftp.o css-url.o ftp-basic.o ftp-ls.o hash.o host.o html-parse.o html-url.o http.o init.o log.o main.o netrc.o progress.o ptimer.o recur.o res.o retr.o spider.o url.o utils.o exits.o build_info.o version.o ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a -Bstatic -lssl -lcrypto -Bdynamic -ldl -lrt -lz

/usr/bin/ld: utils.o: undefined reference to symbol 'pcre_compile'
/usr/lib64/libpcre.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)

0 个答案:

没有答案
相关问题