[cairo] cairo compiles on win32 (cygwin)

Richard Worth richard at theworths.org
Thu Jan 22 22:11:52 PST 2004


With the latest --disable-xlib configure flag and a few fixes (now 
committed to cvs) cairo can be compiled for win32 using cygwin.

Two main fixes
1) I removed the 'extern ' and ' __external_linkage' (guarded 
win32/cygwin macro which added __declspec(dllexport) or 
__declspec(dllimport)) from function declarations in cairo.h and 
pixman.h. From what I can tell, these used to be necessary for building 
shared libraries for win32, but are no longer.
2) I added the libtool flag '-no-undefined' to the libcairo_la_LDFLAGS 
(cairo/src/Makefile.am) and libpixman_la_LDFLAGS 
(libpixman/src/Makefile.am). From GNU Autotools book 
(http://sources.redhat.com/autobook/autobook/autobook_88.html#SEC88)

`-no-undefined'
     Modern architectures allow us to create shared libraries with 
undefined symbols, provided those symbols are resolved (usually by the 
executable which loads the library) at runtime. Unfortunately, there are 
some architectures (notably AIX and Windows) which require that all 
symbols are resolved when the library is linked. If you know that your 
library has no unresolved symbols at link time, then adding this option 
tells libtool that it will be able to build a shared library, even on 
architectures which have this requirement.

Thanks to Harold Hunt (cygwin/x) for help on that second one.

Once I got cairo compiled, I started experimenting with the 
'-mno-cygwin' flag for building libraries that are built only on top of 
win32 libraries (msvcrt.dll, KERNEL32.dll, etc.), with no dependence on 
cygwin1.dll. The only way I can get this to work right now is to cut out 
all the FontConfig and FreeType stuff by hand. Short-term it might be 
nice to have an option to disable FontConfig when compiling for win32 
(no-cygwin). Similar to --disable-xlib. Long-term it would be nice to 
have a selectable native font selection system for win32. I'll probably 
continue to work on that. If anyone has any ideas or suggested 
direction, please let me know.

- Richard D. Worth
richard at theworths.org






More information about the cairo mailing list