Error Building DGL with MS Build

Hi everyone, I’m currently trying to set up DGL on my Windows machine and am a bit stuck while trying to go through the installation guide here: Install and Setup — DGL 2.2.1 documentation

I am trying to setup the Windows CUDA Build and am going through the provided terminal commands in the installation guide. I am currently at this step:

msbuild dgl.sln /m

Once I run this command, the build fails and here is the output that I get:

PS C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build> msbuild dgl.sln /m
MSBuild version 17.7.2+d6990bcfa for .NET Framework
Build started 11/8/2024 5:02:56 PM.

     1>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.sln" on node 1 (default targets).
     1>ValidateSolutionConfiguration:
         Building solution configuration "Release|x64".
       ValidateProjects:
         The project "INSTALL" is not selected for building in solution configuration "Release|x64".
         The project "RUN_TESTS" is not selected for building in solution configuration "Release|x64".
         The project "dmlc_lint" is not selected for building in solution configuration "Release|x64".
     1>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.sln" (1) is building "C:\Users\Tim Pornyuenyong
       \PycharmProjects\dgl\build\ZERO_CHECK.vcxproj" (14) on node 2 (default targets).
    14>InitializeBuildStatus:
         Creating "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
         Touching "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
       CustomBuild:
         All outputs are up-to-date.
         1>Checking Build System
       FinalizeBuildStatus:
         Deleting file "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
         Touching "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
    14>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\ZERO_CHECK.vcxproj" (default targets)
       .
     1>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.sln" (1) is building "C:\Users\Tim Pornyuenyong
       \PycharmProjects\dgl\build\ALL_BUILD.vcxproj.metaproj" (2) on node 1 (default targets).
     2>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\ALL_BUILD.vcxproj.metaproj" (2) is building "C:\Use
       rs\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googletest\gtest.vcxproj.metaproj" (11) on
       node 1 (default targets).
    11>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googletest\gtest.vcxproj.met
       aproj" (11) is building "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googletest\g
       test.vcxproj" (15) on node 2 (default targets).
    15>InitializeBuildStatus:
         Creating "gtest.dir\Release\gtest.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
         Touching "gtest.dir\Release\gtest.tlog\unsuccessfulbuild".
       CustomBuild:
         All outputs are up-to-date.
       ClCompile:
         All outputs are up-to-date.
       Lib:
         All outputs are up-to-date.
         gtest.vcxproj -> C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\lib\Release\gtest.lib
       FinalizeBuildStatus:
         Deleting file "gtest.dir\Release\gtest.tlog\unsuccessfulbuild".
         Touching "gtest.dir\Release\gtest.tlog\gtest.lastbuildstate".
    15>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googletest\gte
       st.vcxproj" (default targets).
     2>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\ALL_BUILD.vcxproj.metaproj" (2) is building "C:\Use
       rs\Tim Pornyuenyong\PycharmProjects\dgl\build\graphbolt.vcxproj.metaproj" (10) on node 1 (default targets).
    10>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\graphbolt.vcxproj.metaproj" (10) is building "C:\Us
       ers\Tim Pornyuenyong\PycharmProjects\dgl\build\graphbolt.vcxproj" (16) on node 3 (default targets).
    16>InitializeBuildStatus:
         Touching "x64\Release\graphbolt\graphbolt.tlog\unsuccessfulbuild".
     2>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\ALL_BUILD.vcxproj.metaproj" (2) is building "C:\Use
       rs\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googlemock\gmock_main.vcxproj.metaproj" (9)
        on node 1 (default targets).
     9>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googlemock\gmock_main.vcxpro
       j.metaproj" (9) is building "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googlemo
       ck\gmock_main.vcxproj" (17) on node 4 (default targets).
    17>InitializeBuildStatus:
         Creating "gmock_main.dir\Release\gmock_main.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
         Touching "gmock_main.dir\Release\gmock_main.tlog\unsuccessfulbuild".
     2>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\ALL_BUILD.vcxproj.metaproj" (2) is building "C:\Use
       rs\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googlemock\gmock.vcxproj.metaproj" (8) on n
       ode 1 (default targets).
     8>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googlemock\gmock.vcxproj.met
       aproj" (8) is building "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googlemock\gm
       ock.vcxproj" (18) on node 5 (default targets).
    18>InitializeBuildStatus:
         Creating "gmock.dir\Release\gmock.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
         Touching "gmock.dir\Release\gmock.tlog\unsuccessfulbuild".
    17>CustomBuild:
         All outputs are up-to-date.
    18>CustomBuild:
         All outputs are up-to-date.
     2>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\ALL_BUILD.vcxproj.metaproj" (2) is building "C:\Use
       rs\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.vcxproj.metaproj" (3) on node 1 (default targets).
     3>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.vcxproj.metaproj" (3) is building "C:\Users\Tim
        Pornyuenyong\PycharmProjects\dgl\build\tensoradapter_pytorch.vcxproj.metaproj" (6) on node 1 (default targets).
     6>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\tensoradapter_pytorch.vcxproj.metaproj" (6) is buil
       ding "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\tensoradapter_pytorch.vcxproj" (19) on node 6 (default
        targets).
    19>InitializeBuildStatus:
         Touching "x64\Release\tensoradapter_pytorch\tensorad.1E7EDC17.tlog\unsuccessfulbuild".
    17>ClCompile:
         All outputs are up-to-date.
    18>ClCompile:
         All outputs are up-to-date.
    17>Lib:
         All outputs are up-to-date.
         gmock_main.vcxproj -> C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\lib\Release\gmock_main.lib
    18>Lib:
         All outputs are up-to-date.
         gmock.vcxproj -> C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\lib\Release\gmock.lib
     3>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.vcxproj.metaproj" (3) is building "C:\Users\Tim
        Pornyuenyong\PycharmProjects\dgl\build\third_party\dmlc-core\dmlc.vcxproj.metaproj" (4) on node 1 (default targ
       ets).
     4>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\dmlc-core\dmlc.vcxproj.metaproj" (4) is
        building "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\dmlc-core\dmlc.vcxproj" (20) on node
       1 (default targets).
    20>InitializeBuildStatus:
         Creating "dmlc.dir\Release\dmlc.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
         Touching "dmlc.dir\Release\dmlc.tlog\unsuccessfulbuild".
    17>FinalizeBuildStatus:
         Deleting file "gmock_main.dir\Release\gmock_main.tlog\unsuccessfulbuild".
         Touching "gmock_main.dir\Release\gmock_main.tlog\gmock_main.lastbuildstate".
    17>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googlemock\gmo
       ck_main.vcxproj" (default targets).
    20>CustomBuild:
         All outputs are up-to-date.
    18>FinalizeBuildStatus:
         Deleting file "gmock.dir\Release\gmock.tlog\unsuccessfulbuild".
         Touching "gmock.dir\Release\gmock.tlog\gmock.lastbuildstate".
    18>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googlemock\gmo
       ck.vcxproj" (default targets).
    20>ClCompile:
         All outputs are up-to-date.
     3>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.vcxproj.metaproj" (3) is building "C:\Users\Tim
        Pornyuenyong\PycharmProjects\dgl\build\gpu_cache.vcxproj.metaproj" (5) on node 1 (default targets).
     5>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\gpu_cache.vcxproj.metaproj" (5) is building "C:\Use
       rs\Tim Pornyuenyong\PycharmProjects\dgl\build\gpu_cache.vcxproj" (21) on node 7 (default targets).
    21>InitializeBuildStatus:
         Creating "gpu_cache.dir\Release\gpu_cache.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
         Touching "gpu_cache.dir\Release\gpu_cache.tlog\unsuccessfulbuild".
    20>Lib:
         All outputs are up-to-date.
         dmlc.vcxproj -> C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\dmlc-core\Release\dmlc.lib
    21>CustomBuild:
         All outputs are up-to-date.
    16>CustomBuild:
         no such file or directory
    20>FinalizeBuildStatus:
         Deleting file "dmlc.dir\Release\dmlc.tlog\unsuccessfulbuild".
         Touching "dmlc.dir\Release\dmlc.tlog\dmlc.lastbuildstate".
    19>CustomBuild:
         no such file or directory
    20>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\dmlc-core\dmlc.vcxproj" (
       default targets).
    11>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googletest\gte
       st.vcxproj.metaproj" (default targets).
     9>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googlemock\gmo
       ck_main.vcxproj.metaproj" (default targets).
     8>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googlemock\gmo
       ck.vcxproj.metaproj" (default targets).
     4>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\dmlc-core\dmlc.vcxproj.me
       taproj" (default targets).
    16>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(24
       9,5): error MSB8066: Custom build for 'C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\CMakeFiles\c74c446c0a
       08ce396c81567973709089\graphbolt.rule;C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\CMakeLists.txt' exited with
       code 1. [C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\graphbolt.vcxproj]
    19>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(24
       9,5): error MSB8066: Custom build for 'C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\CMakeFiles\c74c446c0a
       08ce396c81567973709089\tensoradapter_pytorch.rule;C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\CMakeLists.txt'
       exited with code 1. [C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\tensoradapter_pytorch.vcxproj]
    16>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\graphbolt.vcxproj" (default targets)
       -- FAILED.
    10>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\graphbolt.vcxproj.metaproj" (default
       targets) -- FAILED.
    19>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\tensoradapter_pytorch.vcxproj" (defau
       lt targets) -- FAILED.
     6>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\tensoradapter_pytorch.vcxproj.metapro
       j" (default targets) -- FAILED.
     2>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\ALL_BUILD.vcxproj.metaproj" (2) is building "C:\Use
       rs\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googletest\gtest_main.vcxproj.metaproj" (12
       ) on node 1 (default targets).
    12>Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googletest\gtest_main.vcxpro
       j.metaproj" (12) is building "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googlet
       est\gtest_main.vcxproj" (22) on node 4 (default targets).
    22>InitializeBuildStatus:
         Creating "gtest_main.dir\Release\gtest_main.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
         Touching "gtest_main.dir\Release\gtest_main.tlog\unsuccessfulbuild".
       CustomBuild:
         All outputs are up-to-date.
       ClCompile:
         All outputs are up-to-date.
       Lib:
         All outputs are up-to-date.
         gtest_main.vcxproj -> C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\lib\Release\gtest_main.lib
       FinalizeBuildStatus:
         Deleting file "gtest_main.dir\Release\gtest_main.tlog\unsuccessfulbuild".
         Touching "gtest_main.dir\Release\gtest_main.tlog\gtest_main.lastbuildstate".
    22>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googletest\gte
       st_main.vcxproj" (default targets).
    12>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\third_party\googletest\googletest\gte
       st_main.vcxproj.metaproj" (default targets).
    21>CustomBuild:
         Building NVCC (Device) object CMakeFiles/gpu_cache.dir/third_party/HugeCTR/gpu_cache/src/Release/gpu_cache_gen
         erated_nv_gpu_cache.cu.obj
         nv_gpu_cache.cu
         nv_gpu_cache.cu
         tmpxft_00006e4c_00000000-10_nv_gpu_cache.compute_90.cudafe1.cpp
         Building Custom Rule C:/Users/Tim Pornyuenyong/PycharmProjects/dgl/CMakeLists.txt
       Lib:
         C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\Lib.exe /OUT
         :"C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\Release\gpu_cache.lib" /NOLOGO /MACHINE:X64  /machine:x6
         4 "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\CMakeFiles\gpu_cache.dir\third_party\HugeCTR\gpu_cache\
         src\Release\gpu_cache_generated_nv_gpu_cache.cu.obj"
         gpu_cache.vcxproj -> C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\Release\gpu_cache.lib
       FinalizeBuildStatus:
         Deleting file "gpu_cache.dir\Release\gpu_cache.tlog\unsuccessfulbuild".
         Touching "gpu_cache.dir\Release\gpu_cache.tlog\gpu_cache.lastbuildstate".
    21>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\gpu_cache.vcxproj" (default targets).
     5>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\gpu_cache.vcxproj.metaproj" (default
       targets).
     3>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.vcxproj.metaproj" (default target
       s) -- FAILED.
     2>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\ALL_BUILD.vcxproj.metaproj" (default
       targets) -- FAILED.
     1>Done Building Project "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.sln" (default targets) -- FAILED.

Build FAILED.

       "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.sln" (default target) (1) ->
       "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\ALL_BUILD.vcxproj.metaproj" (default target) (2) ->
       "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\graphbolt.vcxproj.metaproj" (default target) (10) ->
       "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\graphbolt.vcxproj" (default target) (16) ->
       (CustomBuild target) ->
         C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(
       249,5): error MSB8066: Custom build for 'C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\CMakeFiles\c74c446c
       0a08ce396c81567973709089\graphbolt.rule;C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\CMakeLists.txt' exited wit
       h code 1. [C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\graphbolt.vcxproj]


       "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.sln" (default target) (1) ->
       "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\ALL_BUILD.vcxproj.metaproj" (default target) (2) ->
       "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\dgl.vcxproj.metaproj" (default target) (3) ->
       "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\tensoradapter_pytorch.vcxproj.metaproj" (default target) (6
       ) ->
       "C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\tensoradapter_pytorch.vcxproj" (default target) (19) ->
         C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(
       249,5): error MSB8066: Custom build for 'C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\CMakeFiles\c74c446c
       0a08ce396c81567973709089\tensoradapter_pytorch.rule;C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\CMakeLists.txt
       ' exited with code 1. [C:\Users\Tim Pornyuenyong\PycharmProjects\dgl\build\tensoradapter_pytorch.vcxproj]

    0 Warning(s)
    2 Error(s)

Time Elapsed 00:00:19.70

Anyone have any idea how to resolve this? I have a feeling that it might have something to do with the generated CMakeLists.txt file. Also note that in the previous step, while the installation guide says to run this command:

cmake -DCMAKE_CXX_FLAGS="/DDGL_EXPORTS" -DCMAKE_CONFIGURATION_TYPES="Release" -DDMLC_FORCE_SHARED_CRT=ON .. -G "Visual Studio 16 2019"

I ran the following command instead since I have a newer version of Visual Studio:

cmake -DCMAKE_CXX_FLAGS="/DDGL_EXPORTS" -DCMAKE_CONFIGURATION_TYPES="Release" -DDMLC_FORCE_SHARED_CRT=ON .. -G "Visual Studio 17 2022"

Not sure if this could potentially affect anything, everything seems to be building fine up until I try to run msbuild on dgl.sln

Here is some more info on my system:
Windows 11
PyTorch 2.3.1
CUDA 2.1
Python 3.8

Any help would be much appreciated as I am very new to working with DGL, and thank you in advance!