Hello everybody,

I am one of the maintainers of the haproxy package for the OpenWRT
project. I am reaching out to you because - as of HAProxy version
2.1.5 - we experience build-issues on some of our build-targets.
We mostly use MUSL and uclibc as our c-libraries because they are more
suitable for embedded devices which are our main focus. Since HAProxy
version 2.1.5, the build is broken for all of our uclibc-targets:

src/standard.c: In function 'dladdr_and_size':
src/standard.c:4356:8: warning: implicit declaration of function
'dladdr1'; did you mean 'dladdr'? [-Wimplicit-function-declaration]
  ret = dladdr1(addr, dli, (void **)&sym, RTLD_DL_SYMENT);
src/standard.c:4356:42: error: 'RTLD_DL_SYMENT' undeclared (first use
in this function); did you mean 'DT_SYMENT'?
  ret = dladdr1(addr, dli, (void **)&sym, RTLD_DL_SYMENT);
src/standard.c:4356:42: note: each undeclared identifier is reported
only once for each function it appears in

The problem lies in the #ifdef in src/standard.c:

static int dladdr_and_size(const void *addr, Dl_info *dli, size_t *size)
        int ret;
#ifdef __USE_GNU // most detailed one
        const ElfW(Sym) *sym;

        ret = dladdr1(addr, dli, (void **)&sym, RTLD_DL_SYMENT);
        if (ret)
                *size = sym ? sym->st_size : 0;
        ret = dladdr(addr, dli);
        *size = 0;
        return ret;

Neither MUSL nor uclibc support dladdr1() so both must fall back to
using dladdr(). However, __USE_GNU is defined in uclibc making it use
dladdr1() resulting in the compilation failure. Using __USE_GNU is
generally not recommended so I wrote a patch which changed the #ifdef
to check for GLIBC. When I was preparing for submitting the patch for
the haproxy dev-branch I realized that Willy already did basically the
exact same thing there (here:

So in conclusion, my request is to backport Willy's change to the 2.1
tree, please.

Thanks a lot,

Reply via email to