Open PatrikLundell opened 4 years ago
Hmm, I'm investigating this on a VM and I got this so far:
LINK : fatal error LNK1181: cannot open input file 'kernel32.lib' [C:\Users\IEUser\dfhack\build\win64\VC2015\CMakeFiles\3.16.2\CompilerIdCXX\CompilerIdCXX.vcxproj]
it looks like the VC2015 build tools installer doesn't install the Windows SDK by default, which is super weird. either that, or we need both the 8.1 and 10 SDKs. strangely, selecting the windows 8.1 SDK claims it will add 20 megabytes of files to the disk, which is extremely small compared to the 3 gigabytes that the Windows 10 SDK claims to need.
After way way too much testing I was able to get to the barebones of what VS needed to compile from the community installer. (I was unable to use the build tools installer linked in the manual)
C# and Visual Roslyn compilers
(Needed for MSBuild)MSBuild
Visual Studio C++ core features
(everything else is needed to build)Windows Universal CRT SDK
Windows XP support for C++
Windows 10 SDK (10.0.14393.0)
VC++ 2015.3 v14.00 (v140) toolset for desktop
I was able to find this by cmake to get the correct W10 SDK.
I was never able to get it to compile from the cmd line just generate the solution and compile from Visual Studio itself.
Only other steps I took where to was to add MSBuild to path because that wasn't getting picked up correctly and I used winget
instead of chocolatey
to install all other dependencies and I had to use cpan
to install the perl libraries as they were not picked up with strawberry perl
until I did so.
I read the document at the address "https://dfhack.readthedocs.io/en/stable/docs/Compile.html", which I hope contains the current version.
MSVC is a different issue, though. Things have changed since I installed it the last time, and apparently XP support has been removed since then. I first tried 2017, and it didn't work, then 2015, and it didn't work. Removed everything and installed 2015 (and SDK too, for good measure) since that's what works on the old computer. The first problem is with\build\win64\generate-MSVC-gui.bat, which claims there is no C or CC compiler. Eventually I tried to see if MSVC could make sense of \build\win64\VC2015\CMakeFiles\3.16.2\VCTargetsPath.vcxproj (because the error messages seemed to be caused by two programs down here not compiling, among red herring messages of missing registry keys that don't exist on the old system either). MSVC then claimed XP support was needed, and offered to install it (which I accepted). I have no idea how you can get the original install to install that part. After that those programs compiled and the ...-gui bat file worked as expected.
However, Microsoft must have made other changes as well, possibly with default switches, because trying to compile DFHack both through MSVC itself (using the generated .sln file), and through build-debug.bat results in a massive warning and error output. As far as I can see, there seems to be two different warnings (237 in total) of the type:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (compiling source file C:\dfhack\depends\protobuf\google\protobuf\descriptor.pb.cc) [C:\dfhack\build\win64\VC2015\depends\protobuf\protobuf.vcxproj]
and
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc (compiling source file C:\dfhack\depends\protobuf\google\protobuf\io\gzip_stream.cc) [C:\dfhack\build\win64\VC2015\depends\protobuf\protobuf.vcxproj]
with the error messages (7 of them) of the type:
C:\dfhack\library\modules\Gui.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj [C:\dfhack\build\win64\VC2015\library\dfhack.vcxproj]
Edit: Forgot to mention it, but the new processor is an AMD while the old one is an Intel. That shouldn't make a difference, but it's still something that differs.
Since it didn't work properly, I uninstalled everything and tried to install MSVC 2017 and a fresh DFHack download. My 2017 selection was desktop development, a tick in a box to the side for XP C++ support, and a package for 2015.3 support. That did not work, as the -gui bat file produced this when run in a Powershell window: : C:\dfhack\build\win64\VC2015>cmake ...... -G"Visual Studio 14 Win64" -T v140_xp -DCMAKE_INSTALL_PREFIX="C:\Games\Dwarf Fortress\DF_44_12" -- Selecting Windows SDK version to target Windows 10.0.18363. CMake Error at CMakeLists.txt:22 (project): Failed to run MSBuild command:
to get the value of VCTargetsPath:
: I suspect this is because it tries to select MSVC 2015 with "Visual Studio 14 Win64", and that isn't installed when 2017 is installed, at least not via my guesses about what's needed to be installed...
Next attempt was to install MSVC 2015 after 2017, and this time with a custom contents selection. XP C++ support was found under the C++ selection, but in the end I just selected everything in order not to miss out on something obscure that might be needed. This was actually successful, as build-debug.bat succeeded with its building mission, so something apart from XP support was obviously needed. I took a chance with dfhack.sln and started it with 2017 (since it's installed anyway), and that succeeded without any failures. My guess is that 2015 alone with all extras works (though it's not one of the approaches I've tried), and that 2017 on top of that works as well. It may well be that 2017 alone would work if you knew what packages and package sub options you needed, but for that to be recommended there would have to be a description of which packages you need.