I'm compiling an old version of Squid, version 2.6. I need to compile it with ssl support so I compiled/installed openssl version 1.0.2n from source. I installed it in /usr/local/ssl
So I compiled Squid using ./configure -prefix=/opt/squid --with-openssl=/usr/local/ssl
. The make
was successful.
However, when I compiled it using ./configure -prefix=/opt/squid --with-openssl=/usr/local/ssl --enable-ssl
, I encountered the errors below.
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
I'm not sure how to figure out the issue and how to fix it.
UPDATE: I figured it out by using --with-dl :)
You got unresolved references for dll functions, your build needs to include -ldl to resolve them
You need to check your configure script if it supports adding new linker flags with LDFLAGS, then you can try compiling with ./configure -prefix=/opt/squid --with-openssl=/usr/local/ssl LDFLAGS="-ldl"