osasnmpd: Add -fPIC to CFLAGS to fix build on Fedora 27

On Fedora 27 "net-snmp-config --agent-libs" returns
"--specs=/usr/lib/rpm/redhat/redhat-hardened-ld" which introduces "-pie":

 # cat /usr/lib/rpm/redhat/redhat-hardened-ld
 *self_spec:
 + %{!static:%{!shared:%{!r:-pie}}}
 *link:
 + -z now

This leads to the following link error:

 /usr/bin/ld: osasnmpd.o: `getopt_long@@GLIBC_2.2' non-PLT reloc for symbol
              defined in shared library and accessed from executable
              (rebuild file with -fPIC ?)
 /usr/bin/ld: final link failed: Bad value

Add -fPIC to CLFAGS as a workaround to enbable linking again.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This commit is contained in:
Michael Holzheu
2017-11-23 16:36:24 +01:00
parent 3908725d3b
commit 8600296030
+3
View File
@@ -1,5 +1,8 @@
include ../common.mak
LDLIBS = `net-snmp-config --agent-libs`
# On some Linux systems `net-snmp-config --agent-libs` introduces -pie,
# therefore add -fPIC to prevent link failures.
CFLAGS += -fPIC
CFLAGS += `net-snmp-config --cflags`
OBJS = ibmOSAMib.o ibmOSAMibUtil.o osasnmpd.o