Overview

For instructions on building HTCondor with vs2008, see Building HTCondor with vs2008 on Windows.

For instructions on building HTCondor in releases prior to 8.8, see Building HTCondor prior to 8.8 on Windows.

For information about the conversion of the build process from project files to cmake see BuildModernization

Building HTCondor with cmake on Windows

These instructions are designed for building HTCondor 8.8 or later on Windows 10 64-bit with Visual Studio 2019.

Obtaining Windows

You can download Windows VMs directly from Microsoft's developer site. These are free and full-featured, however they expire after 90 days.

https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

Prerequisites

In order to build HTCondor on Windows, the following prerequisites are required. They need to be in the PATH before you can build. There is a batch file msconfig\set_build_env.bat in the HTCondor sources that will locate the installed prerequisites and set the PATH for you if you don't wish to add them to your global PATH.

  1. [Optional] Install 7-zip (64-bit). Add it to your PATH. 7-zip is not needed to build, but it is needed to make the HTCondor .ZIP file. You will not be able to build the PACKAGE target witout 7-zip.

  2. [Optional] Install git (64-bit) and add it to your PATH, git is one way to get the HTCondor sources. It is not needed if you already have the sources.
    • http://git-scm.com/download
    • You need to set a configuration option to preserve existing line endings. You can either do this during installation, or later by running from the command line:
      git config --global core.autocrlf false
      

  3. Install Active Perl: http://www.activestate.com/activeperl/downloads
    • Before downloading a binary, you need to configure your build. Open the Configuration tab and select all Win32 modules. Then go to the Download Builds tab to create the download.
    • Note that some of the default packages selected by ActivePerl are not supported. You'll need to go back to the Configuration tab to remove these.
    • During installation, select the options to add Perl to your PATH.
    • Open a Windows command prompt and run a Perl script without invoking the perl.exe. This will allow you to create a file association for .pl files.
    • Open the Windows Registry Editor. For the Computer\HKEY_CURRENT_USER\Software\Classes\Applications\perl.exe\shell\open\command key, set the default to: "C:\Perl64\bin\perl.exe" "%1" %*
    • Open a Windows command prompt as Administrator. Run the following command: assoc .pl=C:\Perl64\bin\perl.exe

  4. NOTE: Cmake is now bundled with Visual Studio. You don't need to install it separately anymore.

  5. Install Visual Studio 2019 Community Edition.
    • https://visualstudio.microsoft.com/vs/ (free for all non-enterprise users)
    • During the installation, under Workloads->Windows check Desktop Development with C++
    • Under the list of Optional components on the right side of the screen (where several items are already selected), check C++/CLI support.

  6. [Optional] Start Visual Studio and Open Tools->Options under "Projects and Solutions" click on VC++ Directories and add the following to the Executable directories. This is not needed if you use msconfig\set_build_env.bat to set the PATH before you build.
    • $(SolutionDir)\msconfig
    • Move $(PATH) to the bottom as sometimes C:\cygwin\bin is in the $(PATH) which can cause issues with HTCondor's bundled binaries.

  7. [Optional] Install Python 3.6 64-bit. This is needed to build and/or use the python bindings.
    • https://www.python.org/downloads/release/python-360/
    • The default installation directory is buried deep in your home directory. Recommend you install it to C:\Python36 instead.
    • Add the following environment variable: PYTHONPATH=C:\Python36;C:\Python36\DLLs;C:\scratch\condor\release_dir\lib\python

  8. [Optional] Install WiX 3.0 on your windows machine (Depends on Visual Studio). WiX is not needed to build, but it is needed to create the MSI installer.

Building

These instructions for building HTCondor from source all assume the following:

  1. Open the Developer Command Prompt for VS 2019. Note that using the regular command prompt has incorrect environment variables.

  2. Checkout origin/master from the git repository.
    • From AFS:
      git clone /p/condor/repository/CONDOR_SRC
      
    • From Github:
      git clone https://github.com/htcondor/htcondor
      

  3. Add the c:\scratch\condor\src\msconfig folder to your PATH.

  4. [Optional] If you want to use cached externals set the environment variable CONDOR_BLD_EXTERNAL_STAGE to the PATH of the externals cache. Using cached externals can save a lot of time if you plan to build HTCondor more than once. For example:
    set CONDOR_BLD_EXTERNAL_STAGE=c:\scratch\condor\externals
    

  5. Run cmake from your source folder.
    • For in-source builds:
      cd C:\scratch\condor\src
      cmake -G "Visual Studio 16 2019"
      
    • For out-of-source builds:
      mkdir C:\scratch\condor\src-build
      cd C:\scratch\condor\src-build
      cmake -G "Visual Studio 16 2019" C:\scratch\condor\src
      
    • This will create Visual Studio Project and Solution files to build HTCondor. Many options can be passed to cmake, see CondorCmakeBuildOptions for more information. You can also use the cmake-gui to set options.

  6. Now start the actual build, from whichever folder you ran cmake from:
    msbuild /m:4 /p:Configuration=RelWithDebInfo /fl1 ALL_BUILD.vcxproj
    
    • October 2019 update: This build step no longer works correctly. Something changed in the last few months when prevents our boost external from building correctly in Windows. This can be worked around by manually extracting the boost tarball downloaded from the internet and placing the extracted files in the correct place. For now check in with coatsworth@cs or johnkn@cs for the workaround, we'll update this page eventually if/when it gets fixed.

  7. Finally, install your compiled binaries to the release folder. There is a cmake file that will copy the build products to the correct subdirectories of a HTCondor installation. From your source folder, run:
    cmake -DBUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=c:\scratch\condor\release_dir -P cmake_install.cmake
    

Note - If the build fails, remove external and local build folders

Then start over. We don't recover well after a failed build.

Building Tests

Build the tests target in the Condor.sln Solution File. Once built you can run all the batch tests as before.

Note: Building the INSTALL target in the Condor.sln solution file invokes this cmake file. It will copy build results to $(SolutionDir)\release_dir

Making the MSI installer

The WiX programs are used to create the MSI installer. Before you can create the MSI, you must copy build results to a release directory. See above.

To build the MSI, make sure that WiX is in your PATH, then navigate to the release dir and run etc\WiX\do_wix.bat passing the path to the release dir and the name of the output MSI file as arguments. For example, if your release dir is c:\scratch\condor\release_dir you would execute

cd c:\scratch\condor\release_dir
etc\WiX\do_wix.bat %CD% c:\scratch\condor\Condor-X.Y.Z-winnt-x86.msi