getnamo / TensorFlow-Unreal

TensorFlow plugin for the Unreal Engine.
Other
1.16k stars 211 forks source link

Unknown Function when Cooking Game Using My Tensorflow Plugin #57

Closed asxdfd closed 4 years ago

asxdfd commented 4 years ago

Hello. Here's a problem. I don't use your plugin but I wonder if you can help me. During the cooking process, there is an error. Here's the log.

ProcessResult.StdOut:   LogWindows: Error: begin: stack for UAT
ProcessResult.StdOut:   LogWindows: Error: === Critical error: ===
ProcessResult.StdOut:   LogWindows: Error:
ProcessResult.StdOut:   LogWindows: Error: Fatal error: [File:D:/Build/++UE4+Licensee/Sync/Engine/Source/Runtime/Launch/Private/Windows/LaunchWindows.cpp] [Line: 95]
ProcessResult.StdOut:   LogWindows: Error: SECURE CRT: Invalid parameter detected.
ProcessResult.StdOut:   LogWindows: Error: Expression: Unknown Function: Unknown. File: Unknown Line: 0
ProcessResult.StdOut:   LogWindows: Error:
ProcessResult.StdOut:   LogWindows: Error:
ProcessResult.StdOut:   LogWindows: Error:
ProcessResult.StdOut:   LogWindows: Error: Unhandled Exception: 0xc06d007e
ProcessResult.StdOut:   LogWindows: Error:
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff918e8a799 KERNELBASE.dll!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8a3f29c05 UE4Editor-UE4FaceReplace.dll!__delayLoadHelper2() [d:\A01\_work\6\s\src\vctools\delayimp\delayhlp.cpp:312]
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8a3f25bb7 UE4Editor-UE4FaceReplace.dll!_tailMerge_tensorflow_cc_dll() []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8a3f1bb33 UE4Editor-UE4FaceReplace.dll!TfModelFaceDetect::TfModelFaceDetect() [D:\Unreal Projects\UE4FaceReplace\Source\UE4FaceReplace\TfModelFaceDetect.cpp:11]
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8a3f2169a UE4Editor-UE4FaceReplace.dll!AWebcamReader::AWebcamReader() [D:\Unreal Projects\UE4FaceReplace\Source\UE4FaceReplace\WebcamReader.cpp:11]
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8c23ec213 UE4Editor-CoreUObject.dll!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8c2698341 UE4Editor-CoreUObject.dll!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8c2675aaf UE4Editor-CoreUObject.dll!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8c2594315 UE4Editor-CoreUObject.dll!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8c167bf4a UE4Editor-Core.dll!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8c169c0d0 UE4Editor-Core.dll!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8c211b433 UE4Editor-Projects.dll!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff8c211b70d UE4Editor-Projects.dll!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff73b96fa92 UE4Editor-Cmd.exe!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff73b9726f5 UE4Editor-Cmd.exe!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff73b96b7ec UE4Editor-Cmd.exe!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff73b96bb5a UE4Editor-Cmd.exe!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff73b97e31d UE4Editor-Cmd.exe!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff73b98040a UE4Editor-Cmd.exe!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff919f37bd4 KERNEL32.DLL!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error: [Callstack] 0x00007ff91b38ce51 ntdll.dll!UnknownFunction []
ProcessResult.StdOut:   LogWindows: Error:
ProcessResult.StdOut:   LogWindows: Error: end: stack for UAT

I created a third party plugin named Tensorflow.

// Copyright Epic Games, Inc. All Rights Reserved.

using System.IO;
using UnrealBuildTool;

public class Tensorflow : ModuleRules
{
    private string ThirdPartyPath
    {
        get { return Path.GetFullPath(Path.Combine(ModuleDirectory, "../../../../ThirdParty/")); }
    }

    public Tensorflow(ReadOnlyTargetRules Target) : base(Target)
    {
        // Startard Module Dependencies
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "RHI", "RenderCore" });
        PrivateDependencyModuleNames.AddRange(new string[] { "CoreUObject", "Engine", "Slate", "SlateCore" });

        // Start Tensorflow linking here!
        bool isLibrarySupported = false;

        // Create Tensorflow Path 
        string TensorflowPath = Path.Combine(ThirdPartyPath, "Tensorflow");

        // Get Library Path 
        string LibPath = "";
        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            LibPath = Path.Combine(TensorflowPath, "Libraries", "Win64");
            isLibrarySupported = true;
        }
        else
        {
            string Err = string.Format("{0} dedicated server is made to depend on {1}. We want to avoid this, please correct module dependencies.", Target.Platform.ToString(), this.ToString()); System.Console.WriteLine(Err);
        }

        if (isLibrarySupported)
        {
            //Add Include path 
            PublicIncludePaths.AddRange(new string[] { Path.Combine(TensorflowPath, "Includes") });

            // Add Library Path 
            PublicLibraryPaths.Add(LibPath);

            //Add Static Libraries
            PublicAdditionalLibraries.Add("tensorflow_cc.lib");

            //Add Dynamic Libraries
            PublicDelayLoadDLLs.Add("tensorflow_cc.dll");
        }

        Definitions.Add(string.Format("WITH_TENSORFLOW_BINDING={0}", isLibrarySupported ? 1 : 0));
    }
}

The file "tensorflow_cc.dll" is truly in the "project/Binaries/Win64" folder. But it still shows the error. Maybe you can help me. Sorry to bother you. Thanks.

getnamo commented 4 years ago

You likely need to add the dll as a runtime dependency e.g. https://github.com/getnamo/hydra-ue4/blob/master/Source/HydraPlugin/HydraPlugin.Build.cs#L93

Closing due to not being plugin related.

asxdfd commented 4 years ago

Thanks a lot for your help. But the bug still exists.