使用 --enable-ssl 编译失败,但如果未指定则可以工作

标签 c openssl squid

我正在编译旧版本的 Squid,版本 2.6。我需要使用 ssl 支持来编译它,因此我从源代码编译/安装了 openssl 版本 1.0.2n。我把它安装在/usr/local/ssl

所以我使用./configure -prefix=/opt/squid --with-openssl=/usr/local/ssl编译了Squid。 make 成功。

但是,当我使用 ./configure -prefix=/opt/squid --with-openssl=/usr/local/ssl --enable-ssl 编译它时,遇到了以下错误.

gcc -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\"/opt/squid/etc/squid.conf\" -I. -I../include -I. -I. -I../include -I../include  -I/usr/local/ssl/include   -Wall -g -O2 -MT auth_modules.o -MD -MP -MF .deps/auth_modules.Tpo -c -o auth_modules.o auth_modules.c
mv -f .deps/auth_modules.Tpo .deps/auth_modules.Po
gcc -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\"/opt/squid/etc/squid.conf\" -I. -I../include -I. -I. -I../include -I../include  -I/usr/local/ssl/include   -Wall -g -O2 -MT store_modules.o -MD -MP -MF .deps/store_modules.Tpo -c -o store_modules.o store_modules.c
mv -f .deps/store_modules.Tpo .deps/store_modules.Po
gcc -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\"/opt/squid/etc/squid.conf\" -I. -I../include -I. -I. -I../include -I../include  -I/usr/local/ssl/include   -Wall -g -O2 -MT string_arrays.o -MD -MP -MF .deps/string_arrays.Tpo -c -o string_arrays.o string_arrays.c
mv -f .deps/string_arrays.Tpo .deps/string_arrays.Po
gcc  -Wall -g -O2  -g -o squid access_log.o acl.o asn.o authenticate.o cache_cf.o CacheDigest.o cache_manager.o carp.o cbdata.o client_db.o client_side.o comm.o comm_epoll.o debug.o  disk.o dns_internal.o errorpage.o event.o errormap.o external_acl.o fd.o filemap.o forward.o fqdncache.o ftp.o gopher.o helper.o  http.o HttpStatusLine.o HttpHdrCc.o HttpHdrRange.o HttpHdrContRange.o HttpHeader.o HttpHeaderTools.o HttpBody.o HttpMsg.o HttpReply.o HttpRequest.o icmp.o icp_v2.o icp_v3.o ident.o internal.o ipc.o ipcache.o  locrewrite.o logfile.o main.o mem.o MemPool.o MemBuf.o mime.o multicast.o neighbors.o net_db.o Packer.o pconn.o peer_digest.o peer_monitor.o peer_select.o peer_sourcehash.o peer_userhash.o redirect.o referer.o refresh.o send-announce.o  ssl.o ssl_support.o stat.o StatHist.o String.o stmem.o store.o store_io.o store_client.o store_digest.o store_dir.o store_key_md5.o store_log.o store_rebuild.o store_swapin.o store_swapmeta.o store_swapout.o tools.o unlinkd.o url.o urn.o useragent.o wais.o wccp.o wccp2.o whois.o  repl_modules.o auth_modules.o store_modules.o globals.o string_arrays.o -L../lib repl/liblru.a fs/libufs.a auth/libbasic.a -lcrypt -L/usr/local/ssl/lib -lssl -lcrypto -lmiscutil -lm -lnsl
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x11): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x2f): undefined reference to `dlclose'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
dso_dlfcn.c:(.text+0x334): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x3db): undefined reference to `dlerror'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
dso_dlfcn.c:(.text+0x454): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x4fb): undefined reference to `dlerror'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
dso_dlfcn.c:(.text+0x569): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x5cb): undefined reference to `dlclose'
dso_dlfcn.c:(.text+0x603): undefined reference to `dlerror'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
dso_dlfcn.c:(.text+0x69f): undefined reference to `dladdr'
dso_dlfcn.c:(.text+0x709): undefined reference to `dlerror'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
dso_dlfcn.c:(.text+0x762): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
Makefile:701: recipe for target 'squid' failed
make[3]: *** [squid] Error 1
make[3]: Leaving directory '/usr/local/src/squid-2.6.STABLE24/src'
Makefile:884: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/usr/local/src/squid-2.6.STABLE24/src'
Makefile:609: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/usr/local/src/squid-2.6.STABLE24/src'
Makefile:302: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

我不确定如何找出问题以及如何解决它。

更新: 我通过使用 --with-dl 解决了这个问题:)

最佳答案

您有 dll 函数的未解析引用,您的构建需要包含 -ldl 来解析它们

您需要检查您的配置脚本是否支持使用 LDFLAGS 添加新的链接器标志,然后您可以尝试使用 ./configure -prefix=/opt/squid --with-openssl=/usr/local/ssl LDFLAGS= 进行编译“-低密度脂蛋白”

关于使用 --enable-ssl 编译失败,但如果未指定则可以工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49292507/

相关文章:

c - 带符号的位域至少需要两位

c++ - 使用 AES_256_CBC 解密文件返回 "bad decrypt"错误

mysql - 远程连接到 MySQL 数据库以绕过 Squid 代理服务器

python - 如何捕获连接到我的网络的设备的 URL

Java验证openssl中的数字签名

java - Sonar javadoc规则

c - 这个 C 函数有什么问题?

清除数组

c - Lua 5.2 C API 和要求

security - 扩展 Emacs 编辑加密文本文件