In the 0.191 update dirname was used instead of <libgen.h> to fix the
poisoned basename error:
/usr/include/libgen.h:35:9: error: attempt to use poisoned "basename"
35 | #define basename __xpg_basename
However, doing this has lead to libelf.a pulling in xmalloc, xstrdup and
friends and statically linking them thus leading to a symbol name conflict
with FRR host build and anything else that links against libelf and uses
xmalloc and friends.
Well, it turns out that upstream has added a helper[1] for basename so it
can compile with musl 1.2.5 which dropped the basename declaration, but it
also means that we must NOT include <libgen.h> and that poisoned error is
intentional and added to prevent duplicate basename definitions.
This also means that for macOS we dont need to do any additional header
inclusions as the new helper takes care of basename.
So, to fix the symbol conflict we can simply drop the <dirname.h> inclusion
and build from elfutils.
Tested on Fedora 40 as well as macOS 14.4.1.
[1] https://sourceware.org/git/?p=elfutils.git;a=commit;h=
a2194f6b305bf0d0b9dd49dccd0a5c21994c8eea
Fixes: #24030
Fixes: b6f025b42429 ("tools/elfutils: update to 1.91")
Link: https://github.com/openwrt/openwrt/pull/15337
Signed-off-by: Robert Marko <robimarko@gmail.com>