Bug 1921988
| Summary: | Compile/link failure when using net-snmp-config --cflags and net-snmp-config --external-libs | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Quentin Armitage <quentin> |
| Component: | net-snmp | Assignee: | Josef Ridky <jridky> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 33 | CC: | jridky, jsafrane, mhjacks, zdohnal |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | s390x | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | net-snmp-5.9.1-4.fc34 net-snmp-5.9.1-4.fc33 | Doc Type: | --- |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-08-15 01:09:59 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
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. |
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.