Skip to content

[Help Request] How to build with VS2022 Build Tools only and what is the minimum required components for the project to successfully compile? #30

@vavavr00m

Description

@vavavr00m

OS: Windows 11 Pro

I cobbled up a batch script that generates the key automatically last year and it still works as of today, however, with the xz utils incident several months ago, I wanna be on the safe side and have the script eventually be able to build the KG from source automatically without installing the entire Visual Studio. I'm no developer, just casually learning how to write batch script; it's a bit of a struggle for me to figure it out.

  1. Downloaded source zip and extracted to C:

  2. Downloaded hMSBuild.bat and moved it to C:\Windows

  3. Installed VS2022 Build Tools along + some per this issue for it to stop throwing an error "vcpkg install error:in triplet x64-windows: Unable to find a valid Visual Studio instance Could not locate a complete Visual Studio instance"

> winget install Microsoft.VisualStudio.2022.BuildTools --silent --override "--wait --quiet --add ProductLang En-us --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.Windows11SDK --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended"
  1. Rebooted

  2. Installed git

  3. Installed vcpkg

> git clone https://github.com/microsoft/vcpkg
> .\vcpkg\bootstrap-vcpkg.bat
  1. Installed mpir
.\vcpkg\vcpkg install mpir --triplet=x64-windows
  1. Not sure what this does but ran it anyway
> vcpkg integrate install
  1. Go to the extracted files
> cd C:\winrar-keygen-master
  1. Ran:
> hmsbuild winrar-keygen.sln

Build fails. See log below. What am I doing wrong? How can I simplify the process and ensure that only the necessary stuff are installed?

hMSBuild: "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe"
MSBuild version 17.10.4+10fbfbf2e for .NET Framework
Build started 6/21/2024 12:16:07 PM.

Project "C:\winrar-keygen-master\winrar-keygen.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Debug|x64".
Project "C:\winrar-keygen-master\winrar-keygen.sln" (1) is building "C:\winrar-keygen-master\winrar-keygen.vcxproj" (2)
 on node 1 (default targets).
PrepareForBuild:
  Creating directory "C:\winrar-keygen-master\obj\x64-Debug\".
  Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://ak
  a.ms/cpp/structured-output for more details.
  Creating directory "C:\winrar-keygen-master\bin\x64-Debug\".
  Creating directory "C:\winrar-keygen-master\obj\x64-Debug\winrar-keygen.tlog\".
InitializeBuildStatus:
  Creating "C:\winrar-keygen-master\obj\x64-Debug\winrar-keygen.tlog\unsuccessfulbuild" because "AlwaysCreate" was spec
  ified.
  Touching "C:\winrar-keygen-master\obj\x64-Debug\winrar-keygen.tlog\unsuccessfulbuild".
VcpkgTripletSelection:
  Using triplet "x64-windows-static" from "C:\Users\0\vcpkg\installed\x64-windows-static\"
  Using normalized configuration "Debug"
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\CL.exe /c /I
  "C:\Users\0\vcpkg\installed\x64-windows-static\include" /ZI /JMC /nologo /W3 /WX- /diagnostics:column /sdl /Od /D _DE
  BUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /std
  :c++17 /permissive- /Fo"C:\winrar-keygen-master\obj\x64-Debug\\" /Fd"C:\winrar-keygen-master\obj\x64-Debug\vc143.pdb"
   /external:W3 /Gd /TP /FC /errorReport:queue /utf-8 _tmain.cpp
  _tmain.cpp
C:\winrar-keygen-master\BigInteger.hpp(4,10): error C1083: Cannot open include file: 'gmp.h': No such file or directory
 [C:\winrar-keygen-master\winrar-keygen.vcxproj]
  (compiling source file '_tmain.cpp')

Done Building Project "C:\winrar-keygen-master\winrar-keygen.vcxproj" (default targets) -- FAILED.

Done Building Project "C:\winrar-keygen-master\winrar-keygen.sln" (default targets) -- FAILED.


Build FAILED.

"C:\winrar-keygen-master\winrar-keygen.sln" (default target) (1) ->
"C:\winrar-keygen-master\winrar-keygen.vcxproj" (default target) (2) ->
(ClCompile target) ->
  C:\winrar-keygen-master\BigInteger.hpp(4,10): error C1083: Cannot open include file: 'gmp.h': No such file or directo
ry [C:\winrar-keygen-master\winrar-keygen.vcxproj]

    0 Warning(s)
    1 Error(s)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions