Fixus
Fixus

Reputation: 4641

ndk-build.cmd failed during compilation (opencv face detect)

I know there was a lot of similar topics but none of them helped and belive I'm trying to run this for over 2 days. I want to run face detection sample and I'm stuck on ndk build

Application.mk

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-23

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE:=SHARED
include C:/Users/dpach/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk

LOCAL_SRC_FILES  := DetectionBasedTracker_jni.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS     += -llog -ldl

LOCAL_MODULE     := detection_based_tracker

include $(BUILD_SHARED_LIBRARY)

app.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    defaultConfig {
        applicationId "threewe.testopencv"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    sourceSets.main {
        jniLibs.srcDir 'src/main/libs'
        jni.srcDirs = [] //disable automatic ndk-build call
    }
    task ndkBuild(type: Exec) {
        commandLine 'C:\\Users\\dpach\\android-ndk-r12\\ndk-build.cmd', '-C', file('jni').absolutePath
    }
    tasks.withType(JavaCompile) {
        compileTask -> compileTask.dependsOn ndkBuild

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha2'
    compile project(':libraries:opencv')
}

error

System nie moľe odnale«† okre?lonej ?cieľki.
make: *** [C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/obj/local/armeabi-v7a/objs/detection_based_tracker/DetectionBasedTracker_jni.o] Error 1
make: Leaving directory `C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/jni'
:app:ndkBuild FAILED
Error:Execution failed for task ':app:ndkBuild'.
> Process 'command 'C:\Users\dpach\android-ndk-r12\ndk-build.cmd'' finished with non-zero exit value 2

Translation of the error: 'System cannot find specified path'

I've checked the path and it exists I even put there file from another project but the result is the same. I've tried also to run ndk-build.cmd manualy from the console but the result is the same so this is not Android Studio issue. I have no idea what more I can do :(

// EDIT

added V=1 parameter

make: Entering directory `C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/jni'
[armeabi-v7a] "Compile++ thumb": "detection_based_tracker <= DetectionBasedTracker_jni.cpp"
C:/Users/dpach/android-ndk-r12/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/obj/local/armeabi-v7a/objs/detection_based_tracker/DetectionBasedTracker_jni.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes  -g -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp  -fno-exceptions -fno-rtti -mthumb -Os -DNDEBUG  -I"C:/Users/dpach/OpenCV-android-sdk/sdk/native/jni/include/opencv" -I"C:/Users/dpach/OpenCV-android-sdk/sdk/native/jni/include" -IC:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/jni -IC:/Users/dpach/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/include -IC:/Users/dpach/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -IC:/Users/dpach/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/backward -IC:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/jni -DANDROID -fPIC -DANDROID -fsigned-char -Wa,--noexecstack -Wformat -Werror=format-security    -frtti -fexceptions  -isystem C:/Users/dpach/android-ndk-r12/build//../platforms/android-23/arch-arm/usr/include -c  C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/jni/DetectionBasedTracker_jni.cpp -o C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/obj/local/armeabi-v7a/objs/detection_based_tracker/DetectionBasedTracker_jni.o 

Upvotes: 1

Views: 518

Answers (1)

Alex Cohn
Alex Cohn

Reputation: 57173

This is a bug on the download page of NDK, see the issue yours truly opened.

You can use the wiki page on GitHub that is updated more frequently.

In your specific case, your are using 32-bit version on your 64-bit Windows, which is suboptimal. You can download the latest stable version r12b for your OS.

Upvotes: 0

Related Questions