-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
better build instructions on windows #348
Comments
As far as I know there is a free version of Visual Studio. I am not aware that anybody tried to compile it on Windows with anything else than a version of Visual Studio. So that means you have to create that manual. For Windows, if you want to use something like autogen.sh, I would convert it to a bat file. It should be just replacing the ending. And then you have to install the Windows versions of the programs it calls. I assume that those don't care using Linux style file paths as everything else I know of on Windows. I am not sure about the comment character in a bat file, and whether there is also an echo command. But in principle you could just get rid of those. On Linux I use KDevelop for CTP2, basically it uses make for building. I cannot say much about QT Creator, even so I have it installed. |
"you have to install the Windows versions of the programs it calls" So I downloaded automake because that's what came up for aclocal, but how do I use aclocal? It's not a windows executable. These are the kinds of things I was speaking about when I said there are no windows build instructions. It isn't self evident what I'm supposed to do exactly. (I did download visual studio. But I'm stuck on autogen.sh) Some of the other files have .m4 extensions that seem to be able to run when I run m4 .m4 but I'm at a complete loss as to how to use aclocal. It would be nice if there WAS a batch file but if not I'm okay with trying to figure it out but I would appreciate your graciousassistance =D |
I found this: https://apolyton.net/forum/other-games/call-to-power-2/ctp2-source-code-project/116862-compile-getting-the-source-to-compile it pointed me in the direction of a .dsw file |
I found this too (which I see you commented on, so maybe these are more fruitful instructions) |
according to what I read. I shouldn't need to download any directx related stuff with the advent of later versions of dx. I did have to download the win10 sdk as it threw an error, but once past that and auto overwriting the the other dsw files. It generates these errors |
omg I got somewhere I downloaded mingw-get-setup (msys) and ran and finished the first step! |
If you go for Visual Studio, you don't have to care about aclocal and autogen.sh. The instructions for getting it to work under Windows, which is however not Windows 10 are in https://github.com/civctp2/civctp2/blob/master/Apolyton%20CTP2%20Source%20Code_Readme.txt. However this file is a bit outdated. For instance you need only the Win10 sdk. And you don't need the .dsw file, which is the project file for Visual Studio 6, current versions of Visual Studio save the project in a .sln files. Just double click on it and Visual Studio should open the project. |
I've read that file. omg I feel like an idiot. There is a sln file! although I will say this. Looks like I've made progress in cygwin (after installing msys) |
I guess I didn't do this step, "Since DirectX Media SDK has been integrated into DirectX you do not need to download it separately. Newer versions of the DirectX SDK available from Microsoft at:" I misread it saying I didn't need to as dx is included with w10 but I can't seem to find those folders it wants me to include. So I'm dl'ing the sdk |
I am not sure where you are now in this list. And keep in mind I don't follow these instructions too often, ether.
You only need Include and Lib, the stuff from Samples has been removed from the SDK and wasn't actually used, it was just included.
That's obsolete.
You must do this.
And also this.
I assume you have done this. Bit unrelated, what is DevStudio. Well, for the rest VS2019 may still refuse to compile something, usually when I upgraded from one version to another there was always some stuff that did not compile, but that can also be fixed. I only used VS2017, even so I have VS2019 installed. |
argh... it built but throws an error. I"ll have to give it another shot tomorrow. I'm not sure I copied the folders over correctly. I assumed the linux instructions but then saw I needed to copy ctp2_code next to ctp2_data. Which means I might have done some unnecessary steps, but I did notice that if I didn't copy the rest of the files in the same folder as the produced executable into ctp2_program\ctp then the executable would cry about missing dll's |
No, as developer you don't copy any files around, that might only be necessary if you want to distribute the files, and in fact I wouldn't copy around any files, you run CTP2 from Visual Studio. It is either in the Build or Debug menu. The keyboard shortcut should be F5. The only files you have to copy are those from the original game. Everything that is not in the ctp2_data folder from the CD must go in. Basically copy everything over it and if it asks whether to overwrite any files, say no. And also the same for the ctp2_program folder, even so the couterpart folder is ctp2_code. |
That is not a very specific message. Except that you built the Release version instead of the Final version. However, if you want to know where it breaks then you have to build the debug version. And run it with the debugger. First start with the debugger takes some time. In fact that is a very odd memory address. So the best is to see the code where it fails. |
i'm trying a lot of things and they're all ending in some sort of error. |
As I said you should run CTP2 from Visual Studio, that is the easiest thing. Then make sure whatever file you have in the ctp2_program/ctp/ directory and is not in the ctp2_code/ctp/ directory anyway, is copied to the ctp2_code/ctp/ directory. That includes the mss32.dll. Probably not all files in in the ctp2_program/ctp/ directory are needed, but this way the instruction is simpler. And also make Windows Explorer show the file extensions, this way you may confuse civapp.cpp and civapp.h. |
Why are you trying to run a .dll file on its own. It's a program library, and is used by a program such as ctp2.exe or CivCTP_dbg.exe.
Don't run the debug build from outside, it is a debug build. It is supposed to run on the debugger, so that if you get a problem it can show you the exact line of code where it fails. You start the debugger from the Debug menu in Visual Studio. Or either with shift F5 or just F5, but that's also in the Debug menu. That's something I would have to look up, but right now I am using Linux, so I cannot check it.
Yes, and that it is exactly were it is supposed to be, I just didn't care about fixing the warnings and after all these are just warnings so you can ignore them to some point. |
"similar issues when i copy the .dll to where it wants it Why are you trying to run a .dll file on its own. It's a program library, and is used by a program such as ctp2.exe or CivCTP_dbg.exe." I'm not. I'm not sure how you read me "copying the dll to where it wants to be" as me running it. the debug version of the app is looking for the dll. Normally if you copy the dll to the same folder as the executable, it helps (else you need the dll in a path environment variable). I was simply stating that copying the dll to the same folder as the executable when I RUN DEBUG mode from Visual Studio (yes I'm doing the shift F5 option) for ctp2.exe (albeit it's something like ctp2dbg.exe). It reports an error about not finding crater.dll |
My guess is you think I was trying to start the crater app from Visual Studio. I simply let the build finish from the visual studio solution and chose "Debug Start Debugging". I then realized that maybe what you meant is I somehow had "crater" selected as opposed to ctp2. So I tried some things. Selecting ctp2 in the right hand "solution explorer" didn't make a difference as to whether or not I got the same error about crater, but I did change the scope and tried to rerun with debug mode and got this error Maybe if you had a video showing how the build process worked. That would make more sense. Or... if it would help. I could give you RDP access to the Virtual Machine that I have hosted to build this. I'm finding it very frustrating that a self explanatory build has so far been anything but in terms of getting it to run with out of the box configs. I feel like you think its something simple that hasn't been communicated, and I certainly hope that's the case, but whatever it is I think a video recording of the build process (at least the start, and end portions) would alleviate a lot of the miscommunication. |
You gave a screenshot with Crater.dll in \ctp2_code\mapgen\Crater_0. Then you said this: "It looks like it build crater.dll in C:\Users\user\civctp2\ctp2_code\ctp\dll\map". The best interpretation is that the second "it" refers to Visual Studio and "build" should either "builds" or "built". Then we have "It looks like", which doesn't really make sense here, because either Crater.dll is there or not and thus this phrase is best ignored. And then you said: "similar issues when i copy the .dll to where it wants it". Again the it could be Visual Studio or the game executable. The game wants it in \ctp2_code\ctp\dll\map, that's what I know. So I assume "it" refers to Visual Studio. From all that information you gave, the story is something like this: Visual Studio built Crater.dll in \ctp2_code\ctp\dll\map and you moved it to \ctp2_code\mapgen\Crater_0. Then I assumed that you just tried to run it by double clicking on it, and that was then the error. At least the part about building and moving the file is right. About running it well, that was indeed Visual Studio. In fact, you have to set ctp2 as the start project. I am not sure whether you did that. To do this you have to go to the Solution Explorer sub-window, right click on ctp2 and "set as start project" or whatever Microsoft went for that in the English version. When I try to compile it the linker still gives me these warnings:
This shouldn't be there, at least I fixed that for Visual Studio 2017. In fact, this could make Visual Studio look for the executable in C:\Activision\CivCTP2\ctp2_code\ctp.\Debug\ctp2.exe instead of C:\Activision\CivCTP2\ctp2_code\ctp\CivCTP_dbg.exe. This is of course a problem, however I don't have this. But I used also the copy that is working with Visual Studio 2017, so Visual Studio 2019 may have taken something from there. Of course, this copy has also everything in place. Which means I have to check it on a fresh copy and see. However, if everything is in place then starting the game from \ctp2_code\ctp\CivCTP_dbg.exe or \ctp2_code\ctp\ctp2.exe, should just work. |
These are indeed a problem if you want to run it from VS. For some reasons these settings are in \ctp2_code\ctp\civctp.vcxproj.user, even so it should be in \ctp2_code\ctp\civctp.vcxproj looks like Microsoft screwed up something. For now you can put this into your
With this Visual Studio should run the game. For a fresh install I had only copy mss32.dll from /ctp_program/ctp/ to /ctp_code/ctp/. If you also want your settings and savegames you need also usercritmsgs.txt, userkeymap.txt, userprofile.txt, and the save folder. With that the final version runs, but not the debug version, it tells me that my graphics card needs to support 16 color mode, which it should support since the final version works. |
Okay. Rather than a video. I'll try with screenshots (explanation of screenshot is BELOW each screenshot) Set civctp2 as startup project Set library folders (c:\program files (x86)\Microsoft DirectX SDK (June 2010)\Lib) under "VC++ Directories" Project Properties Set include folders (C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include) under "C/C++" Project Properties Click Apply - Ok Build - Build Solution Build Log (https://pastebin.com/tg2N6jWJ) Build - Start Debugging Asks for mss32.dll, let's grab that and copy it to C:\Users\user\civctp2\ctp2_code\ctp Build - Start Debugging Hey, a breakpoint! Now let's try to copy the rest of the files over "/ctp_program/ctp/ to /ctp_code/ctp/"
Correction: CivCTP_dbg.exe has triggered a breakpoint. |
I don't get that, I get this error with the debug version:
And then it crashes. However if I rename the exe from CivCTP_dbg.exe to CivCTP_dbg2.exe, it starts without problems. If I rename the parent folder from C:\Activision\CTP2new\ to C:\Activision\CTP2newd\ (I just added a 'd') it also starts fine. That's a kind of crap you don't really expect to happen. And actually, I wanted to do something else than this. |
What is that, why does it need to load your antivirus? That's really wired, but let's hope it's unrelated. |
I think this is not necessary anymore, at least I cannot any modified paths at these locations. |
Okay. I had to create the logs folder, but when I did I got the icon for once with the message about video resolution. I'm running inside a vm with limited 3d support. So I'm wondering if that message is related (but you said you got the same). I can setup gpu passthrough but idk if that's going to fix the 3d issue. Ignoring message results in the following crash (assertion error) Start without debugging (retry on error) |
Take your time. No rush. I am greatful for the help. I would like to get to modding in aom and cradle but all my tools for modding are in windows (like ctp2edit). I could mod it in linux and use different tools. But I know for wide spread dissemination I need windows (and I think the sound will be easier on windows, but idk. That's a whole other issue once I get it to compile) |
About the DirectX error, read #348 (comment). It is now a bit burried. For the modding tools, check out the ModTools folder in the project. I put there what I could scrap from my hard drive, however it does not include ctp2edit. SpriteEdit, ReadZFS, and TileEdit should work with Wine on Linux. I am not really sure weather they work on Windows 10. |
#348 looks like it errors on line 165 whereas mine is erroring on line 57 (even with the 2 appended) |
No it is the same, check out \ctp2_code\ctp\logs\civ3log000.txt. First comes the message and then the stack trace of that assetion falure. I would assume that your final version should at least load. In fact, that is a thing with drove me quite crazy. Why the hell was it working fine in my original working copy, but not with the fresh install. So I copied around the executables. And at some point it was that. Could you check what happens if the you rename the containing folder? |
Hi team, The Visual studio solution has many configurations: Debug, Debug Browse, Final, Final with logging, Leaks, NDebug, Optimized Test, Release, Test. Are they all used? What do they do? |
No, we use Debug, Final, and Final with logging. Debug is there for debugging, using the debugger, generating debug logs and reporting leaks. Reporting leaks is what it makes it slow. So if you are only interested in the logs use Final with logging. And Final is the version from that all the releases where compiled. |
Well, I linked this to #349 and thus this issue was closed, when I merged #349. In principle, I can reopen this, however this issue is basically stalled. I think the problem is with the virtual machine and the virtual graphics card. Since this issue is stalled I leave it closed we still have two other issues with better build instructions open. So feel free to open a new issue, if needed. |
I don't have visual studio, but rather qt creator and/or gnu g++
but even if I did. There isn't a project file and the autogen.sh doesn't exactly work on windows (i tried to get it to work in cygwin).
In other words. Is there a good build doc for building this in windows. I got it to build just fine in linux, but I can't on windows.
Thanks in advance
The text was updated successfully, but these errors were encountered: