miyosuda / TensorFlowAndroidMNIST

Tensorflow MNIST demo on Android
265 stars 108 forks source link

android ndk api_level=9 #2

Open InsightDev opened 8 years ago

InsightDev commented 8 years ago

android_sdk_repository( name = "androidsdk", api_level = 23, build_tools_version = "23.0.1", path = "/home/gzzhang/android-sdk", )

android_ndk_repository( name="androidndk", path="/opt/android-ndk", api_level=9, << ==================== )

can you build the "tensorflow android libs" with android ndk api_level=9.

if you build them with android ndk api_level=21, the libs can't be used below android 5.0

because some functions can't been found.

SO, can you down the android ndk api_level to 9.


I have do something, but when invoke: tensorflow::NewSession(options)

and, it print message: Not found: Could not find session factory for DIRECT_SESSION

miyosuda commented 8 years ago

Sorry I didn't notice your post and found it just now.

I tried to build with "api_level=9" & android-ndk-r10e, This error occurred.

INFO: From Compiling tensorflow/examples/android/jni/jni_utils.cc:
In file included from tensorflow/examples/android/jni/jni_utils.cc:33:0:
./tensorflow/examples/android/jni/limiting_file_input_stream.h: In member function 'virtual int tensorflow::android::LimitingFileInputStream::Read(void*, int)':
./tensorflow/examples/android/jni/limiting_file_input_stream.h:39:28: error: 'errno' was not declared in this scope
     } while (result < 0 && errno == EINTR);
                            ^
./tensorflow/examples/android/jni/limiting_file_input_stream.h:39:37: error: 'EINTR' was not declared in this scope
     } while (result < 0 && errno == EINTR);
                                     ^

Did you modify tensorflow source to pass building with api_level9?

InsightDev commented 8 years ago

@miyosuda

The past few days, I have done something.

Because I want the libandroid_tensorflow_lib.a, so the android_demo is not importance for me.

I just comment out these: while (result < 0 && errno == EINTR)

then with android-ndk-r10e and api_level=9, the build is success.

After got the libandroid_tensorflow_lib.a, now I develop app under Windows with Android.mk and the libs.


Under Windows, Android-ndk-r10e is also needed, otherwise, it can't find session factory for DIRECT_SESSION.

“Not found: Could not find session factory for DIRECT_SESSION”

miyosuda commented 8 years ago

@tiny-app Ah I see, the error code is from android sample, and not from library itself. OK.

I'll try.

ChimneyCake commented 7 years ago

Hi, could you help me make this work on api=15? Thanks in advance :)