classification
Title: [MinGW] Can't compile Python/dynload_win.c due to static strcasecmp
Type: compile error Stage: resolved
Components: Build, Windows Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, paul.moore, serhiy.storchaka, steve.dower, tim.golden, vmurashev, zach.ware
Priority: normal Keywords: patch

Created on 2016-09-25 10:48 by vmurashev, last changed 2019-08-24 10:31 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
dynload_win.c.3.5.mingw.patch vmurashev, 2016-09-25 10:48
dynload_win.c.2.7.mingw.patch vmurashev, 2016-09-25 10:48
Pull Requests
URL Status Linked Edit
PR 13095 merged Minmin.Gong, 2019-05-05 05:20
PR 14740 merged miss-islington, 2019-07-13 13:12
PR 14741 closed miss-islington, 2019-07-13 13:12
Messages (5)
msg277362 - (view) Author: Vitaly Murashev (vmurashev) * Date: 2016-09-25 10:48
Attempt to complile Python/dynload_win.c by MinGW fails
due to static reimplementation of strcasecmp function in this file:

---
/* Case insensitive string compare, to avoid any dependencies on particular
   C RTL implementations */

static int strcasecmp (char *string1, char *string2)
{
    int first, second;

    do {
        first  = tolower(*string1);
        second = tolower(*string2);
        string1++;
        string2++;
    } while (first && first == second);

    return (first - second);
}
---

And this reimplementation clashed with native declaration of strcasecmp()
which one is a part of MinGW runtime

So suggested patch (for 3.5.2 and 2.7.12)
just disables static reimplementation of strcasecmp for MinGW
msg277761 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-09-30 16:37
Why not replace it entirely with stricmp? Does it behave differently?
msg347812 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-07-13 13:11
New changeset 05f2d84cae4ba1ff15b7a1d0347305393f4bdcc5 by Serhiy Storchaka (Minmin Gong) in branch 'master':
bpo-28269: Replace strcasecmp with system function _stricmp. (GH-13095)
https://github.com/python/cpython/commit/05f2d84cae4ba1ff15b7a1d0347305393f4bdcc5
msg350362 - (view) Author: miss-islington (miss-islington) Date: 2019-08-24 10:22
New changeset 920ec4b7763d64b3742d7ddd339ad11cdbec62e9 by Miss Islington (bot) in branch '3.8':
bpo-28269: Replace strcasecmp with system function _stricmp. (GH-13095)
https://github.com/python/cpython/commit/920ec4b7763d64b3742d7ddd339ad11cdbec62e9
msg350363 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-08-24 10:31
Thank you for your PR Minmin. It was decided to not backport it to 3.7.
History
Date User Action Args
2019-08-24 10:31:25serhiy.storchakasetstatus: open -> closed
versions: + Python 3.8, Python 3.9
messages: + msg350363

resolution: fixed
stage: patch review -> resolved
2019-08-24 10:22:17miss-islingtonsetnosy: + miss-islington
messages: + msg350362
2019-07-13 13:12:09miss-islingtonsetpull_requests: + pull_request14537
2019-07-13 13:12:01miss-islingtonsetpull_requests: + pull_request14536
2019-07-13 13:11:46serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg347812
2019-05-05 05:20:04Minmin.Gongsetstage: patch review
pull_requests: + pull_request13009
2016-09-30 16:37:19steve.dowersetnosy: + paul.moore, tim.golden, zach.ware, steve.dower
messages: + msg277761
components: + Windows
2016-09-25 11:27:58martin.panterlinkissue10504 dependencies
2016-09-25 11:25:56vmurashevsettype: compile error
2016-09-25 10:48:18vmurashevsetfiles: + dynload_win.c.2.7.mingw.patch
2016-09-25 10:48:03vmurashevcreate