From 8600296030929763a8b87cc429761157c79ee58c Mon Sep 17 00:00:00 2001 From: Michael Holzheu Date: Thu, 23 Nov 2017 16:36:24 +0100 Subject: [PATCH] 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 --- osasnmpd/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osasnmpd/Makefile b/osasnmpd/Makefile index ec67b266..79036bb4 100644 --- a/osasnmpd/Makefile +++ b/osasnmpd/Makefile @@ -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