English 中文(简体)
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/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.





相关问题
Elegant way building url request with parameters

There must me a more elegant way to build a URL with parameters in .NET then for example Response.Write("<a href=HeadOfMarketView.aspx"+Session["HOM"] != null ? Session["HOM"]+">Head of Market&...

buildforge problem

when i tried to run the job i am getting the error saying that No server could be found matching all conditions please any one help me on this

您能否防止MSBuild.exe经营活动?

我用文字建造一些项目,偶尔利用习俗制造事件,给建筑系统造成了很大困难。 如果有可能,我想援引MSBuild.exe。

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Keyboard shortcut to build only startup project?

I ve tried to find a keyboard shortcut to build only the startup project In VS2008. I only found a configurable shortcut to build the project which is currently viewed, which isn t as good. Any ...

Dependency bundle (jar-files/sources/API docs) in Eclipse

I m developing various in-house extensions for JIRA, the issue tracker we use. So far I worked with Netbeans and everything worked like a charm. However, now I need to switch to Eclipse and I m ...

How to link to a static library in C?

I use code::blocks to compile my static library. The output result is a libstatic.a file. Now, how do I link to my library to use functions that were compiled? (I tried to use #include "libstatic.a"...

热门标签