https://bugs.openldap.org/show_bug.cgi?id=9841
Issue ID: 9841 Summary: Build failure on musl due to conflicting declarations of ber_calloc Product: OpenLDAP Version: 2.5.11 Hardware: All OS: Linux Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: build Assignee: bugs@openldap.org Reporter: helmut@subdivi.de Target Milestone: ---
This is a forward of a Debian bug at https://bugs.debian.org/1008951 and a Gentoo bug at https://bugs.gentoo.org/546556.
In essence, openldap #defines calloc ber_calloc and then #includes some system headers, which happen to #include <sched.h>. musl's <sched.h> happens to delcare calloc when _GNU_SOURCE is #defined. Since this is the case, musl's declaration is diverted to ber_calloc and since one parameter has a subtly different type, the declarations cause a conflict.
I think this is actually two bugs.
1. musl should not declare calloc in <sched.h>. Doing so also breaks libgccjit (citation needed). 2. openldap should not #define calloc before #including system headers.
Fixing either fixes the build failure. I think we should fix both.
The openldap side can be fixed by reordering the #define and the relevant #include. You can find a working patch in the Debian bug above at https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=1008951;filename=mus.... Does this look acceptable for inclusion into openldap?
https://bugs.openldap.org/show_bug.cgi?id=9841
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs_review | Assignee|bugs@openldap.org |hyc@openldap.org Target Milestone|--- |2.5.13
https://bugs.openldap.org/show_bug.cgi?id=9841
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |TEST
--- Comment #1 from Howard Chu hyc@openldap.org --- Thanks for the patch, fixed in master
https://bugs.openldap.org/show_bug.cgi?id=9841
--- Comment #2 from Quanah Gibson-Mount quanah@openldap.org --- master:
• f5f5231d by Helmut Grohne at 2022-05-05T20:29:40+01:00 ITS#9841 fix librewrite declaration of calloc
https://bugs.openldap.org/show_bug.cgi?id=9841
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|TEST |FIXED
--- Comment #3 from Quanah Gibson-Mount quanah@openldap.org --- RE26:
• a7d00f91 by Helmut Grohne at 2022-05-12T15:41:48+00:00 ITS#9841 fix librewrite declaration of calloc
RE25:
• 8c1d1f3f by Helmut Grohne at 2022-05-12T15:42:52+00:00 ITS#9841 fix librewrite declaration of calloc
https://bugs.openldap.org/show_bug.cgi?id=9841
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED