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

A dynamic link library (DLL) initialization routine failed. #43130

Closed
FriedaSmith opened this issue Sep 11, 2020 · 7 comments
Closed

A dynamic link library (DLL) initialization routine failed. #43130

FriedaSmith opened this issue Sep 11, 2020 · 7 comments
Assignees
Labels
stat:awaiting response Status - Awaiting response from author subtype:windows Windows Build/Installation Issues TF 1.14 for issues seen with TF 1.14 type:build/install Build and install issues

Comments

@FriedaSmith
Copy link

FriedaSmith commented Sep 11, 2020

Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Window 10
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): libtensorflow_jni-cpu-windows-x86_64-1.14.0
  • TensorFlow version: 1.14

Describe the problem
So I was trying to run `` using a guide for windows 10 and I followed the guide exactly as it said to.
line 108 in org/tensorflow/NativeLibrary.java: System.load(extractResource(jniResource, jniLibName, tempDirectory));, the exception occurred:

Exception in thread "main" java.lang.UnsatisfiedLinkError: I:\Code\Android\test\SpeechRecognition_tf_lite\lib\tensorflow_jni.dll: A dynamic link library (DLL) initialization routine failed.
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at org.tensorflow.NativeLibrary.load(NativeLibrary.java:108)
at org.tensorflow.TensorFlow.init(TensorFlow.java:67)
at org.tensorflow.TensorFlow.(TensorFlow.java:82)
at org.tensorflow.Graph.(Graph.java:479)
at TFInterface.TensorFlowInferenceInterface.(TensorFlowInferenceInterface.java:61)
at ASR.Chain.(Chain.java:60)
at ASR.ASR.main(ASR.java:6)

@FriedaSmith FriedaSmith added the type:build/install Build and install issues label Sep 11, 2020
@ravikyram
Copy link
Contributor

@FriedaSmith

What is make/model of your cpu?
I suspect your cpu model does not support AVX instructions sets.See hardware requirements
Make sure to download the latest microsoft visual c++ redistributable from here.
.Also, please follow the instructions from to install from Tensorflow website.

Please, check Your CPU/Python is on 32 bits?Please, refer #36167 and see if it helps you.
Please, refer similar issue #36167 #36151 #36138 #36054 #36045 #36020 #36003 #35988 #35903 #35880 #35865 #35805 #35789 #35773 #35772 #35767 #35766 #35749 #35721 #35618 #35204
Thanks!

@ravikyram ravikyram added subtype:windows Windows Build/Installation Issues TF 1.14 for issues seen with TF 1.14 stat:awaiting response Status - Awaiting response from author labels Sep 11, 2020
@FriedaSmith
Copy link
Author

@ravikyram Hello. Must source code be used to build tensorflow? Can only libtensorflow_jni-cpu-windows-x86_64-1.14.0/tensorflow_jni.dll and libtensorflow-1.14.0.jar be used tensorflow?
In eclipse, I just use System.load (extractresource (jniresource, jnilibname, tempdirectory)) function loads tensorflow_ jni.dll. I also installed latest microsoft visual c++ redistributable.
CPU: intel core i7 880 64bit

@ravikyram
Copy link
Contributor

@FriedaSmith

Please, provide the exact sequence of commands / steps that you executed before running into the problem. Thanks!

@FriedaSmith
Copy link
Author

  1. Go to: https://www.tensorflow.org/install/lang_java and download libtensorflow.jar and Java Native Interface (JNI) file, save it to project root;
  2. Copy Example code from https://www.tensorflow.org/install/lang_java and save HelloTensorFlow .java

import org.tensorflow.Graph;
import org.tensorflow.Session;
import org.tensorflow.Tensor;
import org.tensorflow.TensorFlow;

public class HelloTensorFlow {
public static void main(String[] args) throws Exception {
try (Graph g = new Graph()) {
final String value = "Hello from " + TensorFlow.version();
try (Tensor t = Tensor.create(value.getBytes("UTF-8"))) {
g.opBuilder("Const", "MyConst").setAttr("dtype", t.dataType()).setAttr("value", t).build();
}

		try (Session s = new Session(g); Tensor output = s.runner().fetch("MyConst").run().get(0)) {
			System.out.println(new String(output.bytesValue(), "UTF-8"));
		}
	}
}

}

  1. Put HelloTensorFlow.java, libtensorflow.jar, and tensorflow_jni.dll in the same directory.
  2. Run the command: javac -cp libtensorflow-1.3.0.jar HelloTensorFlow.java and java -cp libtensorflow-1.3.0.jar;. -Djava.library.path=jni HelloTensorFlow.
    I:\Code\Android\test\test>javac -cp libtensorflow-1.3.0.jar HelloTensorFlow.java
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

I:\Code\Android\test\test>java -cp libtensorflow-1.3.0.jar;. -Djava.library.path=jni HelloTensorFlow
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot find TensorFlow native library for OS: windows, architecture: x86_64. See https://github.com/tensorflow/tensorflow/tree/master/tensorflow/java/README.md for possible solutions (such as building the library from source). Additional information on attempts to find the native library can be obtained by adding org.tensorflow.NativeLibrary.DEBUG=1 to the system properties of the JVM.
at org.tensorflow.NativeLibrary.load(NativeLibrary.java:66)
at org.tensorflow.TensorFlow.init(TensorFlow.java:36)
at org.tensorflow.TensorFlow.(TensorFlow.java:40)
at org.tensorflow.Graph.(Graph.java:194)
at HelloTensorFlow.main(HelloTensorFlow.java:8)

@ravikyram ravikyram assigned gowthamkpr and unassigned ravikyram Sep 11, 2020
@tensorflowbutler tensorflowbutler removed the stat:awaiting response Status - Awaiting response from author label Sep 13, 2020
@gowthamkpr
Copy link

@FriedaSmith Please take a look at this issue and let me know it it helps.!

@gowthamkpr gowthamkpr added the stat:awaiting response Status - Awaiting response from author label Sep 17, 2020
@FriedaSmith
Copy link
Author

@gowthamkpr Thank you. This is a CPU problem. So I changed my computer and it worked.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Status - Awaiting response from author subtype:windows Windows Build/Installation Issues TF 1.14 for issues seen with TF 1.14 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

4 participants