After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 795876 - meson: Fix checks for posix_memalign and stpcpy
meson: Fix checks for posix_memalign and stpcpy
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: win32
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-win32 maintainers
Depends on:
Blocks:
 
 
Reported: 2018-05-07 10:15 UTC by Nirbheek Chauhan
Modified: 2018-05-21 15:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
meson: Fix checks for posix_memalign and stpcpy (1.95 KB, patch)
2018-05-07 10:15 UTC, Nirbheek Chauhan
none Details | Review
meson: Fix checks for posix_memalign and stpcpy (2.20 KB, patch)
2018-05-09 12:18 UTC, Nirbheek Chauhan
committed Details | Review

Description Nirbheek Chauhan 2018-05-07 10:15:23 UTC
The 'no-builtin' checks were just plain wrong. For accurate detection of
functions, use has_function with a header in the prefix.

This also allows cross-files to override the result by setting
`has_function_stpcpy = false`, etc in [extra properties]
Comment 1 Nirbheek Chauhan 2018-05-07 10:15:32 UTC
Created attachment 371769 [details] [review]
meson: Fix checks for posix_memalign and stpcpy
Comment 2 Philip Withnall 2018-05-07 10:18:50 UTC
Does this work correctly on MSYS2 and MinGW, as per bug #794555 and bug #793729?
Comment 3 Nirbheek Chauhan 2018-05-07 10:29:00 UTC
I have tested this on MinGW-w64 from MSYS, but not the same from MSYS2. I added this has_function feature for more accurate function detection because of MSYS2 and MSYS2 shipping broken toolchains, so it should work.

I'll test it tomorrow just to be sure.

I forgot to mention that the existing check is wrong on Android, will add that to the commit message too.
Comment 4 Philip Withnall 2018-05-09 10:26:38 UTC
(In reply to Nirbheek Chauhan from comment #3)
> I'll test it tomorrow just to be sure.

Did you get round to this?
Comment 5 Nirbheek Chauhan 2018-05-09 12:11:40 UTC
(In reply to Philip Withnall from comment #4)
> (In reply to Nirbheek Chauhan from comment #3)
> > I'll test it tomorrow just to be sure.
> 
> Did you get round to this?

It looks like MSYS2 MinGW-w64 fixed its toolchain and `posix_memalign` and `stpcpy` are no longer detected even in the case without #include in prefix.

However, this is still needed for Android and for MSYS MinGW-w64.
Comment 6 Nirbheek Chauhan 2018-05-09 12:18:39 UTC
Created attachment 371838 [details] [review]
meson: Fix checks for posix_memalign and stpcpy

The 'no-builtin' checks were just plain wrong. For accurate detection of
functions, use has_function with a header in the prefix. This fixes
posix_memalign detection on Android and on MinGW32, MSYS-MinGW-w64, and
old versions of MSYS2-MinGW-w64.

Using the header in the `prefix:` is generally a good idea because of
how macOS does targetting of specific macOS releases at compile time.

This also allows cross-files to override the result by setting
`has_function_stpcpy = false`, etc in [extra properties]
Comment 7 Christoph Reiter (lazka) 2018-05-12 07:20:56 UTC
(In reply to Nirbheek Chauhan from comment #5)
> (In reply to Philip Withnall from comment #4)
> > (In reply to Nirbheek Chauhan from comment #3)
> > > I'll test it tomorrow just to be sure.
> > 
> > Did you get round to this?
> 
> It looks like MSYS2 MinGW-w64 fixed its toolchain and `posix_memalign` and
> `stpcpy` are no longer detected even in the case without #include in prefix.
> 
> However, this is still needed for Android and for MSYS MinGW-w64.

MSYS2 still isn't fixed I think, but I added a meson patch in MSYS2 to force it some time ago: https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-meson/force-func-detect.patch

I can confirm that passing the prefix makes things work either way and I'm going to remove the msys2 patch.
Comment 8 Christoph Reiter (lazka) 2018-05-12 07:36:06 UTC
(In reply to Christoph Reiter (lazka) from comment #7)
> I can confirm that passing the prefix makes things work either way and I'm
> going to remove the msys2 patch.

I've proposed to remove the patch here: https://github.com/Alexpux/MINGW-packages/pull/3717
Comment 9 Philip Withnall 2018-05-16 10:13:43 UTC
Review of attachment 371838 [details] [review]:

OK.
Comment 10 Nirbheek Chauhan 2018-05-21 15:42:40 UTC
Comment on attachment 371838 [details] [review]
meson: Fix checks for posix_memalign and stpcpy

git bz timed out, pushed manually.