Secretchronicles / TSC

An open source two-dimensional platform game.
https://secretchronicles.org/
GNU General Public License v3.0
205 stars 49 forks source link

How to override a dll on Windows #620

Closed hgdagon closed 6 years ago

hgdagon commented 6 years ago

So, I managed to build a Windows version on WSL. I used the info in Building.md, except I used the official MXE. Building MXE stuff took about 2 days. Now when I run the game, I get this error:

libpng warning: Application built with libpng-1.6.34 but running with 1.5.13 //This line is repeated multiple times, I'm assuming, for each PNG.
CEGUI::UnknownObjectException in function 'CEGUI::Image& CEGUI::ImageManager::get(const CEGUI::String&) const' (/home/George/mxe/tmp-cegui-i686-w64-mingw32.static/cegui-cegui-9726a2b505fb/cegui/src/ImageManager.cpp:261) : Image not defined: hud_itembox_item
Failed to load image "C:/Users/George/AppData/Roaming\tsc\cache\images\1024x768\pixmaps\alex\small\stand_left.png". Reason: Image not of any known type, or corrupt
Error loading image : C:\games\TSC\share\tsc\pixmaps\alex/small/stand_left.png

Error loading GL surface image
Failed to load image "C:/Users/George/AppData/Roaming\tsc\cache\images\1024x768\pixmaps\alex\small\stand_right.png". Reason: Image not of any known type, or corrupt

All the generated PNGs are corrupt. I tried building libpng and putting it next to the exe, but no dice, so I'm wondering how I can override it. Right now, I don't even know where it's getting the 1.5.13, I have 1.6.34 everywhere.

Quintus commented 6 years ago

First off: You're on a difficult quest, but we surely appreciate it!

Second off: This is not really a bug, but open discussion. You should not post such discussions in the GitHub tracker, which is for bugs and feature requests. Please use our tsc-devel mailinglist instead:

https://lists.secretchronicles.org/postorius/lists/tsc-devel.lists.secretchronicles.org/

The mailinglist has a web forum interface (thanks to shiny new Mailman 3) if you prefer: https://lists.secretchronicles.org/hyperkitty/list/tsc-devel@lists.secretchronicles.org/

Please report any problems with the ML setup here, though, the Mailman 3 upgrade was just recently done.

As for the actual problem, I can't say that I have a real idea about it. There's one thing that might kick in here, and that is that one of our dependencies’ dependencies (FreeImage) includes its own version of libpng which it builds and links statically if it doesn't detect one on the host. I vaguely remember having run into that when I fiddled with Windows building with MinGW some time ago. I was not able to get FreeImage to recognise the MinGW-provided libpng, it absolutely insisted on its own static version. When CEGUI then pulled in the dynamic version from the build system, two libpngs were linked into the executable, which resulted in fairly mysterious errors.

The workaround I found back then is to not use FreeImage on Windows. CEGUI can be used with an alternate image codec library, namely DevIL. Try uninstalling FreeImage, install DevIL instead, then rebuild CEGUI, maybe with explicit options on the image renderer. Then try again.

This mess of dependencies is why I have decided to not go with CEGUI anymore in the future. Getting the interdependencies of dependencies right is so difficult currently that the only sensible solution is to refrain from use of CEGUI with its confusing dependency management.

We are very sorry for the dependency mess, and one of the important goals for TSC3 is to sort that out.

It shouldn't take 2 days of compile time to compile TSC's dependencies, though. You know you can pass a -j option to make to instruct it to compile multiple objects at once? Specifically for MXE, you can adjust MXE's config to do so as well; just take a look at its main Makefile. They have a variable JOBS for that if I remember correctly.

-- Blog: https://mg.guelker.eu PGP/GPG ID: F1D8799FBCC8BC4F

hgdagon commented 6 years ago

I'll use the mailinglist next time. In the meantime, I think, I think I'll go back to figuring out CMake/msys2/SFML shenanigans. I'll be posting to #224 if I get anywhere. Thanks for the reply.