Search Unity

Resolved Unity.IL2CPP.Building.BuilderFailedException (unrecognized flag '-ssa-cfg-jt-' in 'p2')

Discussion in 'AR' started by aaiello_xenia, Aug 10, 2022.

  1. aaiello_xenia

    aaiello_xenia

    Joined:
    Mar 8, 2021
    Posts:
    2
    Hi all,

    while building an "old" app in VS 2019 in Release/ARM64 mode (successfully compiled and deployed in my HoloLens 2 a couple of months ago) I'm receiving weird compiler and link errors I've never had before.

    Here is the VS Error List screenshot:



    And here you can find the full Visual Studio log:

    Build started...
    1>------ Build started: Project: Il2CppOutputProject, Configuration: Release ARM64 ------
    1>Building GameAssembly.dll with MsvcWinRtToolChain
    1> Msvc Install Version: 15.0
    1> Msvc Install SDK Directory: C:\Program Files (x86)\Windows Kits\10
    1> Msvc Linker Path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\ARM64\link.exe
    1> Msvc Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\ARM64\cl.exe
    1>
    1> Output directory: C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\build\bin\ARM64\Release
    1> Cache directory: C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\build\obj\il2cppOutputProject\ARM64\Release
    1>EXEC : error : Unity.IL2CPP.Building.BuilderFailedException: pch-c.c
    1>EXEC : fatal error C1007: unrecognized flag '-ssa-cfg-jt-' in 'p2'
    1>
    1>
    1>
    1>
    1>Invocation was: Executable: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\ARM64\cl.exe"
    1>Arguments: "C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\libil2cpp\pch\pch-c.c" /nologo /c /bigobj /W3 /Z7 /EHs /GR- /Gy /utf-8 /wd4102 /wd4800 /wd4056 /wd4190 /wd4723 /wd4467 /wd4503 /wd4996 /wd4200 /wd4834 /Ox /Oi /Oy- /GS- /Gw /GF /Zo /MD -d2ssa-cfg-jt- /D_WIN32 /DWIN32 /DWIN32_THREADS /D_WINDOWS /DWINDOWS /D_UNICODE /DUNICODE /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /D_WINSOCK_DEPRECATED_NO_WARNINGS /DNOMINMAX /D_NDEBUG /DNDEBUG /DWINDOWS_SDK_BUILD_VERSION=19041 /D__WRL_NO_DEFAULT_LIB__ /DWINAPI_FAMILY=WINAPI_FAMILY_APP /DWINDOWS_UWP /DUNITY_UWP /DUNITY_WSA_10_0 /DUNITY_WSA /DUNITY_WINRT /DPLATFORM_WINRT /DNET_4_0 /DUNITY_AOT /DIL2CPP_MONO_DEBUGGER_DISABLED /DGC_NOT_DLL /DRUNTIME_IL2CPP /DIL2CPP_ENABLE_WRITE_BARRIERS=1 /DIL2CPP_INCREMENTAL_TIME_SLICE=3 /DBASELIB_INLINE_NAMESPACE=il2cpp_baselib /DIL2CPP_DEFAULT_DATA_DIR_PATH=Data/il2cpp_data /I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\libil2cpp" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\libil2cpp" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\external\bdwgc\include" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\external\xxHash" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\external\baselib\Include" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\external\baselib\Platforms\UniversalWindows\Include" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\libil2cpp\pch" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\Source" /Ycpch-c.h /Fp"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\build\obj\il2cppOutputProject\ARM64\Release\BF8AB040FB39382A367CB01F6C085B99.pch" /Fo"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\build\obj\il2cppOutputProject\ARM64\Release\BF8AB040FB39382A367CB01F6C085B99.obj" /Fd"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\build\obj\il2cppOutputProject\ARM64\Release\BF8AB040FB39382A367CB01F6C085B99.pdb"
    1>EnvArg key: PATH value: C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64
    1>
    1> at Unity.IL2CPP.Building.ToolChains.MsvcToolChain.InvokePchCompilation(IL2CPPOutputBuildDescription programBuildDescription, HeaderFileHashProvider headerHashProvider, NPath workingDirectory, Boolean forceRebuild, Boolean verbose, Boolean includeFileNamesInHashes, NPath sourceFile)
    1> at Unity.IL2CPP.Building.ToolChains.MsvcToolChain.<>c__DisplayClass53_0.<CompilePch>b__0()
    1> at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass0_0`1.<Run>b__0(Object o)
    1>EXEC : error : Unity.IL2CPP.Building.BuilderFailedException: pch-cpp.cpp
    1>EXEC : fatal error C1007: unrecognized flag '-ssa-cfg-jt-' in 'p2'
    1>
    1>
    1>
    1>
    1>Invocation was: Executable: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\ARM64\cl.exe"
    1>Arguments: "C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\libil2cpp\pch\pch-cpp.cpp" /nologo /c /bigobj /W3 /Z7 /EHs /GR- /Gy /utf-8 /wd4102 /wd4800 /wd4056 /wd4190 /wd4723 /wd4467 /wd4503 /wd4996 /wd4200 /wd4834 /Ox /Oi /Oy- /GS- /Gw /GF /Zo /MD -d2ssa-cfg-jt- /D_WIN32 /DWIN32 /DWIN32_THREADS /D_WINDOWS /DWINDOWS /D_UNICODE /DUNICODE /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /D_WINSOCK_DEPRECATED_NO_WARNINGS /DNOMINMAX /D_NDEBUG /DNDEBUG /DWINDOWS_SDK_BUILD_VERSION=19041 /D__WRL_NO_DEFAULT_LIB__ /DWINAPI_FAMILY=WINAPI_FAMILY_APP /DWINDOWS_UWP /DUNITY_UWP /DUNITY_WSA_10_0 /DUNITY_WSA /DUNITY_WINRT /DPLATFORM_WINRT /DNET_4_0 /DUNITY_AOT /DIL2CPP_MONO_DEBUGGER_DISABLED /DGC_NOT_DLL /DRUNTIME_IL2CPP /DIL2CPP_ENABLE_WRITE_BARRIERS=1 /DIL2CPP_INCREMENTAL_TIME_SLICE=3 /DBASELIB_INLINE_NAMESPACE=il2cpp_baselib /DIL2CPP_DEFAULT_DATA_DIR_PATH=Data/il2cpp_data /I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\libil2cpp" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\libil2cpp" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\external\bdwgc\include" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\external\xxHash" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\external\baselib\Include" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\external\baselib\Platforms\UniversalWindows\Include" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\IL2CPP\libil2cpp\pch" /I"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\Source" /Ycpch-cpp.hpp /Fp"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\build\obj\il2cppOutputProject\ARM64\Release\23423F50C9552E3F039EB45B9C6090D1.pch" /Fo"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\build\obj\il2cppOutputProject\ARM64\Release\23423F50C9552E3F039EB45B9C6090D1.obj" /Fd"C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\build\obj\il2cppOutputProject\ARM64\Release\23423F50C9552E3F039EB45B9C6090D1.pdb"
    1>EnvArg key: PATH value: C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64
    1>
    1> at Unity.IL2CPP.Building.ToolChains.MsvcToolChain.InvokePchCompilation(IL2CPPOutputBuildDescription programBuildDescription, HeaderFileHashProvider headerHashProvider, NPath workingDirectory, Boolean forceRebuild, Boolean verbose, Boolean includeFileNamesInHashes, NPath sourceFile)
    1> at Unity.IL2CPP.Building.ToolChains.MsvcToolChain.<>c__DisplayClass53_0.<CompilePch>b__1()
    1> at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass0_0`1.<Run>b__0(Object o)
    1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v150\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ""C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\\IL2CPP\build\deploy\netcoreapp3.1\il2cpp.exe" --libil2cpp-static --compile-cpp -architecture=ARM64 -configuration=Release -platform=winrt -outputpath="C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\\build\bin\ARM64\Release\GameAssembly.dll" --data-folder="C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\\build\bin\ARM64\Release\\" -cachedirectory="C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\\build\obj\il2cppOutputProject\ARM64\Release\\" -generatedcppdir="C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\\Source" --incremental-g-c-time-slice=3 --baselib-directory="C:\Program Files\Unity\Hub\Editor\2020.3.4f1\Editor\Data\PlaybackEngines\MetroSupport\Players\UAP\il2cpp\ARM64\Release" --avoid-dynamic-library-copy --profiler-report --additional-defines=WINDOWS_UWP --additional-defines=UNITY_UWP --additional-defines=UNITY_WSA_10_0 --additional-defines=UNITY_WSA --additional-defines=UNITY_WINRT --additional-defines=PLATFORM_WINRT -dotnetprofile=unityaot -verbose --relative-data-path=Data/il2cpp_data --map-file-parser="C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\Il2CppOutputProject\\IL2CPP\MapFileParser\MapFileParser.exe" --compiler-flags="-d2ssa-cfg-jt-"" exited with code -1.
    1>Done building project "Il2CppOutputProject.vcxproj" -- FAILED.
    2>------ Build started: Project: CameraStreamSample, Configuration: Release ARM64 ------
    2>LINK : fatal error LNK1181: cannot open input file 'C:\Progetti\VALUE\CameraStreamSample 2.0\UnityBuild2\build\bin\ARM64\Release\GameAssembly.lib'
    2>Done building project "CameraStreamSample.vcxproj" -- FAILED.
    ========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

    These are my development settings:
    • Unity 2020.3.4f1
    • MRTK 2.6.1
    • Microsoft Visual Studio 2019 (ver. 16.11.10)
    • Windows 10 SDK 10.0.19041.0 [10.0.18362.0 is also installed]
    • Windows 10 Pro ver. 21H2 OS build 19044.1826
    I am receiving the same errors while compiling another Unity app for HoloLens 2 which makes use of an ARM64 plugin, but not in other two where I don't use it.
    I suspect that in the last 2/3 months, while I had to temporarily move to another project for my company, the Windows Updates I installed could have caused this "compatibility" issue...
    Maybe someone could shed a light on this mystery? :'(

    NOTE: I've already tried stopping the antivirus or updating Visual Studio to the latest available version (16.11.18) to no avail...

    Thanks to anyone can help me going through this unexpected hitch.
     
  2. aaiello_xenia

    aaiello_xenia

    Joined:
    Mar 8, 2021
    Posts:
    2
    Finally I found out the reason. I hope what I discovered could help anyone is facing a similar weird situation.

    For some reason my Visual Studio 2019 instance suddenly got broken (most probably while I was working on other projects rather than Unity apps), and this thing messed up the Unity builds and the relevant C++ solution that came out.

    Going straight to the solution: I fixed everything by repairing my Visual Studio 2019 installation.

    Actually I had an insight just after posting my thread, going through the build logs I shared.
    I noticed many references to VS 2017 executables (i.e.: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\ARM64\cl.exe) which is another Visual Studio instance installed on my PC. So I wondered why the build process was referencing VS 2017 executables instead of VS 2019...
    First I opened the "Universal Windows" project properties dialog: there, under the "General" menu, the "Platform Toolset" property was set to Visual Studio 2017 (v141)! Again, why?

    Looking at the "Build Settings" dialog in Unity, I checked that "Visual Studio Version" field was set to "Latest installed" (I generally leave it that way). Anyway, opening the dropdown list, I could only see two entries: "Latest installed" and "Visual Studio 2017".
    I believed that it was correct, thinking that "Latest installed" was just a way to say "Visual Studio 2019".
    Anyway I wasn't completely sure about that, so I opened the Edit -> Preferences -> External Tools dialog and checked the "External Script Editor" dropdown. The value was set to "Visual Studio 2019"!!
    And among the values I could see also the "Visual Studio 2017 [15.9.33]" entry, not selected of course!

    That was even more confusing... (only afterwards I understood that the "Visual Studio 2019" entry was generated by a manual discovery of Visual Studio installations when I first installed Unity).

    While googling here and there, following clues, I found out that Unity uses the command below to discover the installed Visual Studio instances:

    "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"


    However when I run it, only the "Visual Studio Professional 2017" entry was displayed.

    Running the command with the "-all" argument it displayed both VS entries.
    Anyway the VS 2019 "state" property had a value of "13" instead of "7".

    Querying again on Google I found a Microsoft expert (at this link) specifying that a state of "13" means that the product is "not registered", so it was in some kind of temporary state that didn't allow Unity discovery mechanism to retrieve it.

    So, making a recap:
    • Unity was building my app creating a solution based on Visual Studio 2017, and not on VS 2019 (as I believed since in Unity "Build Settings" dialog the "Visual Studio Version" dropdown was set to "Latest installed")
    • I was opening the solution on my VS 2019 (no warning or other message was being displayed) and that led to those unexpected build errors due to mixed and partially compatible platforms
    To fix those issues I repaired my VS 2019 instance running the following command:

    "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" repair --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"


    NOTE: I believe that repairing VS from "Control Panel -> Programs -> Programs and Features" should be the same, unless someone says that the manual command run a more thorough process.