DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.87k stars 475 forks source link

Compile.rst: The Windows handling has changed... #1480

Open PatrikLundell opened 4 years ago

PatrikLundell commented 4 years ago

I read the document at the address "https://dfhack.readthedocs.io/en/stable/docs/Compile.html", which I hope contains the current version.

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:

MSBuild.exe

to get the value of VCTargetsPath:

The system cannot find the file specified

: 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.

BenLubar commented 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.

tigew commented 3 years ago

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)

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.