[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Android port
From: |
Bruno Haible |
Subject: |
Re: Android port |
Date: |
Sat, 05 Aug 2023 14:25:59 +0200 |
Eli Zaretskii wrote:
> > But from this error log:
> >
> > In file included from
> > C:/msys64/tmp/emacs-bfbdf4eb892935536fc665d6cc986fd669364263/nt/inc/ms-w32.h:389,
> > from ../src/conf_post.h:38,
> > from ../src/config.h:3511,
> > from printf.c:18:
> > C:/msys64/mingw64/include/stdio.h:379:5: note: previous definition of
> > 'printf' with type 'int(const char *, ...)'
> >
> > it seems that nt/inc/ms-w32.h directly includes <stdio.h> from mingw,
> > without
> > the interposed lib/stdio.h.
> >
> > Do you have a lib/stdio.h in your build tree?
Angelo replied "It seems no".
And that is the problem. The generated stdio.h, on this platform, is
supposed to contain macro definitions:
#define asprintf rpl_asprintf
#define printf __printf__
#define vasprintf rpl_vasprintf
#define vfprintf rpl_vfprintf
By omitting these macro definitions, there is a conflict between the
inline definition in mingw's <stdio.h> and the Gnulib replacement code.
> The MinGW build omits building the Gnulib's stdio module. We did that
> since 2017. The exact reasons are probably lost in time, but I can
> assure you they were real, and I wouldn't want to reintroduce them for
> this particular reason.
It'd be worth a try nevertheless. Gnulib has changed a lot since 2017.
> Since the *printf family doesn't need to be replaced in the Emacs
> build on MS-Windows, I'd rather we understood why the above causes
> compilation errors.
See above.
> Aren't Gnulib replacements for *printf functions
> supposed to have prototypes compatible to the MinGW headers?
No, Gnulib replacements always have different function names than
the system function (except for the 'free' function). The reason
is that there is so much variation in the prototypes of a function
(with or without 'restrict', with or without 'throw()' in C++,
with or without 'static' / 'inline'), that it would be extremely
fragile to attempt to get the exact same prototype as the system.
So, if you decided not to have a generated stdio.h, the simplest
solution seems to be:
1) in the conf_post.h or nt/inc/ms-w32.h, include <stdio.h>
(this is the one from the system),
2) after this #include, add
#define asprintf rpl_asprintf
#define printf __printf__
#define vasprintf rpl_vasprintf
#define vfprintf rpl_vfprintf
and add prototypes for these 4 functions.
Bruno
- Re: Android port, (continued)
- Re: Android port, Po Lu, 2023/08/05
- Re: Android port, Bruno Haible, 2023/08/05
- Re: Android port, Angelo Graziosi, 2023/08/05
- Re: Android port, Bruno Haible, 2023/08/05
- Re: Android port, Angelo Graziosi, 2023/08/05
- Re: Android port, Eli Zaretskii, 2023/08/05
- Re: Android port, Po Lu, 2023/08/05
- Re: Android port, Eli Zaretskii, 2023/08/05
- Re: Android port, Po Lu, 2023/08/05
- Re: Android port, Po Lu, 2023/08/05
- Re: Android port,
Bruno Haible <=
- Re: Android port, Eli Zaretskii, 2023/08/05
- Re: Android port, Bruno Haible, 2023/08/05
- Re: Android port, Eli Zaretskii, 2023/08/05
- Re: Android port, Po Lu, 2023/08/05
- Re: Android port, Eli Zaretskii, 2023/08/05
- Re: Android port, Eli Zaretskii, 2023/08/05
- Re: Android port, Po Lu, 2023/08/05
- Re: Android port, Eli Zaretskii, 2023/08/06
- Re: Android port, Po Lu, 2023/08/06
- Re: Android port, Eli Zaretskii, 2023/08/06