I was trying to configure cairo 1.12.16 with mingw64.
Note for information that it works well with the mingw version 2.22.90.20120919-0ubuntu1+2 installed with my linux Mint. But I wanted to test the last automatic build. So I downloaded mingw-w64-bin_x86_64-linux_20131004.tar.bz2 (last automatic build at time of writing).
Configure fails when it checks that the C compiler works, and fails to compile an utterly simple C program (a main() nearly empty). See attached config.log, lines 92 to 107.
I copied this basic code in a file conftest.c and tried basically the same command, using only include/ and lib/ from the automatic build.
I get:
$ /usr/local/mingw/bin/x86_64-w64-mingw32-gcc -I/usr/local/mingw/x86_64-w64-mingw32/include/ -L/usr/local/mingw/x86_64-w64-mingw32/lib conftest.c
/usr/local/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o: In function __mingw_prepare_except_for_msvcr80_and_higher':
/build/buildd/mingw-w64-2.0.3/build/x86_64-w64-mingw32/all/mingw-w64-crt/../../../../mingw-w64-crt/crt/crtexe.c:430: undefined reference to
__mingw_get_msvcrt_handle'
collect2: error: ld returned 1 exit status
To fix it, I copy over the old libmingw32.a and libmingwex.a:
cp /usr/x86_64-w64-mingw32/lib/libmingw32.a /usr/local/mingw/x86_64-w64-mingw32/lib/libmingw32.a
Then I get the same error as the config.log (why the config.log did not get the first error was simply because it was using a libmingw32.a from the Fedora mingw repository which was installed separately in my prefix):
$ /usr/local/mingw/bin/x86_64-w64-mingw32-gcc -I/usr/local/mingw/x86_64-w64-mingw32/include/ -L/usr/local/mingw/x86_64-w64-mingw32/lib conftest.c
/usr/local/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o: In function __mingw_prepare_except_for_msvcr80_and_higher':
/build/buildd/mingw-w64-2.0.3/build/x86_64-w64-mingw32/all/mingw-w64-crt/../../../../mingw-w64-crt/crt/crtexe.c:430: undefined reference to
__mingw_get_msvcrt_handle'
collect2: error: ld returned 1 exit status
This one was fixed with getting an older crt2.o
cp /usr/x86_64-w64-mingw32/lib/crt2.o /usr/local/mingw/x86_64-w64-mingw32/lib/crt2.o
Then the configure finally finishes without error, and I can compile cairo.
Looks like at least crt2.o and libmingw32.a have missing functions in the last automatic builds.
Oh actually small error in my report. I copied 2 times the same error. The second should actually be the one in the config.log. But it looks like even this one may be fixed just by using old libmingw32.a. So that's the only problem.
Correction to my correction of, after doing another configure today. No copying crt2.o from the older build is definitely necessary. I confirm the link fails without it.
So there are issues on at leact crt2.o and libmingw32.a.