Reputation: 2314
We're developing a quite large Qt-based project on linux, and we reached final RC1 stage.
Now, we encountered something really strange: in order to go into production, we added another .a library in our list of static linking libs.
The library is linked and the application runs, but every .png in the resource file is corrupted, here's the output on startup:
libpng error: IHDR: CRC error
seems like libpng cant handle those invalid png (of course). The files are there and the size is right, they just turned blank after static linking that final library. The library itself is not used anywhere, it is just linked.
Has anyone encountered such a situation before? is there a known workaround? We're using Qt 4.7.4 x64 on QtCreator 2.3.0, we would like not to upgrade for now, but it is the only option that comes into our mind for now.
Upvotes: 3
Views: 1007
Reputation: 2669
It could fit a problem with symbols. The static library and libpng could be at same time linking to other library and when linking or resolving in compile/load time something weird is happening.
You can use objdump command to inspect symbols (objdump -tT /usr/bin)
Have you tried modifying the library order when compiling/linking? I mean, for example,
gcc -lmylibrary -lQt -lOtherLOLibrary
instead of
gcc -lOtherLOLibrary -lQt -lmylibrary
And I think I'm missing something, why do you link against an unused library?
Upvotes: 4