From 2617b330e495b8c11a555c84e63c3df65e504116 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Thu, 19 Dec 2013 00:55:03 -0700 Subject: [PATCH] Fix linker errors "relocation R_X86_64_32 against .rodata" ... "can not be used when making a shared object; recompile with -fPIC" Caused by some libraries built without libtool in certain environments. NP: there are other libraries in Squid built without libtool but they appear not to be having these linker issues at this time. Also, fixes "undefined symbol eui64_aton" uncovered by these changes. --- compat/Makefile.am | 7 ++++--- compat/eui64_aton.c | 4 ++++ compat/eui64_aton.h | 2 ++ configure.ac | 4 ++-- snmplib/Makefile.am | 4 ++-- src/Common.am | 2 +- src/Makefile.am | 2 +- 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/compat/Makefile.am b/compat/Makefile.am index bbd27cb3bc..22ffcf8cdd 100644 --- a/compat/Makefile.am +++ b/compat/Makefile.am @@ -9,8 +9,8 @@ include $(top_srcdir)/src/Common.am # Port Specific Configurations -noinst_LIBRARIES = libcompat-squid.a -libcompat_squid_a_SOURCES = \ +noinst_LTLIBRARIES = libcompat-squid.la +libcompat_squid_la_SOURCES = \ assert.cc \ assert.h \ cmsg.h \ @@ -23,6 +23,7 @@ libcompat_squid_a_SOURCES = \ debug.h \ drand48.h \ eui64_aton.h \ + eui64_aton.c \ fdsetsize.h \ getaddrinfo.h \ getnameinfo.h \ @@ -74,7 +75,7 @@ libcompat_squid_a_SOURCES = \ os/solaris.h \ os/sunos.h -libcompat_squid_a_LIBADD= $(LIBOBJS) +libcompat_squid_la_LIBADD= $(LIBOBJS) check_PROGRAMS += testPreCompiler TESTS += testPreCompiler diff --git a/compat/eui64_aton.c b/compat/eui64_aton.c index 2f1cf2d139..0a0bef7fc1 100644 --- a/compat/eui64_aton.c +++ b/compat/eui64_aton.c @@ -77,6 +77,8 @@ #include "squid.h" #include "compat/eui64_aton.h" +#if SQUID_EUI64_ATON + /* * Convert an ASCII representation of an EUI-64 to binary form. */ @@ -132,3 +134,5 @@ good: return (0); } + +#endif /* !SQUID_EUI64_ATON */ diff --git a/compat/eui64_aton.h b/compat/eui64_aton.h index 863a832e33..f73765a1ab 100644 --- a/compat/eui64_aton.h +++ b/compat/eui64_aton.h @@ -46,6 +46,8 @@ extern "C" { #endif +#define SQUID_EUI64_ATON 1 + /** * Size of the ASCII representation of an EUI-64. */ diff --git a/configure.ac b/configure.ac index eb10e097fe..e6edae1529 100644 --- a/configure.ac +++ b/configure.ac @@ -1138,7 +1138,7 @@ SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes}, [Define to enable SNMP monitoring of Squid]) AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"]) if test "x$enable_snmp" = "xyes"; then - SNMPLIB='../snmplib/libsnmplib.a' + SNMPLIB='../snmplib/libsnmplib.la' makesnmplib=snmplib fi AC_MSG_NOTICE([SNMP support enabled: $enable_snmp]) @@ -3057,6 +3057,7 @@ AC_CHECK_FUNCS(\ bswap_32 \ bswap16 \ bswap32 \ + eui64_aton \ fchmod \ getdtablesize \ getpagesize \ @@ -3114,7 +3115,6 @@ AC_CHECK_FUNCS(\ dnl ... and some we provide local replacements for AC_REPLACE_FUNCS(\ drand48 \ - eui64_aton \ inet_ntop \ inet_pton \ initgroups \ diff --git a/snmplib/Makefile.am b/snmplib/Makefile.am index 391e10464a..11a255c0ec 100644 --- a/snmplib/Makefile.am +++ b/snmplib/Makefile.am @@ -4,8 +4,8 @@ ## AM_CFLAGS = $(SQUID_CFLAGS) AM_CXXFLAGS = $(SQUID_CXXFLAGS) -noinst_LIBRARIES = libsnmplib.a -libsnmplib_a_SOURCES = asn1.c parse.c snmp_vars.c \ +noinst_LTLIBRARIES = libsnmplib.la +libsnmplib_la_SOURCES = asn1.c parse.c snmp_vars.c \ coexistance.c snmp_api.c snmp_error.c \ mib.c snmp_api_error.c \ snmp_msg.c \ diff --git a/src/Common.am b/src/Common.am index 036d501c9c..c78fe2bd9a 100644 --- a/src/Common.am +++ b/src/Common.am @@ -43,7 +43,7 @@ LIBPROFILER= endif ## Because compatibility is almost universal. And the link order is important. -COMPAT_LIB = -L$(top_builddir)/compat -lcompat-squid $(LIBPROFILER) +COMPAT_LIB = $(top_builddir)/compat/libcompat-squid.la $(LIBPROFILER) ## Some helpers are written in Perl and need the local shell defined properly subst_perlshell = sed -e 's,[@]PERL[@],$(PERL),g' <$(srcdir)/$@.pl.in >$@ || ($(RM) -f $@ ; exit 1) diff --git a/src/Makefile.am b/src/Makefile.am index c6f201c43e..be8c588c2f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -940,7 +940,7 @@ DEFAULT_ERROR_DIR = $(datadir)/errors # Make location configure settings available to the code DEFS += -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" -DDEFAULT_SQUID_DATA_DIR=\"$(datadir)\" -DDEFAULT_SQUID_CONFIG_DIR=\"$(sysconfdir)\" -snmp_core.o snmp_agent.o: ../snmplib/libsnmplib.a $(top_srcdir)/include/cache_snmp.h +snmp_core.o snmp_agent.o: ../snmplib/libsnmplib.la $(top_srcdir)/include/cache_snmp.h globals.cc: globals.h mk-globals-c.awk $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || ($(RM) -f $@ && exit 1) -- 2.47.2