Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libtensorflowlite_c.dll issue #39

Closed
victorx79 opened this issue Jul 23, 2020 · 20 comments
Closed

libtensorflowlite_c.dll issue #39

victorx79 opened this issue Jul 23, 2020 · 20 comments
Labels
bug Something isn't working Windows

Comments

@victorx79
Copy link

I got this error when i try to run. please let me know

Plugins: Failed to load 'Assets/plugins/Windows/libtensorflowlite_c.dll' because one or more of its dependencies could not be loaded.
TensorFlowLite.BaseImagePredictor`1:.ctor(String, Boolean) (at Assets/Samples/Common/BaseImagePredictor.cs:34)
TensorFlowLite.DeepLab:.ctor(String, ComputeShader) (at Assets/Samples/DeepLab/DeepLab.cs:51)
DeepLabSample:Start() (at Assets/Samples/DeepLab/DeepLabSample.cs:22)

@asus4 asus4 added the bug Something isn't working label Jul 24, 2020
@asus4 asus4 added the Windows label Aug 4, 2020
@asus4
Copy link
Owner

asus4 commented Aug 11, 2020

Hmm, it seems to be a dependency error. but I couldn't reproduce it. Are there any other error messages? Can you share the UnityEditor's log?

@cyraxchel
Copy link

Hello.
I got this same dependency issue. I decided to rebuild the tflite libraries myself. Prepared the build environment ... and after that the message about dependencies in Unity disappeared.

@asus4
Copy link
Owner

asus4 commented Aug 14, 2020

@cyraxchel Thanks for your report. Just to clarify, Did the error disappear before you built the library yourself?

@cyraxchel
Copy link

cyraxchel commented Aug 14, 2020

@cyraxchel Thanks for your report. Just to clarify, Did the error disappear before you built the library yourself?

I failed rebuild library (some error in VC). I keep using your library. :)

UPD: win 10, Unity: 2019.1.6f1 and Unity 2019.4.8f1

@SBeyer6
Copy link

SBeyer6 commented Sep 16, 2020

I seem to get this issue as well; It works on two different PCs but on another PC it the plugin fails to load, with the same error.

@asus4
Copy link
Owner

asus4 commented Sep 16, 2020

Could you check which dependencies are missing using app like this?
https://kb.froglogic.com/misc/using-dependency-walker/

@SBeyer6
Copy link

SBeyer6 commented Sep 16, 2020

Ok I checked, it seemed like the latest vc 2019 redistributable was installed.

@cwule
Copy link

cwule commented Sep 21, 2020

Trying to build for Windows 10 UWP Arm64 application leads to the same error:
Exception thrown at 0x00007FFDF75539EC in tf-lite-unity-sample.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x0000009FF8CFCA60. DllNotFoundException: Unable to load DLL 'libtensorflowlite_c': The specified module could not be found. at TensorFlowLite.InterpreterOptions.TfLiteInterpreterOptionsCreate () [0x00000] in <00000000000000000000000000000000>:0 at TensorFlowLite.InterpreterOptions..ctor () [0x00000] in <00000000000000000000000000000000>:0 at TensorFlowLite.BaseImagePredictor1[T]..ctor (System.String modelPath, System.Boolean useGPU) [0x00000] in <00000000000000000000000000000000>:0 at TensorFlowLite.PoseNet..ctor (System.String modelPath) [0x00000] in <00000000000000000000000000000000>:0 at PoseNetSample.Start () [0x00000] in <00000000000000000000000000000000>:0

Would be great to add support for UWP Arm64 as well (needed for Hololens 2 development).

@vaibhav-suri
Copy link

Plugins: Failed to load 'V:/HandTracking/tflite/tf-lite-unity-sample-master/Packages/com.github.asus4.tflite/Plugins/Windows/libtensorflowlite_c.dll' because one or more of its dependencies could not be loaded.

Getting this error,any idea how to fix?

@SBeyer6
Copy link

SBeyer6 commented Oct 31, 2020

@vaibhav-suri I managed to fix this error by installing both the x86 and x64 Visual C++ 2019 Redistributable.
Hope this works for you as well.

@vaibhav-suri
Copy link

@SBeyer6 Thanks a lot! That worked.

@Cipher-zzz
Copy link

@cwule got the same error when developing Hololens 2 App, did you solve that issue? Or if there is any idea to approach. Thanks in advance.

@cyraxchel
Copy link

@cwule got the same error when developing Hololens 2 App, did you solve that issue? Or if there is any idea to approach. Thanks in advance.

Please, check corerct version VC installed. When I install VS 2019, it fix error. Before was VS 2017.. Sorry, I don't remember, which versions on both Visual Studio on.

@Cipher-zzz
Copy link

@cyraxchel Thanks for your response. I have tried both VS 2019 and VS 2022, with VC 2019 redistributable installed, same error:

DllNotFoundException: Unable to load DLL 'libtensorflowlite_c': The specified module could not be found.
  at TensorFlowLite.InterpreterOptions.TfLiteInterpreterOptionsCreate () [0x00000] in <00000000000000000000000000000000>:0 
  at TensorFlowLite.InterpreterOptions..ctor () [0x00000] in <00000000000000000000000000000000>:0 
  at TensorFlowLite.BaseImagePredictor`1[T]..ctor (System.String modelPath, System.Boolean useGPU) [0x00000] in <00000000000000000000000000000000>:0 
  at TensorFlowLite.SSD..ctor (System.String modelPath) [0x00000] in <00000000000000000000000000000000>:0 
  at SsdSample.Start () [0x00000] in <00000000000000000000000000000000>:0 

I think the reason for this error could be different from the one in the origin post. I checked the DLL file 'libtensorflowlite_c' in Unity, it seems only support x86 and x64. However, I am building the project into HoloLens 2 which is ARM64, which should be the reason why this happened.

I don't have much experience in Unity development, I am not sure what does that DLL file is for and how to make it support ARM64 devices. I will appreciate that if you can give me some ideas. @asus4

@asus4
Copy link
Owner

asus4 commented Dec 28, 2021

@Cipher-zzz
I haven't tried building it. But I think you can cross-compile it by adding build options in bazel.
https://www.tensorflow.org/lite/guide/build_arm

To build a dll for Windows, please refer to the build script build_tflite.py

def build_windows(enable_xnnpack = False):
# Main
option_xnnpack = 'true' if enable_xnnpack else 'false'
run_cmd(f'bazel build -c opt --define tflite_with_xnnpack={option_xnnpack} tensorflow/lite/c:tensorflowlite_c')
copy('bazel-bin/tensorflow/lite/c/tensorflowlite_c.dll', 'Windows/libtensorflowlite_c.dll')

@Cipher-zzz
Copy link

@asus4 Thank you! I will have a try.

@siri-sinthawat
Copy link

@Cipher-zzz The same error is happening to me. Can it be fixed?

@Cipher-zzz
Copy link

@siri-sinthawat I am temporarily working on another project, haven't tried it yet. I will comment here if there is any update.

@fatlinlin
Copy link

the same error happen on my mac pro

@asus4
Copy link
Owner

asus4 commented Aug 17, 2022

Did you pull Git LFS files? All libs are in Git LFS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows
Projects
None yet
Development

No branches or pull requests

9 participants