MyGUI / mygui

Fast, flexible and simple GUI.
http://mygui.info/
Other
713 stars 205 forks source link

3.4.2 makes it impossible to link debug binary to non debug mygui library #266

Closed elsid closed 1 year ago

elsid commented 1 year ago

Also non debug binary to debug library. Debug or not is determited by presence or absence of -DNDEBUG in the compiler flags.

Basically the problem is in conditional MYGUI_DEBUG_MODE definition and how it's used that changed only in 3.4.2. There is a conditional definition of RenderManager::checkTexture function so if a binary compiled without -DNDEBUG then MYGUI_DEBUG_MODE is defined to 1 but if such binary is linked with mygui provided by system package manager, unlikely it will be built without -DNDEBUG so RenderManager::checkTexture is not defined. And this leads to a linker error:

mold: error: undefined symbol: ../../components/libcomponents.a(myguirendermanager.cpp.o): MyGUI::RenderManager::checkTexture(MyGUI::ITexture*)

This change in API broke openmw CI on update to 3.4.2 for debug builds because they don't use debug version of mygui. Related disscussion is here and here is the broken build example.

Ideal solution to this is to remove all conditional symbols definition in *.cpp files.

Altren commented 1 year ago

I agree, that this is not ok, I fixed two methods declarations under #if MYGUI_DEBUG_MODE == 1 What do you think about this lines in the MyGUI::RederItem class:

#if MYGUI_DEBUG_MODE == 1
        std::string mTextureName;
#endif
Altren commented 1 year ago

Nevermind, I removed this variable

psi29a commented 1 year ago

Worth a 3.4.2.1 or a 3.4.3? :P

Altren commented 1 year ago

Done