Qualeams / Android-Face-Recognition-with-Deep-Learning-Library

Face Recognition library for Android devices is an Android library (module) which includes several face recognition methods.
Apache License 2.0
371 stars 135 forks source link

Unable to create so file with the make file that has been provided #7

Closed Zumbalamambo closed 7 years ago

Zumbalamambo commented 7 years ago

Im trying to convert tensorflow c++ files into so file

Following is the make file as in the project

build:
    ndk-build

install:
    cp -r libs/armeabi-v7a/*.so ../src/main/jniLibs/armeabi-v7a/
    cp -r libs/arm64-v8a/*.so ../src/main/jniLibs/arm64-v8a/

clean:
    ndk-build clean

But it is not building so file. What am I missing?

sladomic commented 7 years ago

What error do you get?

Zumbalamambo commented 7 years ago

This is the error that im getting

rk-master/facerecognitionlibrary/jni-build/Makefile: line 1: build:: command not found
/Users/Zumbala/Documents/Android-Face-Recognition-with-Deep-Learning-Test-Framework-master/facerecognitionlibrary/jni-build/Makefile: line 2: ndk-build: command not found
/Users/Zumbala/Documents/Android-Face-Recognition-with-Deep-Learning-Test-Framework-master/facerecognitionlibrary/jni-build/Makefile: line 4: install:: command not found
cp: directory ../src/main/jniLibs/armeabi-v7a does not exist
cp: directory ../src/main/jniLibs/arm64-v8a does not exist
/Users/Zumbala/Documents/Android-Face-Recognition-with-Deep-Learning-Test-Framework-master/facerecognitionlibrary/jni-build/Makefile: line 8: clean:: command not found
/Users/Zumbala/Documents/Android-Face-Recognition-with-Deep-Learning-Test-Framework-master/facerecognitionlibrary/jni-build/Makefile: line 9: ndk-build: command not found
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Zumbalamambo commented 7 years ago

Thats the error that im getting. How will I be able to compile tensorflow cpp files to so file? or is it possible to import the entire raw c++ files into the library and try it without converting it to so file? I have tried asking this question in stackoverflow but no response.

sladomic commented 7 years ago

You need to add the Android Ndk path to your PATH (if on Linux/OSX). I think the Makefile is only supported for Unix systems (so no Windows).

Zumbalamambo commented 7 years ago

Yes Thank you .now executing the make file fires the following error message,

Android NDK: Could not find application project directory !    
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.    
/Users/Zumbala/Library/Android/sdk/ndk-bundle/build/core/build-local.mk:151: *** Android NDK: Aborting    .  Stop.
sladomic commented 7 years ago

@Zumbalamambo Did you try to execute "make" in the "jni-build" directory?

Zumbalamambo commented 7 years ago

Ok now i have tried executing in jni-build directory but it threw some error like,

ndk-build
Android NDK: WARNING:jni/Android.mk:tensorflow: non-system libraries in linker flags: jni/libs/armeabi-v7a/libprotos_all_cc.a jni/libs/armeabi-v7a/libprotobuf.a jni/libs/armeabi-v7a/libprotobuf_lite.a /Users/Zumbala/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_static.a /Users/Zumbala/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libsupc++.a    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
Android NDK: WARNING:jni/Android.mk:tensorflow: non-system libraries in linker flags: jni/libs/arm64-v8a/libprotos_all_cc.a jni/libs/arm64-v8a/libprotobuf.a jni/libs/arm64-v8a/libprotobuf_lite.a /Users/Zumbala/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/libgnustl_static.a /Users/Zumbala/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/libsupc++.a    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
[armeabi-v7a] Install        : libjnilibsvm.so => libs/armeabi-v7a/libjnilibsvm.so
[armeabi-v7a] Compile++ arm  : tensorflow <= tensorflow_jni.cc
In file included from jni/tensorflow_jni.cc:31:0:
jni/genfiles/tensorflow/core/framework/step_stats.pb.h:9:42: fatal error: google/protobuf/stubs/common.h: No such file or directory
 #include <google/protobuf/stubs/common.h>
                                          ^
compilation terminated.
make[1]: *** [obj/local/armeabi-v7a/objs/tensorflow/tensorflow_jni.o] Error 1
make: *** [build] Error 2

I have tried installing brew protobuf too

sladomic commented 7 years ago

Did you follow exactly these steps? https://github.com/Qualeams/Android-Face-Recognition-with-Deep-Learning-Library/issues/1

It's important, that you use the right Protobuf version. Therefore download Tensorflow as follows:

git clone --recursive https://github.com/tensorflow/tensorflow.git

With --recursive you include the submodules (e.g. protobuf). Then after building, place all the files in the correct directory. And then execute make.

Zumbalamambo commented 7 years ago

I have downloaded it using git clone --recursive https://github.com/tensorflow/tensorflow.git. I have placed it within jni-build filder and tried make . Im getting the same error :(

Zumbalamambo commented 7 years ago

When i tried to build with bazel, I got this error Unexpected error reading .blazerc file '/Users/Zumbala/Documents/Android-Face-Recognition-with-Deep-Learning-Test-Framework-master/facerecognitionlibrary/jni-build/tensorflow/.tf_configure.bazelrc'

sladomic commented 7 years ago

Try first if you can build the TensorFlow Android Demo in general:

Go to the Tensorflow folder and execute: bazel build -c opt //tensorflow/examples/android:tensorflow_demo

Zumbalamambo commented 7 years ago

Okay now it works with make. Thank you

sladomic commented 7 years ago

I'm glad, that it works. For me it's the same. Everytime I upgrade to a new TensorFlow version, I first struggle with building even the simplest examples. This project has just too many dependencies :)