Hi,

On Monday, January 27th, 2025 at 10:40 PM, Mark Wielaard <m...@klomp.org> wrote:
> My main question/confusion is where the error.h include comes from.
> elfutils does support libcs like musl who don't provide error.h but do
> provide err.h. Then the build should provide its own error function
> through lib/system.h.

Normally there would be no error.h meaning it would use the err.h approach with 
functions from lib/system.h.

The new variable is that some packages have started to require 
sys-libs/error-standalone which installs its own error.h, but requiring 
explicit linkage just like argp-standalone and fts-standalone. This leads to 
the error.h check to pass and lib/system.h error functions don't get used 
(ultimately leading to a linking error).

> So maybe our configure check is wrong and it should just test whether
> there is an error.h but also if you can link the result?

Included patch that checks if the symbol is available before defining 
HAVE_ERROR_H. This would also work, and wouldn't add a new automagic dependency 
on musl.
From 43ddbe073025fe2ff454dabb84674ccdbd013487 Mon Sep 17 00:00:00 2001
From: Alfred Wingate <par...@protonmail.com>
Date: Wed, 29 Jan 2025 09:32:49 +0200
Subject: [PATCH] Declare HAVE_ERROR_H only if error symbol is available

Musl doesn't provide error.h. But there exists a standalone implementation
that installs /usr/include/error.h but requires explicit linkage. This
leads linkage errors later on due to the assumption that error
symbols are provided by the libc.

Bug: https://bugs.gentoo.org/948878
Signed-off-by: Alfred Wingate <par...@protonmail.com>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 1da2a12c..7a2f2540 100644
--- a/configure.ac
+++ b/configure.ac
@@ -477,7 +477,7 @@ AC_CHECK_FUNCS([process_vm_readv mremap])
 AS_IF([test "x$ac_cv_func_mremap" = "xno"],
       [AC_MSG_WARN([elf_update needs mremap to support ELF_C_RDWR_MMAP])])
 
-AC_CHECK_HEADERS([error.h])
+AC_CHECK_HEADER([error.h], [AC_CHECK_FUNC([error], AC_DEFINE([HAVE_ERROR_H], [1]))])
 AC_CHECK_HEADERS([err.h])
 
 dnl for debuginfod concurrency heuristics
-- 
2.48.1

Reply via email to