开发者

Building Cairo for Windows with MinGW (Problems linking libpng)

I'm trying to build cairo on Windows using MinGW (and MSYS). I am following the instrucions on Compiling GTK+ 2.16.4 for Windows, except that I'm using the latest versions whenever possible, i.e:

  • zlib-1.2.3
  • libpng-1.2.42
  • pixman-0.17.4
  • cairo-1.8.8

This works pretty well up until when I try to build the actual cairo. The configuration succeeds, but during make cairo seems to have problems linking to my build of libpng. After a little while I get a long list of errors such as this:

.libs/cairo-png.o: In function `png_simple_error_callback':
/home/user/cairo-1.8.8/src/cairo-png.c:95: undefined reference to `png_get_error_ptr'
.libs/cairo-png.o: In function `png_simple_warning_callback':
/home/user/cairo-1.8.8/src/cairo-png.c:112: undefined reference to `png_get_error_ptr'

...

.libs/cairo-png.o: In function `stream_read_func':
/home/user/cairo-1.8.8/src/cairo-png.c:686: undefined reference to `png_error'
collect2: ld returned 1 exit status
make[3]: *** [libcairo.la] Error 1
make[3]: Leaving directory `/home/开发者_Python百科user/cairo-1.8.8/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/user/cairo-1.8.8/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/user/cairo-1.8.8'
make: *** [all] Error 2

I have tried using an older version of libpng (1.2.40, the version being distributed by The GTK+ Project), with the same result. When I run "pkg-config -cflags -libs libpng" I get "-IC:/MinGW/include/libpng12 -LC:/MinGW/lib -lpng12", which seems correct. I'm sure I'm making some stupid mistake, but I cannot tell what it is.


Apparently this is a known issue. I don't know how managed to miss it, given that it is even mentioned in the blog that I was following (I think it's safe to assume that this also applies to Windows 7, given that I tried the third suggestion and it fixed my problem):

Now, let's install MinGW. Note that MinGW doesn't run smoothly on Windows Vista because of weird filesystem restrictions. The workaround is

  • to install MinGW on FAT filesystem,
  • to work in the safe mode, or
  • to use MinGW Portable which is said to be working well.


I noticed that 'libpng12.dll.a' was much too small (<1kb).

It is so due to incorrect symbols in libpng.vers (symbols have extra _ at beginning). After libpng build I removed extra _ and recreated libpng12.dll.a manually - size is OK now. But... The correct import library doesn't resolve your (and my) problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜