On 2026/10/08 14:51, LIU Hao wrote:
> 在 2026-10-8 14:25, Zhongteng Gui 写道:
>> As I've said in the original commit message, I did lots of searches before,
>> and I think this is
>> inherited from the very-old MSYS 1 together with MinGW (no -w64). Also, I
>> doubt it can't even build
>> some older GCC versions, not to say latest GCC 16/17. (The last proved
>> version
>> was GCC 6, see [1]).
>>
>> Most modern distributions (that can build GCC 16) as I've listed in the
>> commit
>> message usually use `sed`
>> to replace `/mingw` with either `/usr` or their own prefixes. This is very
>> hacky, and I think (and it'v proved
>> to work in MSYS2 and conda-forge) that it's better to use --sysroot with no
>> special prefixes.
>
> For Cygwin the headers and libraries for Cygwin-to-native cross-compilers are
> located in
> (https://cygwin.com/pipermail/cygwin-apps/2012-March/029797.html)
>
> * /usr/i686-w64-mingw32/sys-root/mingw/{include,lib} (CRT)
> * /usr/i686-w64-mingw32/sys-root/w32api/{include,lib} (Platform)
> * /usr/x86_64-w64-mingw32/sys-root/mingw/{include,lib} (CRT)
> * /usr/x86_64-w64-mingw32/sys-root/w32api/{include,lib} (Platform)
>
Good catch! Though I'm a bit confused about this layout.
On Cygwin side, this layout is shared mainly by
mingw64-x86_64-{gcc,headers,runtime}, and is concated from TOOLCHAIN_SYSROOT
(/usr/x86_64-w64-ming32/sys-root) and a manual /mingw.
However, if we compare their MSYS2-counterpart, which is
mingw-w64-cross-mingw64-{crt,headers,gcc}, they uses
/opt/x86_64-w64-mingw32/{include,lib}, without any /mingw stuff.
I'm comparing these build scripts from Cygwin and MSYS2. Sadly, none of they
mentions anything about /mingw. All of their patches are also unrealted.
I'm not familiar with cygport, but relatively familiar with mingw-w64 and
makepkg, so I tend to think that there's some magic inside cygport that adds
/mingw.
Some references:
- Cygwin CRT:
https://cygwin.com/cgit/cygwin-packages/mingw64-x86_64-runtime/tree/mingw64-x86_64-runtime.cygport
- Cygwin GCC:
https://cygwin.com/cgit/cygwin-packages/mingw64-x86_64-gcc/tree/mingw64-x86_64-gcc.cygport
- MSYS2 CRT:
https://github.com/msys2/MSYS2-packages/blob/master/mingw-w64-cross-crt/PKGBUILD
- MSYS2 GCC:
https://github.com/msys2/MSYS2-packages/blob/master/mingw-w64-cross-gcc/PKGBUILD