1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

[TUTORIAL] Setting up the build environment for RaR on Win10

Discussion in 'Civ4Col - Religion and Revolution' started by ShadesOfTime, May 16, 2018.

  1. ShadesOfTime

    ShadesOfTime Chieftain

    Joined:
    May 3, 2012
    Messages:
    31
    Instructions for setting up the build environment for RaR on Win10
    update 2018-09-14

    If you are here because you want to play the mod with the latest, unofficial changes, first have a look here:
    https://forums.civfanatics.com/threads/latest-nightly-builds.636428/

    If you are here because you want to compile yourself, read on ...

    The steps for this tutorial were performed and tested on Windows 10 professional.


    Step 1:
    ----------------
    Download and extract the Microsoft Visual C++ Toolkit 2003 ...
    Spoiler :

    ... from here:
    http://www.mediafire.com/file/iyfcfdd8eezh01m

    You might need to install a 7z-extractor software to extract it. See here: https://www.7-zip.org/

    Step 2:
    ----------------
    Download and extract the appropriate WindowsSDK ...
    Spoiler :

    ...from here:
    http://www.mediafire.com/file/ilulm07imz9alnd

    Best is to put the folders of the extracted toolkit and the WindowsSDK in the same folder eg "RaR_build_tools/WindowsSDK" and "RaR_build_tools/MVC++Toolkit2003".

    Step 3:
    ----------------
    Download, mount and install the Visual Studio 2010 Express iso ...
    Spoiler :

    ... from here:
    https://sourceforge.net/projects/beyond-the-sword-sdk/files/VS2010Express1.iso/download

    - To mount the iso do rightClick>>Mount.
    - In the mounted directory double click "Setup.hta".
    - In the main setup menu click "Microsoft Visual Studio C++ Express"
    - In the next dialog steps you don't need to select to install "Microsoft Silverlight" or "Microsoft SQL Server 2008 Service Pack 1 (x64).

    Step 4:
    ----------------
    Have a installed copy of Civilization IV:Colonization that includes the civ4col source code.
    Spoiler :

    Users report that the Steam version of Civ4Col does not include the source code.

    Step 5:
    ----------------
    Download the RaR mod, source and project files
    Spoiler :

    ... from
    https://sourceforge.net/p/religion-and-revolution-git/code/ci/develop-2_7_1/tree/
    by clicking "Download Snapshot".

    Note that there are several options what to download. On the left side you can chose between several branches and tags. Those translate to the state the mod is in. Eg tag "2.7" translates to the release version 2.7. To get the latest bugfixes and commits you would have to select branch "develop-2_7_1" (as of 2018-09-11).

    Step 6:
    ----------------
    Install the RaR mod by putting it into the mod folder of Civilization IV:Colonization.
    Spoiler :

    On my installation this mod folder is "Documents\My Games\Sid Meier's Civilization IV Colonization\MODS".
    Copying the folder "Religion_and_Revolution" there will make the mod available in-game (In game: MainMenu>>Advanced>>Load a mod>>Religion and Revolution).

    Step 7:
    ----------------
    Load the solution.
    Spoiler :

    - Within the mods folder open the file "Project Files\RaR.sln". This will start Visual Studio and scan the whole project, which may take a while.

    Step 8:
    ----------------
    Configure the solution for compiling by providing the correct paths to makefile.
    Spoiler :

    - The RaR solution is configured to use a method called "makefile" to put everything together and compile it.
    - Makefile does not (always) like spaces in paths.
    - The correct paths are provided to makefile by editing "Project Files\Makefile.settings". Which is created the first time the solution is loaded. It does not exist in the project folder prior to that.
    - The paths are provided by assigning values to variables in "Makefile.settings".
    - The variables which must be set in "Makefile.settings", are these:

    -- CIV4_PATH ... The path to the folder "CvGameCoreDLL" within the installation folder of the game (not the mod).
    -- TOOLKIT ... The path to the folder of the Microsoft Visual C++ Toolkit 2003.
    -- PSDK ... The path to the folder of the WindowsSDK
    -- CC, CPP ... Both need the path to the preprocessor, which can be found within the Microsoft Visual C++ Toolkit 2003.
    -- LD ... The path to the linker, which also can be found within the Microsoft Visual C++ Toolkit 2003.

    On my installation the contents of "Makefile.settings" look like this:
    Spoiler :

    CIV4_PATH=C:\Program Files (x86)\2K Games\Firaxis Games\Sid Meier's Civilization IV Colonization\CvGameCoreDLL

    BUILD_TOOLS=C:\Users\xxx\Documents\civ4col.rar.development\build_environment
    TOOLKIT=$(BUILD_TOOLS)\Microsoft_Visual_C++_Toolkit_2003
    PSDK=$(BUILD_TOOLS)\WindowsSDK

    CC="$(TOOLKIT)\Bin\cl.exe"
    CPP="$(TOOLKIT)\Bin\cl.exe"
    LD="$(TOOLKIT)\Bin\link.exe"

    This might be confusing at first glance, but is easy to understand if explained.

    - CIV4_PATH=... Here the path to the folder "CvGameCoreDLL" is set. For reasons I don't know, makefile accepts this path with spaces in it. Luckily. In your installation this path most likely is exactly the same.

    - BUILD_TOOLS=... Here an additional variable is used to store the path to the folder where both the Toolkit and the SDK reside.
    - TOOLKIT=... and PSDK=... Here the variable BUILD_TOOLS is used to put together the paths for the variables TOOLKIT and PSDK.
    - In all 3 of the above makefile does not accept spaces, so I had to rename the folders to not contain any.
    - If I don't want to use the additional variable BUILD_TOOLS I could write the configuration like this also:
    Spoiler :

    CIV4_PATH=C:\Program Files (x86)\2K Games\Firaxis Games\Sid Meier's Civilization IV Colonization\CvGameCoreDLL

    TOOLKIT=C:\Users\xxx\Documents\civ4col.rar.development\build_environment\Microsoft_Visual_C++_Toolkit_2003
    PSDK=C:\Users\xxx\Documents\civ4col.rar.development\build_environment\WindowsSDK

    CC="$(TOOLKIT)\Bin\cl.exe"
    CPP="$(TOOLKIT)\Bin\cl.exe"
    LD="$(TOOLKIT)\Bin\link.exe"

    - CC=..., CPP=... and LD=... Here the variable TOOLKIT is used to put together the paths to the preprocessor and the linker.

    If you want to use the contents of this "Makefile.settings", you just need to provide the paths for CIV4_PATH, TOOLKIT and PSDK in any of the explained forms above (and remember the spaces).

    Note that the contents of "Makefile" might change in future versions of the project. So "Makefile.settings" might need an adaption in the future too. But this should not happen unless absolutely necessary. Have a look of the first part of "Makefile". It is pretty self explaining and it should get clearer why the paths are needed and how everything comes together.

    Step 9:
    ----------------
    Compile! (Finally)
    Spoiler :

    - In Visual Studio click Build>>Build Solution.

    The whole project will be compiled now. When the compilation is a success (the output window says something like "... Build: 1 succeeded ... "), the compiled file will be copied to the neccessary places automatically (into the folders "Assets" and "2 city plot" of the mod).

    You can start the game and load the freshly compiled mod now.

    Additional notes for beginner modders:
    ----------------------------------------------------------------
    Spoiler :

    If you want to make changes to the source code, always have a backup copy of the whole mod. If anything goes wrong you can just copy it over. If you want to get into modding hardcore you should sooner than later get accustomed to GIT and how it is used with the RaR project.

    Thanks to
    ----------------
    @devolution for this post: https://forums.civfanatics.com/thre...ild-environment-for-rar.632502/#post-15138038
    @Nightinggale for advice
    @Asaf for this thread: https://forums.civfanatics.com/threads/a-simple-guide-to-compiling-the-dll.405444/
     
    Last edited: Sep 14, 2018
  2. devolution

    devolution Chieftain

    Joined:
    Oct 7, 2016
    Messages:
    169
    Gender:
    Male
    Location:
    Stavanger, Norway
    Could you paste the (error) output / messages ?

    By the way, you have to switch to the correct branch (develop-2_7_1), the committ you are referring to is the last changeset in master.

    Edit:
    Why do you have:
    TOOLKIT=C:\Program Files\Microsoft Platform SDK 2003

    Surely it must be:
    TOOLKIT=$(PROGRAMFILES)\Microsoft Visual C++ Toolkit 2003

    The SDK is just lib and headers, not the compiler/linker binaries.

    Edit(again)
    I hope I didn't give you bad info, the SDK stuff is for getting Intel TBB to work I think, it is not necessary for compiling this branch. I guess there has been a mixup of terms (VS SDK vs. Platform SDK)

    After correcting this I think you'll be able to compile in no time :D
     
    Last edited: May 16, 2018
  3. Nightinggale

    Nightinggale Chieftain

    Joined:
    Feb 2, 2009
    Messages:
    3,807
    I spotted pretty much the same as what has already been mentioned. One thing I would like to add is that the idea is that whatever you put in Makefile.settings will overwrite the values in the makefile. This will allow everybody to use the same unmodified makefile and still allow each user to configure paths as needed. However failing to use Makefile.settings is not what is causing your problem. It's just a detail, yet a noteworthy one when multiple people work on the same source code.
     
  4. ShadesOfTime

    ShadesOfTime Chieftain

    Joined:
    May 3, 2012
    Messages:
    31
    hey guys,

    thanks for your answers.

    1.)
    Let's start here, maybe I installed the wrong kit after all. The kit I downloaded and installed is this one:
    https://www.microsoft.com/en-us/download/details.aspx?id=12261 .
    It would not let me install the 32-bit version, so I installed the 64-bit version. The 64-bit version goes to "C:\Program Files" on my rig, but $(PROGRAMFILES) resolves to "C:\Program Files (x86)". That is why I made this change in "Makefile".

    2.)
    I did so now ( at commit ed16b08d39e9593e5c1cd2cf2257682ed9ed58e1 , "GAME1: African slaves now have the same restrictions as native slaves with respect to allowed professions"), but get the same compile errors.

    3.)
    It starts with 20 of these (attribute not found):
    Code:
    Severity # Code # Description # Project # File # Line
    Error # C2337 # 'repeatable' : attribute not found; it is neither a built-in nor a custom attribute that is accessible in the current namespace # RaR # c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\CodeAnalysis\sourceannotations.h # 78	
    
    Then like 80 of these (syntax not understood) until it stops trying to compile:
    Code:
    Severity # Code # Description # Project # File # Line
    Error # C2059 # syntax error : '(' # RaR # C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ctype.h # 173	
    
    4.)
    Thanks for pointing that out. I was looking for a way of not tampering with Makefile.
     
  5. Nightinggale

    Nightinggale Chieftain

    Joined:
    Feb 2, 2009
    Messages:
    3,807
    This is really a red flag considering you can't compile. I wrote a 4 page wiki guide on how to compile Medieval Conquest for people who never compiled or used git before. You should take a look at the page Compiler setup. Note that you can skip the part about perl. I added that to M:C and it's not a requirement to RaR.
     
  6. ShadesOfTime

    ShadesOfTime Chieftain

    Joined:
    May 3, 2012
    Messages:
    31
    hi Nightinggale,

    thanks for your answer and your advice. So I had installed the wrong toolkit. No surprise, nothing worked.

    I went to the page you linked and followed the steps, but again I am stuck. I downloaded the "Microsoft Visual C++ Toolkit 2003" and tried to install it, but first I get 2 "failed to load resources from resource file. please check your setup" error messages followed by an InstallShield "error 1063: error installing .net framework". Then I uninstalled EVERYTHING I installed so far (all kits, all visual studios, ... which was quite a bit) but the error messages still pop up. Searching the web led me to believe, that these errors are caused by the C++ toolkit 2003 install program indefinitely trying to install the .net framework 1.1, which is prohibited on Win 10.

    See
    https://social.msdn.microsoft.com/F...from-resource-file?forum=winformsapplications
    and
    https://techjourney.net/install-mic...n-windows-10-8-7-vista-fix-regsvcs-exe-error/

    That is the state I am in at the moment. My next step will be to look into the .net 1.1 installation issue, hoping to be able to resolve the c++ toolkit 2003 installation errors.
     
  7. Nightinggale

    Nightinggale Chieftain

    Joined:
    Feb 2, 2009
    Messages:
    3,807
    Reason #417 to not install Windows 10.

    Have you considered using something like https://en.wikipedia.org/wiki/VirtualBox]VirtualBox? Just make it run XP or win7 and then use it when you want to compile. You don't have to use it to code or even debug. If you want a fancy setup, make visual studio connect to the virtual host and then use that one to build on a shared drive, meaning you can compile even without looking at the virtual machine manually.
     
  8. devolution

    devolution Chieftain

    Joined:
    Oct 7, 2016
    Messages:
    169
    Gender:
    Male
    Location:
    Stavanger, Norway
    I just installed the Civ4/Col compilation environment on a "clean" test machine running Windows 10 (don't ask me why I bother, I should start using wine again :/ )
    Following these instructions (https://forums.civfanatics.com/threads/a-simple-guide-to-compiling-the-dll.405444/), I downloaded and installed the 2003 toolkit as well as the SDK. I then downloaded Leoreth's VS2010 ISO and installed it.
    I then opened the RaR solution with VS2017 community edition and compiled without issues.

    I attempted to get the project to compile without VS2010, but alas it seems to be required (for now).

    Edit: More detailed/specific instructions:

    Download and extract:
    Microsoft Visual C++ Toolkit 2003 from
    http://www.mediafire.com/?iyfcfdd8eezh01m

    Do the same for:
    http://www.mediafire.com/?ilulm07imz9alnd

    Download, mount iso and install VS2003 from:
    https://sourceforge.net/projects/beyond-the-sword-sdk/files/VS2010Express1.iso/download

    Optional, but highly recommended:
    Download and install VS2017 from:
    https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15

    HTH
     
    Last edited: May 28, 2018
    ShadesOfTime likes this.
  9. devolution

    devolution Chieftain

    Joined:
    Oct 7, 2016
    Messages:
    169
    Gender:
    Male
    Location:
    Stavanger, Norway
    Anyone feel like stepping up and checking that my instructions are accurate :p ?
     
  10. ShadesOfTime

    ShadesOfTime Chieftain

    Joined:
    May 3, 2012
    Messages:
    31
    @devolution
    I followed your instructions and they worked for me. ' going to update the original post.
     
  11. albucc

    albucc Chieftain

    Joined:
    Dec 3, 2013
    Messages:
    53
    Location:
    São Paulo/Brazil
    It seems that the Steam Version of civ4col doesn't come with the CvGameCoreDLL folder... Does anyone knows another way to obtain it? Or maybe the Civ4 SDK is enough for this build?

    UPDATE: it seems so: this is my makefile.settings, and I've just compiled the dll successfully.


    CUSTOM_CFLAGS =
    CIV4_PATH=D:\users\civ4source\CvGameCoreDLL_v161\CvGameCoreDLL
    BUILD_TOOLS=D:\git\religion-and-revolution-git-code\build
    TOOLKIT=$(BUILD_TOOLS)\msvcppToolkit2003
    PSDK=$(BUILD_TOOLS)\WindowsSDK
    CC="$(TOOLKIT)\Bin\cl.exe"
    CPP="$(TOOLKIT)\Bin\cl.exe"
    LD="$(TOOLKIT)\Bin\link.exe"
     
    Last edited: Sep 14, 2018
  12. ShadesOfTime

    ShadesOfTime Chieftain

    Joined:
    May 3, 2012
    Messages:
    31
    hi albucc,

    thanks for your feedback. And sorry for this inconvenience and maybe a lost purchase. I am glad to read that you could compile eventually.

    May I ask how you got hold of your folder D.\users\civ4source\CVGameCoreDLL ?
    I will update the tutorial accordingly.
     
  13. albucc

    albucc Chieftain

    Joined:
    Dec 3, 2013
    Messages:
    53
    Location:
    São Paulo/Brazil
    In fact, I was able to compile the game successfully and I'm already playing it, thank you ! :) This civ4source folder is only a place where I put the Civilization IV sdk ("beyond the sword" level). I've checked that the makefile only gets the original folder for the boost and python libraries, and so would not need much else.

    I am detecting however, that turn processing is somewhat slower, though (compared to "stock" 2.7 version) ... I don't know if this is a 2.7.1 thing (maybe because of pathfinding fixes?), or because something is odd in the compilation. I've used the develop-2.7.1 branch (commit https://sourceforge.net/p/religion-.../ci/7ea6d29497652550cb15884adbaade8636b9cdd8/ ).
     
  14. ShadesOfTime

    ShadesOfTime Chieftain

    Joined:
    May 3, 2012
    Messages:
    31
    did the civ4 sdk come with the steam installation? I can not download it from the 2k website.
    http://www.2kgames.com/civ4/downloads.htm

    The commit you used to compile is the latest. Why it seems to be slower, I don't know. Maybe worth to follow this lead.
     
    Last edited: Sep 14, 2018
  15. albucc

    albucc Chieftain

    Joined:
    Dec 3, 2013
    Messages:
    53
    Location:
    São Paulo/Brazil

Share This Page

Ebates: Get Paid to Shop