bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Lucy Phipps <landfillbaby69@gmail.com>
To: bug-gnulib@gnu.org
Subject: #include <stdio.h> on Android clang causes an error
Date: Tue, 7 Sep 2021 14:11:50 +0100	[thread overview]
Message-ID: <CAGOd_F8gAmwg7OFp6Adr6gMx=d4cXKZ=HRFvba6g+F0MFU4Wfw@mail.gmail.com> (raw)

For example, building gzip 1.11 from the tar.xz source:
In file included from /home/builder/.termux-build/gzip/src/lib/freading.c:20:
In file included from /home/builder/.termux-build/gzip/src/lib/freading.h:18:
In file included from ./stdio.h:43:
In file included from
/home/builder/.termux-build/_cache/android-r21d-api-24-v5/bin/../sysroot/usr/include/stdio.h:47:
In file included from ./string.h:52:
In file included from ./stdlib.h:36:
In file included from
/home/builder/.termux-build/_cache/android-r21d-api-24-v5/bin/../sysroot/usr/include/stdlib.h:34:
/home/builder/.termux-build/_cache/android-r21d-api-24-v5/bin/../sysroot/usr/include/malloc.h:168:37:
error: unknown type name 'FILE'
int malloc_info(int __must_be_zero, FILE* __fp) __INTRODUCED_IN(23);

The problem is
The patch I ended up using on Termux is very simple, but assumes
gnulib didn't replace free()
diff --git a/lib/string.in.h b/lib/string.in.h
index fa2e40c..46b7a14 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -48,7 +48,7 @@
 #include <stddef.h>

 /* Get free().  */
-#include <stdlib.h>
+void free(void *);

 /* MirBSD defines mbslen as a macro.  */
 #if @GNULIB_MBSLEN@ && defined __MirBSD__


             reply	other threads:[~2021-09-07 14:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07 13:11 Lucy Phipps [this message]
2021-09-07 13:16 ` #include <stdio.h> on Android clang causes an error Lucy Phipps
2021-09-07 13:18   ` Lucy Phipps
2021-09-08  6:49 ` Paul Eggert
2021-09-08 10:45   ` Lucy Phipps
2021-09-08 16:55     ` Paul Eggert
2021-09-08 17:30       ` Lucy Phipps
2021-09-08 18:52         ` Lucy Phipps
2021-09-09  7:12           ` Paul Eggert
     [not found]             ` <CAGOd_F-fW-dkWihAgYUV96iNq7aMkLO+PsFvC9YvGzD+--bE3g@mail.gmail.com>
2021-09-09 10:25               ` Fwd: " Lucy Phipps
2021-09-09 11:08                 ` Jim Meyering

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGOd_F8gAmwg7OFp6Adr6gMx=d4cXKZ=HRFvba6g+F0MFU4Wfw@mail.gmail.com' \
    --to=landfillbaby69@gmail.com \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).