Search Unity

Feature Request Build prereq checker: Make sure we have what we need

Discussion in 'Editor & General Support' started by dpt2, Apr 20, 2022.

  1. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
    We should not have to wait 20 mins to build to find out we're missing a requirement -

    There should be a prereq checker based on your build settings, that should be quite simple to implement - just check env vars and paths.

    For example, building with IL2CPP? Check for C++ build tools and such - ensure Unity finds what we need to build. If not, don't just tell us "missing some build tool" -- tell us the SPECIFIC one(s) you're looking for -- heck, give us a link. Why make us dig?

    You guys are heavily funded -- why not take it a step further and give us a downloader to what you're looking for?

    In 2021 LTS for IL2CPP, you're not looking for the latest build tools ... you're looking for 2017, and a very specific subset. I mean come on, Unity knows what we need -- why not help devs out?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    This should already be the case. If it doesn't fail immediately with a clear error message, it is a bug. What platform are you building for?

    I'm even more curious which platform you're targeting now. I can't think of a single platform where we require a 5 year old toolchain.
     
  3. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
    Win64 standalone IL2CPP, built from a Win11 PC. I have VS2022 and VS2019 installed, with build tools from 2017, 2019 and 2022.

    Works fine when I build the same in 2021.1.9, but the same project in 2021 LTS fails with the bugs above (missing x64 toolchain). Perhaps there's a conflict with VS2022 with 2021 LTS?

    Are you sure it's a bug? I don't believe it is - more so a feature request. IL2CPP has always processed *after* everything else - always last. The check for requirements is just before IL2CPP triggers - so "almost" last. IL2CPP requirements should check *before* anything to stop early.

    EDIT: Off topic, but speaking of bugs, I was trying to repro this in a new project: if I built in Mono then did a "clean build" with IL2CPP, the build fails (again, later) due to conflicts with Mono. Doesn't this defeat the purpose of the "clean build" option, that I assume would clean the entire dir, including any references to a previous build? --Back to on topic, standby for new proj repro.
     
    Last edited: Apr 20, 2022
  4. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
    Repro'd in new project (GIF):

    Unity_4lAm1rXl7S.gif
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    That sounds unexpected. We support Visual Studio 2015 or ANY later version, so both VS2019 and VS2022 should work. Can you attach your editor log by any chance?

    Yes, there's code specifically to do these checks before building to avoid "long build to an inevitable error". Something must be going wrong and it's passing the initial check but then explodes later.

    It does indeed. Sounds like another bug :(.
     
  6. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
  7. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
    I'm going to DM you
     
  8. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
    Figured out how to get extra info:



    Code (CSharp):
    1. error: Could not set up a toolchain for Architecture x64. Make sure you have the right build tools installed for il2cpp builds. Details:
    2. 0x00007ff6c4f2a53d (Unity) StackWalker::GetCurrentCallstack
    3. 0x00007ff6c4f31299 (Unity) StackWalker::ShowCallstack
    4. 0x00007ff6c5e95de3 (Unity) GetStacktrace
    5. 0x00007ff6c651f47d (Unity) DebugStringToFile
    6. 0x00007ff6c40729a2 (Unity) DebugLogHandler_CUSTOM_Internal_Log
    7. 0x0000015ebec7ec6a (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    8. 0x0000015ebec7eadb (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    9. 0x0000015ebec7df5e (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object)
    10. 0x0000015ebed06d0a (Mono JIT Code) UnityEngine.Debug:LogError (object)
    11. 0x0000015ebed068fb (Mono JIT Code) UnityEditor.Modules.BeeBuildPostprocessor:ReportBuildResults (Bee.BeeDriver.BeeDriverResult)
    12. 0x0000015ebecd0e23 (Mono JIT Code) UnityEditor.Modules.BeeBuildPostprocessor:postProcess (UnityEditor.Modules.BuildPostProcessArgs)
    13. 0x0000015ebeccf37e (Mono JIT Code) UnityEditor.Modules.DefaultBuildPostprocessor:postProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&)
    14. 0x0000015ebeccb4b3 (Mono JIT Code) [WinPlayerPostProcessor.cs:38] UnityEditor.WindowsStandalone.WinPlayerPostProcessor:postProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&)
    15. 0x0000015ebecca2ac (Mono JIT Code) UnityEditor.PostprocessBuildPlayer:postprocess (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,string,string,string,int,int,UnityEditor.BuildOptions,UnityEditor.RuntimeClassRegistry,UnityEditor.Build.Reporting.BuildReport)
    16. 0x0000015ebecca8df (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_int_int_int_object_object_object_int_int_int_object_object (object,intptr,intptr,intptr)
    17. 0x00007ff88905e0a4 (mono-2.0-bdwgc) [mini-runtime.c:3445] mono_jit_runtime_invoke
    18. 0x00007ff888f9e744 (mono-2.0-bdwgc) [object.c:3066] do_runtime_invoke
    19. 0x00007ff888f9e8dc (mono-2.0-bdwgc) [object.c:3113] mono_runtime_invoke
    20. 0x00007ff6c4e4ecf4 (Unity) scripting_method_invoke
    21. 0x00007ff6c4e49914 (Unity) ScriptingInvocation::Invoke
    22. 0x00007ff6c688eb01 (Unity) CallMono
    23. 0x00007ff6c6896a37 (Unity) PostprocessPlayer
    24. 0x00007ff6c68918ef (Unity) DoBuildPlayer_PostBuild
    25. 0x00007ff6c688f98e (Unity) DoBuildPlayer
    26. 0x00007ff6c6883b0d (Unity) BuildPlayer
    27. 0x00007ff6c473917d (Unity) BuildPipeline::BuildPlayerInternalNoCheck
    28. 0x00007ff6c46340af (Unity) BuildPipeline_CUSTOM_BuildPlayerInternalNoCheck
    29. 0x0000015eb6a14fc8 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[],bool)
    30. 0x0000015eb6a13a83 (Mono JIT Code) UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)
    31. 0x0000015eb2691ceb (Mono JIT Code) UnityEditor.BuildPlayerWindow:CallBuildMethods (bool,UnityEditor.BuildOptions)
    32. 0x0000015eb269a91b (Mono JIT Code) UnityEditor.BuildPlayerWindow/<>c__DisplayClass43_0:<GUIBuildButtons>b__0 ()
    33. 0x0000015eb269a80a (Mono JIT Code) UnityEditor.GenericMenu:CatchMenu (object,string[],int)
    34. 0x0000015eb269a397 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void__this___object_object_int (object,intptr,intptr,intptr)
    35. 0x00007ff88905e0a4 (mono-2.0-bdwgc) [mini-runtime.c:3445] mono_jit_runtime_invoke
    36. 0x00007ff888f9e744 (mono-2.0-bdwgc) [object.c:3066] do_runtime_invoke
    37. 0x00007ff888f9e8dc (mono-2.0-bdwgc) [object.c:3113] mono_runtime_invoke
    38. 0x00007ff6c4e4ecf4 (Unity) scripting_method_invoke
    39. 0x00007ff6c4e49914 (Unity) ScriptingInvocation::Invoke
    40. 0x00007ff6c58bebb2 (Unity) CustomPopupMenuInterface::Execute
    41. 0x00007ff6c5889050 (Unity) MenuController::ExecuteMenuItem
    42. 0x00007ff6c5eb57b2 (Unity) ShowDelayedContextMenu
    43. 0x00007ff6c5ec61d6 (Unity) GUIView::OnInputEvent
    44. 0x00007ff6c59821aa (Unity) GUIView::processInputEvent
    45. 0x00007ff6c5ebf04e (Unity) GUIView::DoPaint
    46. 0x00007ff6c5ec843d (Unity) GUIView::RepaintAll
    47. 0x00007ff6c5a55d76 (Unity) PlayerLoopController::UpdateScene
    48. 0x00007ff6c5a53d5f (Unity) Application::TickTimer
    49. 0x00007ff6c5e9bf7a (Unity) MainMessageLoop
    50. 0x00007ff6c5ea084b (Unity) WinMain
    51. 0x00007ff6c71c1d4e (Unity) __scrt_common_main_seh
    52. 0x00007ff939d954e0 (KERNEL32) BaseThreadInitThunk
    53. 0x00007ff93a02485b (ntdll) RtlUserThreadStart
    Code (CSharp):
    1. Internal build system error. BuildProgram exited with code -2146233088.
    2. error: Could not set up a toolchain for Architecture x64. Make sure you have the right build tools installed for il2cpp builds. Details:
    3. IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed:
    4. * Visual Studio 2022 or newer with C++ compilers and Windows 10 SDK (recommended)
    5. * Visual Studio 2019 with C++ compilers and Windows 10 SDK
    6. * Visual Studio 2017 with C++ compilers and Windows 10 SDK
    7. * Visual Studio 2015 with C++ compilers and Windows 10 SDK
    8.  
    9. Visual Studio 2017 (or newer) is detected using `vswhere.exe` as well as VSCOMNTOOLS environment variables.
    10. Visual Studio 2015 is detected by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry as well as VSCOMNTOOLS environment variables.
    11. Windows 10 SDK is detected by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry.
    12.  
    13. Unable to detect any compatible Visual Studio installation!
    14.  
    15.  
    16. Unity.IL2CPP.Bee.BuildLogic.ToolchainNotFoundException: IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed:
    17. * Visual Studio 2022 or newer with C++ compilers and Windows 10 SDK (recommended)
    18. * Visual Studio 2019 with C++ compilers and Windows 10 SDK
    19. * Visual Studio 2017 with C++ compilers and Windows 10 SDK
    20. * Visual Studio 2015 with C++ compilers and Windows 10 SDK
    21.  
    22. Visual Studio 2017 (or newer) is detected using `vswhere.exe` as well as VSCOMNTOOLS environment variables.
    23. Visual Studio 2015 is detected by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry as well as VSCOMNTOOLS environment variables.
    24. Windows 10 SDK is detected by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry.
    25.  
    26. Unable to detect any compatible Visual Studio installation!
    27.  
    28.  
    29.    at Unity.IL2CPP.Bee.BuildLogic.WindowsDesktop.WindowsDesktopBuildLogic.UserAvailableToolchainFor(Architecture architecture, NPath toolChainPath, NPath sysRootPath)
    30.    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.GetIl2CppToolChain(PlatformBuildLogic platform, Architecture architecture, NPath toolChainPath, NPath sysrootPath)
    31.    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupIl2CppBuild()
    32.    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupPlayerBuild()
    33.    at WinPlayerBuildProgram.WinPlayerBuildProgram.SetupPlayerBuild()
    34.    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram()
    35.    at PlayerBuildProgramTypeWrapper.Run(String[] args)
    36.    at Program.Main(String[] args)
    37. 0x00007ff6c4f2a53d (Unity) StackWalker::GetCurrentCallstack
    38. 0x00007ff6c4f31299 (Unity) StackWalker::ShowCallstack
    39. 0x00007ff6c5e95de3 (Unity) GetStacktrace
    40. 0x00007ff6c651f47d (Unity) DebugStringToFile
    41. 0x00007ff6c40729a2 (Unity) DebugLogHandler_CUSTOM_Internal_Log
    42. 0x0000015ebec7ec6a (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    43. 0x0000015ebec7eadb (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    44. 0x0000015ebec7df5e (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object)
    45. 0x0000015ebed06d0a (Mono JIT Code) UnityEngine.Debug:LogError (object)
    46. 0x0000015ebed068fb (Mono JIT Code) UnityEditor.Modules.BeeBuildPostprocessor:ReportBuildResults (Bee.BeeDriver.BeeDriverResult)
    47. 0x0000015ebecd0e23 (Mono JIT Code) UnityEditor.Modules.BeeBuildPostprocessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs)
    48. 0x0000015ebeccf37e (Mono JIT Code) UnityEditor.Modules.DefaultBuildPostprocessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&)
    49. 0x0000015ebeccb4b3 (Mono JIT Code) [WinPlayerPostProcessor.cs:38] UnityEditor.WindowsStandalone.WinPlayerPostProcessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&)
    50. 0x0000015ebecca2ac (Mono JIT Code) UnityEditor.PostprocessBuildPlayer:Postprocess (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,string,string,string,int,int,UnityEditor.BuildOptions,UnityEditor.RuntimeClassRegistry,UnityEditor.Build.Reporting.BuildReport)
    51. 0x0000015ebecca8df (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_int_int_int_object_object_object_int_int_int_object_object (object,intptr,intptr,intptr)
    52. 0x00007ff88905e0a4 (mono-2.0-bdwgc) [mini-runtime.c:3445] mono_jit_runtime_invoke
    53. 0x00007ff888f9e744 (mono-2.0-bdwgc) [object.c:3066] do_runtime_invoke
    54. 0x00007ff888f9e8dc (mono-2.0-bdwgc) [object.c:3113] mono_runtime_invoke
    55. 0x00007ff6c4e4ecf4 (Unity) scripting_method_invoke
    56. 0x00007ff6c4e49914 (Unity) ScriptingInvocation::Invoke
    57. 0x00007ff6c688eb01 (Unity) CallMono
    58. 0x00007ff6c6896a37 (Unity) PostprocessPlayer
    59. 0x00007ff6c68918ef (Unity) DoBuildPlayer_PostBuild
    60. 0x00007ff6c688f98e (Unity) DoBuildPlayer
    61. 0x00007ff6c6883b0d (Unity) BuildPlayer
    62. 0x00007ff6c473917d (Unity) BuildPipeline::BuildPlayerInternalNoCheck
    63. 0x00007ff6c46340af (Unity) BuildPipeline_CUSTOM_BuildPlayerInternalNoCheck
    64. 0x0000015eb6a14fc8 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[],bool)
    65. 0x0000015eb6a13a83 (Mono JIT Code) UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)
    66. 0x0000015eb2691ceb (Mono JIT Code) UnityEditor.BuildPlayerWindow:CallBuildMethods (bool,UnityEditor.BuildOptions)
    67. 0x0000015eb269a91b (Mono JIT Code) UnityEditor.BuildPlayerWindow/<>c__DisplayClass43_0:<GUIBuildButtons>b__0 ()
    68. 0x0000015eb269a80a (Mono JIT Code) UnityEditor.GenericMenu:CatchMenu (object,string[],int)
    69. 0x0000015eb269a397 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void__this___object_object_int (object,intptr,intptr,intptr)
    70. 0x00007ff88905e0a4 (mono-2.0-bdwgc) [mini-runtime.c:3445] mono_jit_runtime_invoke
    71. 0x00007ff888f9e744 (mono-2.0-bdwgc) [object.c:3066] do_runtime_invoke
    72. 0x00007ff888f9e8dc (mono-2.0-bdwgc) [object.c:3113] mono_runtime_invoke
    73. 0x00007ff6c4e4ecf4 (Unity) scripting_method_invoke
    74. 0x00007ff6c4e49914 (Unity) ScriptingInvocation::Invoke
    75. 0x00007ff6c58bebb2 (Unity) CustomPopupMenuInterface::Execute
    76. 0x00007ff6c5889050 (Unity) MenuController::ExecuteMenuItem
    77. 0x00007ff6c5eb57b2 (Unity) ShowDelayedContextMenu
    78. 0x00007ff6c5ec61d6 (Unity) GUIView::OnInputEvent
    79. 0x00007ff6c59821aa (Unity) GUIView::ProcessInputEvent
    80. 0x00007ff6c5ebf04e (Unity) GUIView::DoPaint
    81. 0x00007ff6c5ec843d (Unity) GUIView::RepaintAll
    82. 0x00007ff6c5a55d76 (Unity) PlayerLoopController::UpdateScene
    83. 0x00007ff6c5a53d5f (Unity) Application::TickTimer
    84. 0x00007ff6c5e9bf7a (Unity) MainMessageLoop
    85. 0x00007ff6c5ea084b (Unity) WinMain
    86. 0x00007ff6c71c1d4e (Unity) __scrt_common_main_seh
    87. 0x00007ff939d954e0 (KERNEL32) BaseThreadInitThunk
    88. 0x00007ff93a02485b (ntdll) RtlUserThreadStart
    89.  
    "Visual Studio 2022 or newer with C++ compilers and Windows 10 SDK (recommended)"
     
    Last edited: Apr 20, 2022
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    It would be awesome if before modifying your Visual Studio installation, you could take screenshots of the exact components you have installed. If it worked in unity 2021.1, you machine should have everything installed and Unity 2021.2+ (which contains brand new detection code) somehow misses it. That way we would be able to figure out how to make this not happen again.

    Are you sure that the editor console has no further details if you press on any of the errors? The editor log contains this:

    Lastly, if you could report bug reports on these issues and give me a 7 digit numbers for each case, it would help a lot as externally reported bugs are treated with higher priority.
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    "Visual Studio Build Tools 2022" - this thing have been giving us trouble :(. That's exactly the same issue as the other thread you linked, I thought we fixed it. I will reactivate the bug.

    But I'd still love a bug report about the build not failing early!
     
  11. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
    I actually resolved it now -- but note that I want to send feedback "C++ compilers" was VERY vague and low effort (as there are tons, and indicates I can use build tools).

    VS2022 build tools DO NOT WORK - I need the full VS2022. But it's still strange - I have the full VS2019 and the "c++ compilers" and Win10 sdk (or it wouldn't have worked before for the past year in 2020.1).

    Seems like installing 2021 LTS broke my VS tools? Apparently something to do with "whereis.exe".

    Unfortunately, I'm out of time to debug further! I hope these notes help.

    EDIT: PS, didnt need to reboot after installing vs2022. I didn't even have to restart Unity.
     

    Attached Files:

  12. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
    Apologies bud, on company time and I've sent more reports than I can count. I can't go further than this without a QA paycheck. Good luck!
     
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    Alright, thanks for bringing this up anyway!
     
  14. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
    @Tautvydas-Zilys One more note, a dev friend seems to know exactly what causes it:

    > vs22 tools will come with vswhere.exe but it will report the vs19 installation location instead, because vs22 itself is not installed. this causes unity to freak out.
    everything works if you have only one installation of vs tools, or only one installation of vstools+vs, but it breaks when you have multiple installations of vstools without corresponding vs.
    it's a bug in unity
     
  15. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,335
    When Unity gets to the part of the build process where it is starting to compile code, it checks if there is already a build in that location that has been built with a different backend (IL2CPP when you're building with Mono, or vice versa). If there is one there, the build is automatically failed.

    This happens after all the scenes are built, which in a real game takes a while. It's not bad enough that we have to wait for IL2CPP to finish before it fails, but it's still later in the process than it could have been. Would you consider that a bug? Should I send a report about that?
     
    dpt2 likes this.
  16. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,678
    Yes, that's a bug. Please send a bug report and tell me the 7 digit bug number number.
     
    dpt2 likes this.
  17. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,335
    1421700
     
    Tautvydas-Zilys likes this.