Search Unity

Issue | GRPC build for windows

Discussion in 'Scripting' started by mamaorha, May 27, 2021.

  1. mamaorha

    mamaorha

    Joined:
    Jun 16, 2015
    Posts:
    44
    I have tried to follow the GRPC guides and i couldn't make it compile for windows (it does compile for android + it run well from editor).

    the error i get when i try to compile on windows is:
    Code (CSharp):
    1. Exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\link.exe /out:"D:\projects\MyGame\Client\MyGame\Library\il2cpp_cache\linkresult_097C944A02A3A505631BAA50279D30EE\GameAssembly.dll" /ignore:4206 /DEBUG /INCREMENTAL:NO /LARGEADDRESSAWARE /NXCOMPAT /DYNAMICBASE /NOLOGO /TLBID:1 /OPT:REF /OPT:ICF /HIGHENTROPYVA /DLL /IGNORE:4104 /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" "Dbghelp.lib" "E:\Program Files\Unity\2020.3.3f1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\Variations\win64_nondevelopment_il2cpp\baselib.dll.lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\lib\x64" /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" /SUBSYSTEM:WINDOWS @"C:\Users\Me\AppData\Local\Temp\tmp3D01.tmp"
    2.  
    3. Creating library D:\projects\MyGame\Client\MyGame\Library\il2cpp_cache\linkresult_097C944A02A3A505631BAA50279D30EE\GameAssembly.lib and object D:\projects\MyGame\Client\MyGame\Library\il2cpp_cache\linkresult_097C944A02A3A505631BAA50279D30EE\GameAssembly.exp
    4. 6F8E1B7554AB08145EB7D8161E97FEAB.obj : error LNK2019: unresolved external symbol dlopen referenced in function Mono_dlopen_m7F2DE2CD0870AB15EEA4E0A0BA6C47044E74BB67
    5. 6F8E1B7554AB08145EB7D8161E97FEAB.obj : error LNK2019: unresolved external symbol dlerror referenced in function Mono_dlerror_m359ABCFD23D0EB5314DE2DFF8AB58CFE949BBABD
    6. 6F8E1B7554AB08145EB7D8161E97FEAB.obj : error LNK2019: unresolved external symbol dlsym referenced in function Mono_dlsym_m31A00C09F598C9D552A94628C2C28B3C7B04C2DD
    7. D:\projects\MyGame\Client\MyGame\Library\il2cpp_cache\linkresult_097C944A02A3A505631BAA50279D30EE\GameAssembly.dll : fatal error LNK1120: 3 unresolved externals
    8.  
    9.    at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
    10.    at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
    11.    at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection`1 matchedAssemblyMethodSourceFiles)
    12.    at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions)
    13. UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <c9b5231e365148a4bc210cc4e439206d>:0)
    14. UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at <c9b5231e365148a4bc210cc4e439206d>:0)
    15. UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo) (at <c9b5231e365148a4bc210cc4e439206d>:0)
    16. UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data) (at <c9b5231e365148a4bc210cc4e439206d>:0)
    17. UnityEditorInternal.IL2CPPBuilder.Run () (at <c9b5231e365148a4bc210cc4e439206d>:0)
    18. UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <c9b5231e365148a4bc210cc4e439206d>:0)
    19. DesktopStandalonePostProcessor.RunIL2CPP (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditorInternal.IIl2CppPlatformProvider il2cppPlatformProvider, System.Collections.Generic.List`1[T] cppPlugins) (at <c9b5231e365148a4bc210cc4e439206d>:0)
    20. DesktopStandalonePostProcessor.SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs args, System.Collections.Generic.HashSet`1[T] filesToNotOverwrite) (at <c9b5231e365148a4bc210cc4e439206d>:0)
    21. DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <c9b5231e365148a4bc210cc4e439206d>:0)
    22. Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
    23. DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <c9b5231e365148a4bc210cc4e439206d>:0)
    24. UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <c9b5231e365148a4bc210cc4e439206d>:0)
    25. UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <c9b5231e365148a4bc210cc4e439206d>:0)
    26. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    i have tried to google it but couldn't get it to work with the various workarounds i saw
     
  2. mamaorha

    mamaorha

    Joined:
    Jun 16, 2015
    Posts:
    44
    solved by adding the following:
    Code (CSharp):
    1. void dlopen() {
    2.     fprintf(stderr, "Should never reach here");
    3.     abort();
    4. }
    5. void dlerror() {
    6.     fprintf(stderr, "Should never reach here");
    7.     abort();
    8. }
    9. void dlsym() {
    10.     fprintf(stderr, "Should never reach here");
    11.     abort();
    12. }
    into "grpc_csharp_ext_dummy_stubs.c" under "Plugins/Grpc.Core/runtimes"
     
    Kurt-Dekker likes this.
  3. mamaorha

    mamaorha

    Joined:
    Jun 16, 2015
    Posts:
    44
    that help compiling and running on windows but on android the app will crash on startup -> so i have to manually change this file when i compile to win/andorid -> any idea how to "avoid" that?