Andrettin / Wyrmsun

Strategy game based on history, mythology and fiction
http://andrettin.github.io/
GNU General Public License v2.0
307 stars 48 forks source link

Unable to run 4.1.1 #182

Closed AMDmi3 closed 3 years ago

AMDmi3 commented 3 years ago

I'm working on update of FreeBSD wyrmgus/wyrmsun ports from 3.5.4 to the latest version. 4.1.1 with both wyrmgus and wyrmsun installed systemwide fails like this:

% wyrmgus -d /usr/local/share/wyrmsun
Invalid font instance: "small".
Failed to load defines.
Error loading defines.

One of previous versions complained at missing .qml file, could it be that some other file are missing? FreeBSD 12.2 amd64, qt 5.15.2.

Andrettin commented 3 years ago

The error message is indicative that the small.txt file here is missing: https://github.com/Andrettin/Wyrmsun/tree/master/data/fonts

Since the defines are being loaded, the "data" folder as a whole cannot be missing, as they are located in data/defines.txt.

The main "fonts" folder is missing from the directory list, but the files there are not used yet, so this shouldn't make any difference.

The "data/fonts" subfolder which seems to be missing has the exact same name, though, so I wonder if there is somehow an interconnection between the two. Either way, I added the "fonts" main folder to CMakeLists.txt now:

https://github.com/Andrettin/Wyrmsun/commit/c3d822e9b7b89e8132b71cecd41edb0f3e8c9674

AMDmi3 commented 3 years ago

The data/fonts/small.txt is installed fine. Here's a complete package contents for wyrmsun: https://paste.ubuntu.com/p/vb9VKkc3V2/. Could it be that it's incorrectly accessed via a relative path?

c3d822e

This doesn't fix the error and looks bogus.

AMDmi3 commented 3 years ago

And judging by ktrace, it doesn't even try to access small.txt anywhere at all.

Andrettin commented 3 years ago

There was relative folder issue previously, but that has since been fixed. And both the loading of the defines.txt and of the contents of the "data" folder use the same root folder.

The contents of the "data" folder could be loaded dynamically, but if the classes which use database features aren't initialized properly then that won't work. Perhaps that's what we are seeing here, as I had a similar issue in the past, for which I had to add special code for GCC (in database/data_type.h):

#ifdef __GNUC__
    //the "used" attribute is needed under GCC, or else this variable will be optimized away (even in debug builds)
    static inline bool class_initialized [[gnu::used]] = data_type::initialize_class();
#else
    static inline bool class_initialized = data_type::initialize_class();
#endif
AMDmi3 commented 3 years ago

Confirmed. Seems like gnu::used does not work with clang, although llvm claims to support gnu attributes. I was able to fix it this way: Andrettin/Wyrmgus#159

Andrettin commented 3 years ago

Thank you for the fix!