GMP fails to compile with LLVM libc

Jeff Bailey jbailey at raspberryginger.com
Thu Oct 15 09:28:18 CEST 2026


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! =)

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
-- 
Pie are not square. Pie are round. Cornbread are square.


More information about the gmp-bugs mailing list