Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question use IL2CPP build Universal Windows Platform, but every time I obtain a bunch of error.

Discussion in 'Windows' started by shaowei35, Dec 1, 2022.

  1. shaowei35

    shaowei35

    Joined:
    Nov 30, 2022
    Posts:
    4
    It can be built normally on the Windows platform, and an error will be reported on the UWP platform.
    use IL2CPP build Universal Windows Platform, but every time I obtain a bunch of error.
    who can help me.

    the error message:

    Exception: Unity.IL2CPP.Building.BuilderFailedException: Build failed with 0 successful nodes and 1 failed ones
    Annotation: IL2CPP_CodeGen E:/unityWorksprce/HELLO 3D3/Library/Il2cppBuildCache/UWP/ARM64/buildstate/artifacts/il2cpp_conv_xk0o.traceevents
    Cmdline: "C:\Program Files\Unity\Hub\Editor\2021.3.14f1c1\Editor\Data\il2cpp\build\deploy\il2cpp.exe" --convert-to-cpp --directory="E:/unityWorksprce/HELLO 3D3/Temp/StagingArea/Data/Managed" --data-folder="E:\unityWorksprce\HELLO 3D3\Library\Il2cppBuildCache\UWP\ARM64\il2cppOutput\Data" --generatedcppdir="E:/unityWorksprce/HELLO 3D3/Library/Il2cppBuildCache/UWP/ARM64/il2cppOutput" --symbols-folder="E:\unityWorksprce\HELLO 3D3\Library\Il2cppBuildCache\UWP\ARM64\il2cppOutput\Symbols" --emit-null-checks --enable-array-bounds-check --code-generation-option=EnableInlining --stats-output-dir="E:/unityWorksprce/HELLO 3D3/Library/Il2cppBuildCache/UWP/ARM64/il2cppStats" --dotnetprofile=unityaot-win32 --cachedirectory="E:/unityWorksprce/HELLO 3D3/Library/Il2cppBuildCache/UWP/ARM64" --profiler-report --profiler-output-file="E:/unityWorksprce/HELLO 3D3/Library/Il2cppBuildCache/UWP/ARM64/buildstate/artifacts/il2cpp_conv_xk0o.traceevents"
    ExitCode: -1
    Stdout:
    Error: IL2CPP error for method 'System.ValueTuple`2<Tensorflow.Tensor,Tensorflow.Tensor> Tensorflow.image_ops_impl::non_max_suppression_padded_v2(Tensorflow.Tensor,Tensorflow.Tensor,Tensorflow.Tensor,System.Single,System.Single,System.Boolean,System.Boolean,System.Int32)' in assembly 'E:\unityWorksprce\HELLO 3D3\Temp\StagingArea\Data\Managed\Tensorflow.Binding.dll'
    System.ArgumentException: System.Object is not an array type (Parameter 'typeReference')
    at Unity.IL2CPP.ArrayUtilities.ArrayElementTypeOf(ResolvedTypeInfo typeReference)
    at Unity.IL2CPP.MethodBodyWriter.ProcessInstruction(Node node, InstructionBlock block, ResolvedInstruction ins)
    at Unity.IL2CPP.MethodBodyWriter.GenerateCodeRecursive(Node node, ReadOnlyDictionary`2 instructionBlocks)
    at Unity.IL2CPP.MethodBodyWriter.Generate()
    at Unity.IL2CPP.CodeWriters.CodeWriterExtensions.WriteMethodWithMetadataInitialization(IGeneratedMethodCodeWriter writer, String methodSignature, Action`2 writeMethodBody, String uniqueIdentifier, MethodReference methodRef, Boolean writingMethodBody)
    at Unity.IL2CPP.MethodWriter.WriteMethodDefinition(AssemblyWriteContext context, IGeneratedMethodCodeWriter writer, MethodReference method)
    at Unity.IL2CPP.SourceWriter.WriteTypesMethods(SourceWritingContext context, IGeneratedMethodCodeWriter writer, TypeWritingInformation& writingInformation, NPath filePath, Boolean writeMarshalingDefinitions)
    at Unity.IL2CPP.SourceWriters.SourceWriterBase`2.WriteItem(StreamWorkItemData`2 data)
    at Unity.IL2CPP.Contexts.Scheduling.Streams.FileLevelParallelStreamManager`3.WorkerWriteItemsToFile(WorkItemData`2 data)
    at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.WorkerLoop(Object data)

    at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, Il2CppCommandLineArguments il2CppCommandLineArguments, BuildingOptions buildingOptions, Boolean throwExceptions)
     
    Last edited: Dec 2, 2022
  2. timke

    timke

    Unity Technologies

    Joined:
    Nov 30, 2017
    Posts:
    395
    It appears to be a case of IL2CPP stripping of TensorFlow types.

    Is you project using Reflection? If so, you'll need to override IL2CPP byte stripping, covered in this documentation page.
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,529
    IL2CPP crashing generally means that either the DLL it is converting contains invalid IL code, or it is a bug in Unity. I suggest you also run PEVerify on Tensorflow.Binding.dll to see if it contains any invalid code in it.
     
  4. shaowei35

    shaowei35

    Joined:
    Nov 30, 2022
    Posts:
    4

    Tensor tensorNum = graph.OperationByName("num_detections");
    Tensor tensorBoxes = graph.OperationByName("detection_boxes");
    Tensor tensorScores = graph.OperationByName("detection_scores");
    Tensor tensorClasses = graph.OperationByName("detection_classes");
    Tensor imgTensor = graph.OperationByName("image_tensor");
    Tensor[] outTensorArr = new Tensor[] { tensorNum, tensorBoxes, tensorScores, tensorClasses };
    var results = sess.run(outTensorArr, new FeedItem(imgTensor, imgArr));

    run method:
    public virtual NDArray[] run(object fetches, params FeedItem[] feed_dict);


    may be the problem is,run method need object type, and call it use Tensor[] type.
    IL2CPP don't support this writing method,but it can be executed normally in unity.
    In this case, do I need to modify the source code of TensorFlow to solve the problem,Pass exact Parameter type.
     
  5. shaowei35

    shaowei35

    Joined:
    Nov 30, 2022
    Posts:
    4
    Code (CSharp):
    1. Tensor tensorNum = graph.OperationByName("num_detections");
    2. Tensor tensorBoxes = graph.OperationByName("detection_boxes");
    3. Tensor tensorScores = graph.OperationByName("detection_scores");
    4. Tensor tensorClasses = graph.OperationByName("detection_classes");
    5. Tensor imgTensor = graph.OperationByName("image_tensor");
    6. Tensor[] outTensorArr = new Tensor[] { tensorNum, tensorBoxes, tensorScores, tensorClasses };
    7. var results = sess.run(outTensorArr, new FeedItem(imgTensor, imgArr));
    8.  
    9. run method:
    10. public virtual NDArray[] run(object fetches, params FeedItem[] feed_dict);

    may be the problem is,run method need object type, and call it use Tensor[] type.
    IL2CPP don't support this writing method,but it can be executed normally in unity.
    In this case, do I need to modify the source code of TensorFlow to solve the problem,Pass exact Parameter type.
     
  6. shaowei35

    shaowei35

    Joined:
    Nov 30, 2022
    Posts:
    4
    It can be built normally on the Windows platform, and an error will be reported on the UWP platform.
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,529
    Can you report a bug in that case so we could investigate on our side? https://unity3d.com/unity/qa/bug-reporting
     
  8. burungiuc

    burungiuc

    Joined:
    Nov 24, 2021
    Posts:
    2
    Did you solved this?
     
    Last edited: Feb 10, 2023
  9. burungiuc

    burungiuc

    Joined:
    Nov 24, 2021
    Posts:
    2
    Hello, did someone knows how to solve it?