Lauszus / FaceRecognitionApp

Face Recognition Android App
GNU General Public License v2.0
507 stars 238 forks source link

External Native Build Issues #15

Closed rahulr4 closed 6 years ago

rahulr4 commented 6 years ago

Getting the below error

External Native Build Issues

Build command failed.
Error while executing process /Users/rahulgupta/Library/Android/sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Rahul/FaceRecognitionApp-master/app/src/main/cpp/Android.mk NDK_APPLICATION_MK=/Rahul/FaceRecognitionApp-master/app/src/main/cpp/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-15 NDK_OUT=/Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=/Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/release/lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
rm -f /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/*
rm -f /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/gdbserver
rm -f /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/release/lib/armeabi-v7a/gdb.setup
mkdir -p /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/face-lib//Rahul/FaceRecognitionApp-master/app/src/main/cpp
echo [armeabi-v7a] "Compile++ thumb": "face-lib <= face-lib.cpp"
/Users/rahulgupta/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -MMD -MP -MF /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/face-lib//Rahul/FaceRecognitionApp-master/app/src/main/cpp/face-lib.o.d -gcc-toolchain /Users/rahulgupta/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -no-canonical-prefixes -fno-integrated-as -g -target armv7-none-linux-androideabi15 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-exceptions -fno-rtti -mthumb -Os -DNDEBUG  -I/Rahul/FaceRecognitionApp-master/app/src/main/cpp/FaceRecognitionLib/RedSVD/include -I/Users/rahulgupta/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -I/Users/rahulgupta/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -I/Users/rahulgupta/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -I/Rahul/FaceRecognitionApp-master/app/src/main/cpp   -std=gnu++11 -frtti -fexceptions -DNDEBUG  -DANDROID  -D__ANDROID_API__=15 -Wa,--noexecstack -Wformat -Werror=format-security -std=gnu++11 -frtti -fexceptions  --sysroot /Users/rahulgupta/Library/Android/sdk/ndk-bundle/sysroot -isystem /Users/rahulgupta/Library/Android/sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -c  /make: *** No rule to make target `/Rahul/FaceRecognitionApp-master/app/src/main/cpp/FaceRecognitionLib/Facebase.cpp', needed by `/Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/face-lib//Rahul/FaceRecognitionApp-master/app/src/main/cpp/FaceRecognitionLib/Facebase.o'.  Stop.
Rahul/FaceRecognitionApp-master/app/src/main/cpp/face-lib.cpp -o /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/face-lib//Rahul/FaceRecognitionApp-master/app/src/main/cpp/face-lib.o
Build command failed.
Error while executing process /Users/rahulgupta/Library/Android/sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Rahul/FaceRecognitionApp-master/app/src/main/cpp/Android.mk NDK_APPLICATION_MK=/Rahul/FaceRecognitionApp-master/app/src/main/cpp/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-15 NDK_OUT=/Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/lib NDK_DEBUG=1 NDEBUG=null APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
rm -f /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/*
rm -f /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdbserver
rm -f /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup
mkdir -p /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a
echo [armeabi-v7a] "Gdbserver      ": "[arm-linux-androideabi] /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdbserver"
install -p /Users/rahulgupta/Library/Android/sdk/ndk-bundle/prebuilt/android-arm/gdbserver/gdbserver /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdbserver
echo [armeabi-v7a] "Gdbsetup       ": "/Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup"
echo "set solib-search-path /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a" > /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup
echo "directory /Users/rahulgupta/Library/Android/sdk/ndk-bundle/sysroot /Rahul/FaceRecognitionApp-master/app/src/main/cpp/FaceRecognitionLib/RedSVD/include /Users/rahulgupta/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include /Users/rahulgupta/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include /Users/rahulgupta/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward" >> /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup
mkdir -p /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/face-lib//Rahul/FaceRecognitionApp-master/app/src/main/cpp
echo [armeabi-v7a] "Compile++ thumb": "face-lib <= face-lib.cpp"
/Users/rahulgupta/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -MMD -MP -MF /Rahul/FaceRecognmake: *** No rule to make target `/Rahul/FaceRecognitionApp-master/app/src/main/cpp/FaceRecognitionLib/Facebase.cpp', needed by `/Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/face-lib//Rahul/FaceRecognitionApp-master/app/src/main/cpp/FaceRecognitionLib/Facebase.o'.  Stop.
itionApp-master/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/face-lib//Rahul/FaceRecognitionApp-master/app/src/main/cpp/face-lib.o.d -gcc-toolchain /Users/rahulgupta/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -no-canonical-prefixes -fno-integrated-as -g -target armv7-none-linux-androideabi15 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-exceptions -fno-rtti -mthumb -O0 -UNDEBUG -fno-limit-debug-info  -I/Rahul/FaceRecognitionApp-master/app/src/main/cpp/FaceRecognitionLib/RedSVD/include -I/Users/rahulgupta/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -I/Users/rahulgupta/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -I/Users/rahulgupta/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -I/Rahul/FaceRecognitionApp-master/app/src/main/cpp   -std=gnu++11 -frtti -fexceptions  -DANDROID  -D__ANDROID_API__=15 -Wa,--noexecstack -Wformat -Werror=format-security -std=gnu++11 -frtti -fexceptions  --sysroot /Users/rahulgupta/Library/Android/sdk/ndk-bundle/sysroot -isystem /Users/rahulgupta/Library/Android/sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -c  /Rahul/FaceRecognitionApp-master/app/src/main/cpp/face-lib.cpp -o /Rahul/FaceRecognitionApp-master/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/face-lib//Rahul/FaceRecognitionApp-master/app/src/main/cpp/face-lib.o
Lauszus commented 6 years ago

Please read the build instructions carefully: https://github.com/Lauszus/FaceRecognitionApp#build-instructions and take a look at all the old issues: https://github.com/Lauszus/FaceRecognitionApp/issues?q=is%3Aissue+is%3Aclosed.

Anyway, it looks like you have not cloned the submodules, so please run:

git submodule update --init --recursive
rahulr4 commented 6 years ago

All the below errors are coming after successfully compilation by following the instructions :

/Rahul/Face/FaceRecognitionApp/app/src/main/cpp/FaceRecognitionLib/OpenCV-android-sdk_2/sdk/native/jni/include/opencv2/core/eigen.hpp
Error:(151) undefined reference to 'cv::transpose(cv::_InputArray const&, cv::_OutputArray const&)'
Error:(154) undefined reference to 'cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
Error:(155) undefined reference to 'cv::transpose(cv::_InputArray const&, cv::_OutputArray const&)'
Error:(158) undefined reference to 'cv::Mat::t() const'
Error:(158) undefined reference to 'cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
Error:(164) undefined reference to 'cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
Error:(192) undefined reference to 'cv::error(int, cv::String const&, char const*, char const*, int)'
Error:(200) undefined reference to 'cv::transpose(cv::_InputArray const&, cv::_OutputArray const&)'
Error:(202) undefined reference to 'cv::Mat::t() const'
Error:(202) undefined reference to 'cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
/Rahul/Face/FaceRecognitionApp/app/src/main/cpp/FaceRecognitionLib/OpenCV-android-sdk_2/sdk/native/jni/include/opencv2/core/cvstd.hpp
Error:(622) undefined reference to 'cv::String::allocate(unsigned int)'
Error:(664) undefined reference to 'cv::String::deallocate()'
/Rahul/Face/FaceRecognitionApp/app/src/main/cpp/FaceRecognitionLib/OpenCV-android-sdk_2/sdk/native/jni/include/opencv2/core/mat.inl.hpp
Error:(431) undefined reference to 'cv::error(int, cv::String const&, char const*, char const*, int)'
Error:(447) undefined reference to 'cv::error(int, cv::String const&, char const*, char const*, int)'
Error:(592) undefined reference to 'cv::fastFree(void*)'
Error:(704) undefined reference to 'cv::Mat::deallocate()'
Error:error: linker command failed with exit code 1 (use -v to see invocation)
Lauszus commented 6 years ago

Hmm which versions of OpenCV and Eigen have you downloaded?

rahulr4 commented 6 years ago

The version mentioned in instructions - OpenCV 3.2.0 and Eigen3 3.3.3. Also I am using mac so these libraries were not being read inside the code so i added these libraries inside the FaceRecognitionLib folder and added the lines in Android.mk.

LOCAL_C_INCLUDES += $(LOCAL_PATH)/FaceRecognitionLib/eigen-eigen-67e894c6cd8f
LOCAL_C_INCLUDES += $(LOCAL_PATH)/FaceRecognitionLib/OpenCV-android-sdk_2/sdk/native/jni/include
rahulr4 commented 6 years ago

any update ?

Lauszus commented 6 years ago

@rahulr4 you should not include the the OpenCV headers. You should not add anything to the Makefile, simply just hardcode the paths if you are having troubles with setting the environmental variables. For instance it could be hardcoded like so:

include /Users/rahulr4/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk
LOCAL_C_INCLUDES += /Users/rahulr4/eigen-eigen-67e894c6cd8f
sparxapps commented 6 years ago

@rahulr4 I my case I have used hard coded path as below

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

OPENCV_INSTALL_MODULES := on
include /home/demo/Workspace_Android_Studio/Samples/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk 

LOCAL_MODULE := face-lib
LOCAL_SRC_FILES += $(LOCAL_PATH)/face-lib.cpp $(LOCAL_PATH)/FaceRecognitionLib/Facebase.cpp
LOCAL_SRC_FILES += $(LOCAL_PATH)/FaceRecognitionLib/Eigenfaces.cpp $(LOCAL_PATH)/FaceRecognitionLib/Fisherfaces.cpp
LOCAL_SRC_FILES += $(LOCAL_PATH)/FaceRecognitionLib/PCA.cpp $(LOCAL_PATH)/FaceRecognitionLib/LDA.cpp
LOCAL_C_INCLUDES += $(EIGEN3_DIR) $(LOCAL_PATH)/FaceRecognitionLib/RedSVD/include
LOCAL_LDLIBS += -llog -ldl
LOCAL_CPPFLAGS += -std=gnu++11 -frtti -fexceptions

include $(BUILD_SHARED_LIBRARY)
Lauszus commented 6 years ago

Please try to hardcode EIGEN3_DIR as well i.e:

LOCAL_C_INCLUDES += /Users/rahulr4/eigen-eigen-67e894c6cd8f $(LOCAL_PATH)/FaceRecognitionLib/RedSVD/include
Lauszus commented 6 years ago

Closing this issue, as the project build fine when following the build instructions.

Lauszus commented 6 years ago

I have now setup a Travis build to automatically upload a zip directory of the project including all the dependencies. This should make much easier for people to compile the project.

You can try it out at the following link: https://github.com/Lauszus/FaceRecognitionApp/releases/download/1.2.1/FaceRecognitionApp-1.2.1.zip.