Page 1 of 1

linking to ogre corrupts pngs

Posted: 2011-10-27T03:46:36-07:00
by wrex
I have a simple program:

Code: Select all

#include <Magick++.h>

int main(int argc, char *argv[])
{
  Magick::Image in;
  in.read("world.200408.3x5400x2700.png");
  return 0;
}
I can compile it fine with:

Code: Select all

c++ `Magick++-config --cxxflags --cppflags` -O2 -o ex ex.cc `Magick++-config --ldflags --libs` -lOgreMain
But when i run it i get "corrupt image `world.200408.3x5400x2700.png' @ error/png.c/ReadPNGImage/3101"

If i remove the link to OgreMain, it runs fine. Any idea what might be causing this?

Im running Ubuntu 10.10 with Magick++ 6.6.2 and Ogre 1.7.3 from the ogre team ppa.

UPDATE:

After running ldd on both libMagick++.so and libOgreMain.so, i noticed that ogre links to libfreeimage as well as a few other libs that magick doesnt use. It seems like linking to freeimage is what is causing the problems.

Code: Select all

c++ -O2 -o ex ex.cc -I/usr/include/ImageMagick -Bsymbolic -lMagick++ /usr/lib/libfreeimage.so.3
I still dont know how to fix this though :(