Description of problem: Compiling/linking when using the output of $(net-snmp-config --cflags) and $(net-snmp-config --external-libs) produces the following errors: /usr/bin/ld: /tmp/ccGWfmJB.o: `puts@@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 collect2: error: ld returned 1 exit status Version-Release number of selected component (if applicable): All recent versions of net-snmp How reproducible: Always Steps to Reproduce: 1. cat <<EOF >/tmp/hw.c #include <stdio.h> int main(int argc, char **argv) { printf("Hello world\n"); } EOF 2. gcc $(net-snmp-config --cflags) $(net-snmp-config --external-libs) /tmp/hw{,.c} Actual results: Error messages /usr/bin/ld: /tmp/ccGWfmJB.o: `puts@@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 collect2: error: ld returned 1 exit status Expected results: Compiles/links successfully Additional info: This problem does not occur on x86_64. The problem is caused by the following part of the net-snmp-VER-cflags.patch diff -urNp a/net-snmp-config.in b/net-snmp-config.in --- a/net-snmp-config.in 2018-07-18 13:43:12.264426052 +0200 +++ b/net-snmp-config.in 2018-07-18 13:52:06.917089518 +0200 @@ -140,10 +140,10 @@ else ;; #################################################### compile --base-cflags) - echo @CFLAGS@ @CPPFLAGS@ -I${NSC_INCLUDEDIR} + echo -I${NSC_INCLUDEDIR} ;; --cflags|--cf*) - echo @CFLAGS@ @DEVFLAGS@ @CPPFLAGS@ -I. -I${NSC_INCLUDEDIR} + echo @DEVFLAGS@ -I. -I${NSC_INCLUDEDIR} ;; --srcdir) echo $NSC_SRCDIR because it does not also remove ${NSC_LDFLAGS} from the output of net-snmp-config options --libs, --external-libs, --agent-libs, and --external-agent-libs. This means that the output of net-snmp-config --*-libs includes -specs=/usr/lib/rpm/redhat/redhat-hardened-ld, whereas the output of net-snmp-config --cflags, after the above patch, no longer includes -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1. The consequence of this is that -pie is specified, but -fPIE is not specified. This problem can been seen on both RHEL and Fedora on all architectures, although with some architectures it does not cause a linker failure.
FEDORA-2021-542c9d0570 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-542c9d0570
FEDORA-2021-72e9c8074e has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-72e9c8074e
FEDORA-2021-542c9d0570 has been pushed to the Fedora 34 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2021-72e9c8074e has been pushed to the Fedora 33 stable repository. If problem still persists, please make note of it in this bug report.