GMP fails to compile with LLVM libc

Marc Glisse marc.glisse at inria.fr
Mon Oct 26 11:49:12 CET 2026


On Thu, 15 Oct 2026, Jeff Bailey wrote:

> Hi!  I'm working on the LLVM C library and porting projects to use it as
> part of building it out.  GMP's FILE detection needs to learn about LLVM
> libc, and this patch is working locally for me.  Please let me know if
> there's anything you need from me! =)

Thanks, that looks good, I'll push it soon.

-- 
Marc Glisse

> Detect LLVM libc <stdio.h> include guard for _GMP_H_HAVE_FILE.
>
> GMP checks C library <stdio.h> include guard macros before defining
> _GMP_H_HAVE_FILE and declaring FILE* functions. Add _LLVM_LIBC_STDIO_H
> so these declarations are visible when building with LLVM libc.
>
> --- a/gmp-h.in
> +++ b/gmp-h.in
> @@ -268,7 +268,8 @@
>   || defined (_ISO_STDIO_ISO_H)       /* Sun C++ */ \
>   || defined (__STDIO_LOADED)         /* VMS */ \
>   || defined (_STDIO)                 /* HPE NonStop */         \
> -  || defined (__DEFINED_FILE)         /* musl */
> +  || defined (__DEFINED_FILE)         /* musl */                \
> +  || defined (_LLVM_LIBC_STDIO_H)     /* llvm-libc */
> #define _GMP_H_HAVE_FILE 1
> #endif
>
> Tks,
> Jeff Bailey


More information about the gmp-bugs mailing list