NeuralVFX/basic-unreal-libtorch-plugin

Can't build after following all instructions.

Ominous opened this issue · 1 comments

I have built the dll and installed the plugin, but I am having some trouble that is causing the program to crash when I open the test scene.

UE4 is giving me this as an error:

Unhandled Exception: 0xe06d7363

KERNELBASE
VCRUNTIME140
c10
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
export_wrapper
UE4Editor_LibTorchPlugin!UcDataStorageWrapper::CallInitCV() [c:\users\chris-workpc\documents\unreal projects\ai_framework\plugins\basic-unreal-libtorch-plugin\source\libtorchplugin\private\cdatastoragewrapper.cpp:59]
UE4Editor_LibTorchPlugin!UcDataStorageGameInstance::OnStart() [c:\users\chris-workpc\documents\unreal projects\ai_framework\plugins\basic-unreal-libtorch-plugin\source\libtorchplugin\private\cdatastoragegameinstance.cpp:56]
UE4Editor_Engine
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll

The context of those 2 calls are:
51 void UcDataStorageWrapper::CallInitCV()
52 {
53 // Calls DLL Function to Activate Camera
54 if (m_funcInitCV == NULL)
55 {
56 UE_LOG(LogTemp, Error, TEXT("Function Not Loaded From DLL: InitNet"));
57 }
58 bool init = m_funcInitCV();
59 UE_LOG(LogTemp, Error, TEXT("OpenCV Connection Opened %s"), init ? "true" : "false");
}

and

52 void UcDataStorageGameInstance::OnStart()
53 {
54 // Calls DLL Function to Activate Camera
55 m_refDataStorageUtil->CallInitCV();
56 UE_LOG(LogTemp, Log, TEXT("Opened Camera"));
Super::OnStart();
}

However by commenting out the UE_Logs I still get crashes on the same lines so I suspect that it's the call before the said tracebacks.

The only deviation I have from your build instructions is my cmake file for the dll:

I used OpenCV 4.5.2 and therefore have used clarified the use of the OPEN_CV_LIB_DIR

old:
set( OpenCV_DIR C:/OpenCV/build)
set( OpenCV_INC_DIR C:/OpenCV/build/install/include)
set (OpenCV_LIB_DIR C:/OpenCV/build/lib/Release)

${OpenCV_LIB_DIR}/opencv_core412.lib
${OpenCV_LIB_DIR}/opencv_highgui412.lib
${OpenCV_LIB_DIR}/opencv_videoio412.lib
${OpenCV_LIB_DIR}/opencv_imgproc412.lib)

deviation:
set( OpenCV_DIR C:/PCTools/opencv-4.5.2_build)
set( OpenCV_INC_DIR C:/PCTools/opencv-4.5.2_build/install/include)
set (OpenCV_LIB_DIR C:/PCTools/opencv-4.5.2_build/lib/Release)

${OpenCV_LIB_DIR}/opencv_core452.lib
${OpenCV_LIB_DIR}/opencv_highgui452.lib
${OpenCV_LIB_DIR}/opencv_videoio452.lib
${OpenCV_LIB_DIR}/opencv_imgproc452.lib)

Do you know if this deviation may be causing it to fail?

I tried rebuilding with the exact lines commented out and get a different crash:

Unhandled Exception: 0xe06d7363

KERNELBASE
VCRUNTIME140
c10
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
torch_cpu
export_wrapper
UE4Editor_LibTorchPlugin!UcDataStorageGameInstance::OnStart() [c:\users\chris-workpc\documents\unreal projects\ai_framework\plugins\basic-unreal-libtorch-plugin\source\libtorchplugin\private\cdatastoragegameinstance.cpp:57]
UE4Editor_Engine
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll

from this:

52 void UcDataStorageGameInstance::OnStart()
53 {
54 // Calls DLL Function to Activate Camera
55 m_refDataStorageUtil->CallInitCV();
56 //UE_LOG(LogTemp, Log, TEXT("Opened Camera"));
57 Super::OnStart();
}

Which I guess isolates CallInitCV() ?

I'm not sure how to proceed debugging this.