Search Unity

[IL2CPP] [Standalone] LINK : fatal error LNK1181

Discussion in 'Windows' started by Ivan-Pestrikov, Aug 23, 2019.

  1. Ivan-Pestrikov

    Ivan-Pestrikov

    Joined:
    Aug 8, 2014
    Posts:
    12
    I've got an error "LINK : fatal error LNK1181: cannot open input file 'Shell32.lib'" on the IL2CPP build attempt.
    VS 2017 15.9.15
    Unity 2019.1.12.f1
    Scripting runtime: .NET 4.x

    Failed running C:\Program Files\Unity\Hub\Editor\2019.1.12f1\Editor\Data\il2cpp/build/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="WindowsDesktop" --architecture="x64" --configuration="Release" --outputpath="C:\Users\TaosX\Documents\Final Upgrade 2019\Temp/StagingArea/Data\Native\GameAssembly.dll" --cachedirectory="C:\Users\TaosX\Documents\Final Upgrade 2019\Assets\..\Library/il2cpp_cache" --incremental-g-c-time-slice=3 --profiler-report --map-file-parser="C:/Program Files/Unity/Hub/Editor/2019.1.12f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe" --directory="C:/Users/TaosX/Documents/Final Upgrade 2019/Temp/StagingArea/Data/Managed" --generatedcppdir="C:/Users/TaosX/Documents/Final Upgrade 2019/Temp/StagingArea/Data/il2cppOutput"
    stdout:
    Building GameAssembly.dll with MsvcDesktopToolChain
    Msvc Install Version: 15.0
    Msvc Install SDK Directory: C:\Program Files (x86)\Windows Kits\10
    Msvc Linker Path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\link.exe
    Msvc Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.exe
    Output directory: C:\Users\TaosX\Documents\Final Upgrade 2019\Temp\StagingArea\Data\Native
    Cache directory: C:\Users\TaosX\Documents\Final Upgrade 2019\Library\il2cpp_cache
    ObjectFiles: 285 of which compiled: 7
    Time Compile: 8125 milliseconds FinalUpgrade15.cpp
    Time Compile: 4694 milliseconds Il2CppAttributes.cpp
    Time Compile: 3245 milliseconds Il2CppCompilerCalculateTypeValues2.cpp
    Time Compile: 2462 milliseconds FinalUpgrade23.cpp
    Time Compile: 1833 milliseconds Il2CppMetadataUsage.c
    Time Compile: 778 milliseconds Il2CppCompilerCalculateTypeValuesTable.cpp
    Time Compile: 732 milliseconds FinalUpgrade_CodeGen.c
    Total compilation time: 8428 milliseconds.
    il2cpp.exe didn't catch exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\link.exe /out:"C:\Users\TaosX\Documents\Final Upgrade 2019\Library\il2cpp_cache\linkresult_A7543FAF8829F047B67C9CE38B15E4ED\GameAssembly.dll" /DEBUG /INCREMENTAL:NO /LARGEADDRESSAWARE /NXCOMPAT /DYNAMICBASE /NOLOGO /TLBID:1 /OPT:REF /OPT:ICF /HIGHENTROPYVA /DLL /NODEFAULTLIB:uuid.lib "kernel32.lib" "user32.lib" "advapi32.lib" "ole32.lib" "oleaut32.lib" "Shell32.lib" "Crypt32.lib" "psapi.lib" "version.lib" "MsWSock.lib" "ws2_32.lib" "Iphlpapi.lib" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64" /SUBSYSTEM:WINDOWS @"C:\Users\TaosX\AppData\Local\Temp\tmp72B1.tmp"
    LINK : fatal error LNK1181: cannot open input file 'Shell32.lib'
    at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
    at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
    at il2cpp.Program.DoRun(String[] args)
    at il2cpp.Program.Run(String[] args)
    at il2cpp.Program.Main(String[] args)
    stderr:
    Unhandled Exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\link.exe /out:"C:\Users\TaosX\Documents\Final Upgrade 2019\Library\il2cpp_cache\linkresult_A7543FAF8829F047B67C9CE38B15E4ED\GameAssembly.dll" /DEBUG /INCREMENTAL:NO /LARGEADDRESSAWARE /NXCOMPAT /DYNAMICBASE /NOLOGO /TLBID:1 /OPT:REF /OPT:ICF /HIGHENTROPYVA /DLL /NODEFAULTLIB:uuid.lib "kernel32.lib" "user32.lib" "advapi32.lib" "ole32.lib" "oleaut32.lib" "Shell32.lib" "Crypt32.lib" "psapi.lib" "version.lib" "MsWSock.lib" "ws2_32.lib" "Iphlpapi.lib" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64" /SUBSYSTEM:WINDOWS @"C:\Users\TaosX\AppData\Local\Temp\tmp72B1.tmp"
    LINK : fatal error LNK1181: cannot open input file 'Shell32.lib'
    at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
    at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
    at il2cpp.Program.DoRun(String[] args)
    at il2cpp.Program.Run(String[] args)
    at il2cpp.Program.Main(String[] args)
    UnityEngine.Debug:LogError(Object)
    UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:128)
    UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action`1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
    UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:496)
    UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:477)
    UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:334)
    UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:70)
    DesktopStandalonePostProcessor:SetupStagingArea(BuildPostProcessArgs, HashSet`1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:247)
    DesktopStandalonePostProcessor:postProcess(BuildPostProcessArgs) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:46)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    How to fix this?

    Thanks alot!
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    3,962
    I wonder if the Windows SDK in not installed properly. I'm not sure what Shell32.lib would be missing for any other reason.
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,417
    Yeah, this sounds like a bad Windows 10 SDK installation. I suggest reinstalling it.
     
  4. Ivan-Pestrikov

    Ivan-Pestrikov

    Joined:
    Aug 8, 2014
    Posts:
    12
    Yes, you are right, it's the Windows 10 SDK.
    I installed the SDK manually first, and the second time it was installed by the Visual Studio along with C++ package.
    So, I just removed the manual installation, and everything worked.

    Thank you!