cygwin changes needed for latest mingw64 headers

Christopher Faylor
Mon Nov 12 19:16:00 GMT 2012

[moving cygwin-specific newlib discussion here]
On Mon, Nov 12, 2012 at 05:04:18PM +0100, Corinna Vinschen wrote:
>On Nov 12 10:20, Christopher Faylor wrote:
>>*I've had to make a number of changes to Cygwin to get it to build with
>>the latest released version of the mingw64 headers.
>What changes?  I'm using the
>cygwin-w32api-headers-2.0.999-1.trunk.20121016 header package on
>Fedora, and I can build and run Cygwin fine after the change from
>yesterday.  Do the latest headers from the distro differ?

I initially was using the x86_64 headers from:


extracted on Linux.

I had to make a few changes to get that working, which was surprising.

I have switched to mingw64-i686-headers-3.0b_svn5373-1.tar.bz2 but I
haven't checked to see if that meant I could back out my changes.  I'd
be surprised if it did.

I thought it would be best to be using the headers that we actually
release rather than whatever someone decided to package for my
development system.

I've ported my configure changes over from the git branch to make it
easier to point to arbitrary windows headers and libraries when
configuring.  That allows me to ignore the headers that are installed
for my cross-compiler, which are actually, as it turns out, out-of-date.

I have a perl script now which sets up /usr/local/i686-w64-mingw32 with
the headers and libraries needed to build Cygwin (and hopefully
setup.exe) from the Cygwin distro.

I've attached the script.  Except for the last few lines, it should work
nearly anywhere, as long as you have a login account on

-------------- next part --------------
use File::Basename;
use File::Path qw'remove_tree';
use constant {
    INSTALL_PATH => '/usr/local/i686-w64-mingw32/.'
my @pkgs = qw'

open my $sshfd, '-|', '/usr/bin/ssh', '-n', '', 'exec /home/cgf/bin/cygver', @pkgs;
mkdir '/tmp/mingw' or die "$0: couldn't mkdir /tmp/mingw64 - $!\n";
chdir '/tmp/mingw' or die "$0: couldn't cd to /tmp/mingw64 - $!\n";
while (<$sshfd>) {
    m%/mingw64% or die "$0: unrecognized output from ssh - $!\n";
    print basename($_), "\n";
    if (!fork) {
	open STDIN, '-|', '/usr/bin/ssh', '-n', '', "exec cat $_";
	exec '/usr/bin/tar', '-xjf', '-';
close $sshfd or die "$0: ssh terminated with non-zero status\n";
0 while wait > 0;
remove_tree(glob INSTALL_PATH . '/*');
system('/bin/mv', glob('usr/i686-w64-mingw32/sys-root/mingw/*'), INSTALL_PATH) == 0 or exit 1;
for my $host (qw'trixie cos') {
    system('rsync', '-a', '--partial', '--inplace', '--delete', '--force', INSTALL_PATH, "$host:" . INSTALL_PATH) == 0 or exit 1;

More information about the Cygwin-developers mailing list