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: [email protected]
          Reporter: [email protected]
  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=musl.patch;msg=10.
Does this look acceptable for inclusion into openldap?

-- 
You are receiving this mail because:
You are on the CC list for the issue.

Reply via email to