Openssl 使用静态链接编译wget
我试图静态地构建Openssl 使用静态链接编译wget,openssl,centos,static-libraries,wget,ld,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 w
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 optimer.o recur.o res.o retr.o spider.o url.o utils.o exits.o build.o version.o ftp.o opie.o openssl.o http.o ftp.o opie.o openssl.o http/lib.o gnu-Bstatic-lssl-lcrypto-B动态-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)
用作指导。这是一种不寻常的错误。也许
gcc-v
将有助于显示gcc使用的include和library目录。其他一些库必须动态链接,如dl
和rt
。因此,可能类似于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 optimer.o recur.o res.o retr.o spider.o url.o utils.o exits.o build\u info.o version.o ftp.o opie.o openssl.o http ntlm.o../lib/libgnu.a-Bstatic-lssl-lcrypto-Bdynamic-ldl-lrt-lz
@jww-tnx;我在问题中添加了输出。用作指导。这是一种不寻常的错误。也许gcc-v
将有助于显示gcc使用的include和library目录。其他一些库必须动态链接,如dl
和rt
。因此,可能类似于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 optimer.o recur.o res.o retr.o spider.o url.o utils.o exits.o build\u info.o version.o ftp.o opie.o openssl.o http ntlm.o../lib/libgnu.a-Bstatic-lssl-lcrypto-Bdynamic-ldl-lrt-lz
@jww-tnx;我已将输出添加到问题中。