CvGameCoreDLL Build Error boost/python/list.hpp

Thanks for advice. I've switched to using git. I previously had an alphabet's worth of different working folders with my "little" log identifying what I'd changed per version and why.
I should be able to trim out some of those redundant folders now.
I'll start using git for xml and python when I get back to them.
 
Hi,

I'm still struggling to fix these Assert messages.
For example, I get an Assert error in relation to TECH_FESTIVALS,
Spoiler :

Assert Failed: Civ4BeyondSword.exe,
Assert Failed
File: .\.\CvXMLLoadUtilitySet.cpp
Line: 2040
Expression: false
Message Empty XML File (Civ4TechInfos/TechInfos/TechInfo), last Type loaded was TECH_FESTIVALS


The only references to TECH_FESTIVALS, that I can find in the sourcecode are in CvPlayerAI.cpp,
Spoiler :
Code:
/**       if (getCivilizationType() == GC.getDefineINT("CIVILIZATION_KHAZAD"))
       {
           int addGold=0;
           int iNumCities = getNumCities();
           if (isHasTech(GC.getDefineINT("TECH_TAXATION")))
           {
               addGold+=iNumCities*150;
           }
           if (isHasTech(GC.getDefineINT("TECH_WAY_OF_THE_EARTHMOTHER")))
           {
               addGold+=iNumCities*150;
           }
           if (isHasTech(GC.getDefineINT("TECH_FESTIVALS")))
           {
               addGold+=iNumCities*150;
           }

           iGold += addGold;
       }
       // Events
       if (GC.getGameINLINE().getGameTurn()>(iAdjustment))
       {
           iGold=std::max(iAdjustment,iGold);
       }**/
and in CvXMLLoadUtilitySet.cpp,
Spoiler :
Code:
/**   SetGlobalDefine("TECH_TAXATION", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("TECH_TAXATION", idx);

      SetGlobalDefine("TECH_WAY_OF_THE_EARTHMOTHER", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("TECH_WAY_OF_THE_EARTHMOTHER", idx);

      SetGlobalDefine("TECH_FESTIVALS", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("TECH_FESTIVALS", idx);

      SetGlobalDefine("PYRE_ZOMBIE_UNIT", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("PYRE_ZOMBIE_UNIT", idx);

      SetGlobalDefine("UNIT_PRIEST_OF_LEAVES", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("UNIT_PRIEST_OF_LEAVES", idx);

     SetGlobalDefine("UNIT_FIREBALL", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("UNIT_FIREBALL", idx);

      SetGlobalDefine("UNITCLASS_FREAK", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("UNITCLASS_FREAK", idx);

      SetGlobalDefine("UNITCLASS_SCOUT", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("UNITCLASS_SCOUT", idx);

      SetGlobalDefine("UNITCLASS_VAMP", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("UNITCLASS_VAMP", idx);

     SetGlobalDefine("UNITCLASS_VAMPLORD", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("UNITCLASS_VAMPLORD", idx);

      SetGlobalDefine("UNITCLASS_GOVANNON", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("UNITCLASS_GOVANNON", idx);

      SetGlobalDefine("UNITCLASS_LOKI", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("UNITCLASS_LOKI", idx);

      SetGlobalDefine("UNITCLASS_RANTINE", szVal);
        idx = FindInInfoClass(szVal);
        GC.getDefinesVarSystem()->SetValue("UNITCLASS_RANTINE", idx);**/

Both of these references to TECH_FESTIVALS have now been commented out. What would cause an assert message in relation to TECH_FESTIVALS now? TECH_FESTIVALS is the last entry in the CIV4TechInfos.xml. I had previously left it in as removing it resulted in error messages when loading the mod (presumably because the DLL was expecting to find it. I had previously, similarly left TAXATION, WAY OF EARTH MOTHER, LOKI, RANTINE, etc, in their xml files due to such error messages. I expect that I'll be able to finish purging them from the xml, once I've satisfactorily purged them from the DLL).

1) Does this example Assert error relate to TECH_FESTIVALS at all, or is it just that TECH_FESTIVALS is being mentioned as it was the last TECH in the CIV4TechInfos.xml file?
2) If it does not relate to TECH_FESTIVALS, does it relate to something else associated with CIV4TechInfos.xml or does it mean that DLL was okay with essentially all of the xml from CIV4TechInfos.xml but has an issue with the next XML file that it tried to use?

I've similar Assert errors referring to the last entry in other xml files as last Type loaded.
In cases, where the referenced xml item is not the last in the file, does it indicate that the issue is where some part of the DLL is trying to reference that xml item or the next one?
 
Last edited:
1) [...] is it just that TECH_FESTIVALS is being mentioned as it was the last TECH in the CIV4TechInfos.xml file? [...] I've similar Assert errors referring to the last entry in other xml files as last Type loaded.
That seems likely to me. As far as I can tell, the code you quoted from CvXMLLoadUtility::SetPostGlobalsGlobalDefines won't call CvXMLLoadUtility::SetGlobalClassInfo (where the assertion is). And, as for CvPlayerAI, XML loading should be through before any AI code is executed.
If it does not relate to TECH_FESTIVALS, does it relate to something else associated with CIV4TechInfos.xml or does it mean that DLL was okay with essentially all of the xml from CIV4TechInfos.xml but has an issue with the next XML file that it tried to use?
One would have to understand the XML loading code by Xienwolf better to answer this. Maybe the error checking code itself is incorrect.

If I had to get to the bottom of this, I'd attach the debugger to see who is calling SetGlobalClassInfo, what the value of szTagName is and what happens after the assertion.
 
Message Empty XML File (Civ4TechInfos/TechInfos/TechInfo), last Type loaded was TECH_FESTIVALS
Looking up the code in question:
PHP:
if (!SkipToNextVal())    // skip to the next non-comment node
{
    sprintf(szLog, "Empty XML File (%s), last Type loaded was %s", szTagName, mszLastType.GetCString());
    FAssertMsg(false, szLog);
    break;
}
A friendly person likely gave you the answer in the comments. There is a vanilla bug, which seems to be present here too. If the last entry is a comment, then the game will assert or even crash. The code is fine, just remove the comments you have after TECH_FESTIVALS (which is most likely the last entry in the file)
To put the problem into plain English: the code skips past comment xml nodes and then it lacks code to handle the case where the next non-comment node doesn't exist.

EDIT: actually the bug has been fixed here. It just stops reading the file when it runs out of nodes. However it does give you an assert failure because it's not a good xml file. It will likely work though. Vanilla would have crashed if this happened.
 
To put the problem into plain English: the code skips past comment xml nodes and then it lacks code to handle the case where the next non-comment node doesn't exist.

Each man creates his own heaven and his own hell. I'd been commenting out the legacy Master of Mana entries that I am not currently planning to use, rather than deleting them. I've tidied all of the comments out of my files, where an xml entry is expected and this has successfully removed all of the 2040 errors.
I've also fixed the 2364 errors. This was down to two xml files, where I had commented out all of the information, so they were essentially just empty shells. I've added a single entry back into both of them and that resolved that one.

I have still to deal with the 4662 errors. The code relating to this is from CvGlobals.cpp
Spoiler :
Code:
    if(!hideAssert)
   {
       CvString szError;
       szError.Format("info type %s not found, Current XML file is: %s", szType, GC.getCurrentXMLFile().GetCString());
       bool bError=strcmp(szType, "NONE")==0 || strcmp(szType, "")==0;
       FAssertMsg(strcmp(szType, "NONE")==0 || strcmp(szType, "")==0, szError.c_str());
       //only log if we do not have NONE or ""
       if(!bError)
       {
           gDLL->logMsg("xml.log", szError);
       }
   }
The clue here would appear to the, //only log if we do not have NONE or "". The error messages reference specific Infotypes. On searching for the first couple, I found typos in references, where I'd used a space instead of underline. Fixing these managed to remove two of the 4662 errors. I'll go through the rest of the referenced modular xml files to see if I can track down further typos. Some of the error messages indicate that unusual symbols (e.g. male symbol and female symbol) are used within the xml. Is that something anyone has encountered before?

Edit: All 4662 errors now resolved with exception of those featuring unusual symbols and three mentioning PLOT_PEAK, PLOT_LAND and PLOT_OCEAN. I'm attaching snips showing some examples of these error messages.

There are a few xml error messages that I'm getting
Spoiler :

XML Load Error
Failed Loading XML file xml\Terrain/Civ4TerrainClassInfos.xml.
XML Load Error
LoadXML call failed for Terrain/Civ4TerrainClassInfos.xml.
XML Load Error
Failed Loading XML file xml\Terrain/Civ4FeatureClassInfos.xml
XML Load Error
LoadXML failed for Terrain/Civ4FeatureClassInfos.xml
XML Load Error
Failed Loading XML file xml\Terrain/Civ4PlaneInfos.xml
XML Load Error
LoadXML call failed for Terrain/Civ4PlaneInfos.xml
XML Load Error
Failed Loading XML file xml\Terrain/Civ4DungeonEventInfos.xml
XML Load Error
LoadXML call failed for Terrain/Civ4DungeonEventInfos.xml


Having looked and failed to find these xml myself anywhere, I think that they're legacy errors in the sourcecode and I plan to do the following edits in CvXMLLoadUtilitySet.cpp
Spoiler :
Code:
// LPlate, commenting out next line. I can not find TerrainClassInfos anywhere
//   LoadGlobalClassInfo(GC.getTerrainClassInfo(), "Civ4TerrainClassInfos", "Terrain", "Civ4TerrainClassInfos/TerrainClassInfos/TerrainClassInfo", false);
// LPlate end edit

// LPlate, commenting out next line. I can not find FeatureClassInfos anywhere
//   LoadGlobalClassInfo(GC.getFeatureClassInfo(), "Civ4FeatureClassInfos", "Terrain", "Civ4FeatureClassInfos/FeatureClassInfos/FeatureClassInfo", false);
// LPlate end edit

// LPlate, commenting out next line. I can not find PlaneInfos anywhere
//   LoadGlobalClassInfo(GC.getPlaneInfo(), "Civ4PlaneInfos", "Terrain", "Civ4PlaneInfos/PlaneInfos/PlaneInfo", false);
// LPlate end edit

and in CyGlobalContextInterface4.cpp
Spoiler :
Code:
// LPlate, commenting out next line. I can not find DungeonEventInfos anywhere
//       .def("getNumDungeonEventInfos", &CyGlobalContext::getNumDungeonEventInfos, "() - Total Dungeon Infos XML\\Terrain\\CIV4DungeonEventInfos.xml")
// LPlate end edit

// LPlate, commenting out next line. I can not find PlaneInfos anywhere
//       .def("getPlaneInfo", &CyGlobalContext::getPlaneInfo, python::return_value_policy<python::reference_existing_object>(), "(LairResultID) - CvInfo for PlaneID")
// LPlate end edit
// LPlate, $TerrainClass$ in next two lines amended to $Terrain$
//       .def("getNumTerrainClassInfos", &CyGlobalContext::getNumTerrainClassInfos, "() - Total TerrainClass Infos XML\\Units\\CIV4TerrainClassInfos.xml")
//       .def("getTerrainClassInfo", &CyGlobalContext::getTerrainClassInfo, python::return_value_policy<python::reference_existing_object>(), "(TerrainClassID) - CvInfo for TerrainClassID")
       .def("getNumTerrainInfos", &CyGlobalContext::getNumTerrainInfos, "() - Total TerrainClass Infos XML\\Units\\CIV4TerrainInfos.xml")
       .def("getTerrainInfo", &CyGlobalContext::getTerrainInfo, python::return_value_policy<python::reference_existing_object>(), "(TerrainID) - CvInfo for TerrainID")
// LPlate end edit
// LPlate, $FeatureClass$ in next two lines amended to $Feature$
//       .def("getNumFeatureClassInfos", &CyGlobalContext::getNumFeatureClassInfos, "() - Total FeatureClass Infos XML\\Units\\CIV4FeatureClassInfos.xml")
//       .def("getFeatureClassInfo", &CyGlobalContext::getFeatureClassInfo, python::return_value_policy<python::reference_existing_object>(), "(FeatureClassID) - CvInfo for FeatureClassID")
       .def("getNumFeatureInfos", &CyGlobalContext::getNumFeatureInfos, "() - Total Feature Infos XML\\Units\\CIV4FeatureInfos.xml")
       .def("getFeatureInfo", &CyGlobalContext::getFeatureInfo, python::return_value_policy<python::reference_existing_object>(), "(FeatureID) - CvInfo for FeatureID")
// LPlate end edit

I previously made these edits but they are not in my current sourcecode. I have not recompiled to this yet as VS 2010 Express is demanding that I register but clicking on "Obtain a registration key online" is leading to an error message screen.
Is it probable that rather than commenting out Civ4PlaneInfos lines, I should be amending them to point to CIV4WaterPlaneInfos?

If the above fixes are correct, it seems kind of interesting that messages I've seen that appear as XML Load Error require a fix in the sourcecode and the messages that appeared as Assert Failed required a fix in the xml.

---
SymbolError1.PNG
SymbolError2.PNG
SymbolError3.PNG
SymbolError4.PNG
PlotError.PNG
 
Last edited:
I have still to deal with the 4662 errors. The code relating to this is from CvGlobals.cpp
I hate that part of the vanilla code. It tells that it failed to read a certain tag from xml, but it doesn't tell which one. You have to use a debugger and go back in the call stack to see where it's called from and look at the Type string to figure out which entry you messed up.

Yes it's possible to greatly improve the error messages and while I have started doing so, it takes forever to implement because it requires code changes for every single tag. The biggest time consumer is to verify nothing broke during the reading code rewrite. It's far too attractive to not touch working code and only implement such an improvement in new code.

Having looked and failed to find these xml myself anywhere, I think that they're legacy errors in the sourcecode and I plan to do the following edits in CvXMLLoadUtilitySet.cpp
That would severely break the game. You just tell the game to not read the xml files causing errors, meaning your game will be without terrains and stuff.

I have not compiled to test this fix yet as VS 2010 Express is demanding that I register but clicking on "Obtain a registration key online" is leading to an error message screen.
If Microsoft closed the 2010 registration, then you would have to install a newer version. Don't uninstall 2010 though because you need the files to be present on the HD.
 
Back again.

Firstly a post in the microsoft site referred me to https://my.visualstudio.com/Downloads?q=express 2010&pgroup= to get Visual Studio 2010 VC Express.
I downloaded it from there and it provides the key on that website also. There's also VB (Basic) and VCS (C Sharp) Visual Studio versions there but VC is the one I needed.

Struggled away with my mod and managed to get rid of some of the assert errors but did not manage to get the code fully functioning. I decided (hoped) it would be easier to take a more basic sourcecode as my starting point and add the functionality I wanted to it, rather than trying to trim out unwanted functionality from a modmod.

When I try to recompile either the BtS sourcecode or the FFH sourcecode (starting with the BtS sourcecode and then copying over the files that the FFH team had modified), I still get errors when loading BtS or FFH regarding PLOT_PEAK, PLOT_LAND and PLOT_OCEAN with the recompiled DLL. Snips of these error messages are attached. I had similar errors (amongst others) when using my MoM based DLL.

I got those errors for BtS when I compile using all of the cpp, h and inl files.
I also get them if I remove the CvTextScreens.cpp and resource.h files prior to compilation.

This is about as basic a build as I can do, so where am I going wrong?

Has any one else had these PLOT_PEAK, PLOT_LAND or PLOT_OCEAN errors before?
Any suggestions as to how I should resolve them?
I don't suppose the fact that I've a Steam installation is relevant?
 

Attachments

  • PLOT_LAND Error BtS.PNG
    PLOT_LAND Error BtS.PNG
    30.8 KB · Views: 123
  • PLOT_PEAK Error BtS.PNG
    PLOT_PEAK Error BtS.PNG
    11.4 KB · Views: 114
  • PLOT_OCEAN Error BtS.PNG
    PLOT_OCEAN Error BtS.PNG
    31 KB · Views: 130
  • PLOT_LAND Error BtS.PNG
    PLOT_LAND Error BtS.PNG
    30.8 KB · Views: 116
I've gotten these failed assertions as well with K-Mod. My hypothesis is (or used to be) that they're caused by BUG, but I've never run BUG with a debug DLL to verify this and I haven't been able to track down the call location. (I'm attaching a screenshot of the call stack.) None of the getInfoTypeForString calls in BUG's Python code look like they're responsible for this. It's also possible that the assertion fails even with the original BtS assets (not sure if you've tested that) and that the calls come from the EXE. (Edit: Upon re-examining the call stack, it seems pretty clear that the calls come from the EXE; but the cause could still be modified Python/XML.)

K-Mod disables the assertion; the errors are still written to xml.log. In my mod, I've re-enabled it and added a call to CvGlobals::getTypesEnum as a fall-back measure. PlotTypes isn't an info type – there is no CvPlotInfo class –, but it's an enum type, so, whoever the caller is, it seems likely that a call to getTypesEnum was intended. That said, it doesn't seem to make any difference which value is returned (BtS/K-Mod just return -1 when the assertion triggers).

K-Mod code

My code 1 2 3

Edit (Feb 2021): I think I've gotten to the bottom of this issue – by deliberately crashing the DLL as described here. On my end, the Eyeball map script that I had kept in my BtS PublicMaps folder was responsible; and I suspect that this was also the cause for LPlate2 – because he's the author of that script.
 

Attachments

  • assert-call-stack.jpg
    assert-call-stack.jpg
    278.1 KB · Views: 124
Last edited:
I don't suppose the fact that I've a Steam installation is relevant?
I highly recommend using steamless to disable the steam drm. Steam has an anti-cheat feature, which automatically crashes a game if used with free money/wallhack/reveal map/whatever cheat. The problem is that it detects the debugger as a cheat because the debugger attaches itself to the game in the same way as a cheat and can view and alter the memory.

However the steam drm have nothing to do with assert failures. Those are bugs in the mod. Assert failures can be anything from severe to a non-issue or even a faulty check meaning the bug is an assert failure when nothing is wrong.
 
Looking back its now 2 years since I as first able to edit the DLL. Generally, its gone well. However, I recently had to do a reinstall of Civ and am rebuilding my mod.

I've managed to do a compile again and can load and run a recompiled mod from BtS.
What I can not do is run a mod with, "Start Debugging".

I presume its because I haven't got the Microsoft Visual Project setup to reference where the mod is to kick it off. How do I configure it so allow me to use, Start Debugging?

Edit: So I selected Class View and then Project/Properties and then selected Debugging on the CIV4DLL Property Pages popup window. Based on @Nightingale's https://forums.civfanatics.com/threads/new-makefile-faster-compilation-profiling-and-more.499166/ I set the Command, Command arguments and Working Directory. When I hit Start Debugging, the message I get is "This project is out of date: CIV4DLL - Debug Win32 Would you like to rebuild it?" Selecting the Yes option results in the following error,
Spoiler :

1>------ Build started: Project: Civ4DLL, Configuration: Debug Win32 ------
1>NMAKE : fatal error U1073: don't know how to make 'source_list'
1> Stop.
1>NMAKE : fatal error U1073: don't know how to make 'fastdep'
1> Stop.
1>NMAKE : fatal error U1073: don't know how to make 'dll'
1> Stop.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "set TARGET=Debug
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: nmake source_list /NOLOGO
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: nmake fastdep /NOLOGO
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: nmake dll /NOLOGO" exited with code 2.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Any suggestions?
 

Attachments

  • DebuggingProperties.PNG
    DebuggingProperties.PNG
    81.1 KB · Views: 35
Last edited:
And if you tell it not to rebuild and to start debugging no matter what? I get that popup too (and then another) if I use Expert mode, but I can still debug if I ignore it. That said, if I do choose rebuild, that goes through without errors too. Does a regular build via F7 succeed (with the Debug configuration selected)? I don't get any popup in Basic mode (which is what I normally use; the switch is under Tools -> Settings); it might be that I've checked "don't show this dialog again" at some point and don't remember anymore.

I suppose Nightinggale's project files (and yours, more importantly) still have two debug configurations (one with jom parallelization, one without)? That would also be something to watch out for. Perhaps best to configure the proper debugging command for both of them.
 
That was the answer. Just ignore the problem. I get two error messages.
This project is out of date:
CIV4DLL - Debug Win32
Would you like to build it?
I responded No to this.

Debugging information for 'CIV4BeyondSword.exe' cannot be found or does not match. Cannot find or open the PDB file
Do you want to continue debugging?
I responded Yes to this.

This launches the mod correctly so I can get back to DLL modding. Thanks.
 
Top Bottom