Android Studio: ERROR: '__NDK_FPABI__' does not name a type

196 views
Skip to first unread message

Marcos Bontempo

unread,
Aug 2, 2016, 10:13:47 AM8/2/16
to android-ndk
Hello,

I'm with the same error as these links to build the OpenCV Face Detection example for Android:



I'm sorry for asking the same question, but the answers wasn't clear to me. I understood that the error occurs because Android Studio is using the libraries from /usr/include instead of the libraries from the NDK. However, I don't how to correct. 

Here are my files:

Android.mk

    LOCAL_PATH := $(call my-dir)
    
    include $
(CLEAR_VARS)
    
    include 
/home/marcos/Downloads/Eclipse_Android_OpenCV/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk
    
    
#OPENCV_CAMERA_MODULES:=off
    OPENCV_INSTALL_MODULES
:=on
    
#OPENCV_LIB_TYPE:=SHARED
    
    LOCAL_SRC_FILES  
:= DetectionBasedTracker_jni.cpp
    LOCAL_C_INCLUDES 
+= $(LOCAL_PATH) 
    LOCAL_LDLIBS     
+= -llog -ldl
    LOCAL_SDK_VERSION 
:= 23
    LOCAL_NDK_STL_VARIANT 
:= gnustl_static
    
    LOCAL_MODULE     
:= detection_based_tracker
    
    include $
(BUILD_SHARED_LIBRARY)



Application.mk

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



build.graddle

    apply plugin: 'com.android.application'
    
    android 
{
        compileSdkVersion 
23
        buildToolsVersion 
"23.0.2"
    
        sourceSets
.main {
            jniLibs
.srcDir 'src/main/libs'
            jni
.srcDirs = [] //disable automatic ndk-build call
        
}
    
        defaultConfig 
{
            applicationId 
"org.opencv.samples.facedetect"
            minSdkVersion 
8
            targetSdkVersion 
23
    
            ndk 
{
                moduleName 
"detection_based_tracker"
            
}
        
}
    
        buildTypes 
{
            release 
{
                minifyEnabled 
false
                proguardFiles getDefaultProguardFile
('proguard-android.txt'), 'proguard-rules.txt'
            
}
        
}
    
        tasks
.withType(JavaCompile) {
            compileTask 
-> compileTask.dependsOn ndkLibsToJar
        
}
    
        task ndkLibsToJar
(type: Zip, dependsOn: 'ndkBuild', description: 'Create a JAR of the native libs') {
            destinationDir 
new File(buildDir, 'libs')
            baseName 
'ndk-libs'
            extension 
'jar'
            
from(new File(buildDir, 'libs')) { include '**/*.so' }
            
into 'lib/'
        
}
    
        task ndkBuild
(type: Exec, description: 'Compile JNI source via NDK') {
            println
('executing ndkBuild')
            commandLine 
"/home/marcos/Downloads/Eclipse_Android_OpenCV/android-ndk-r12b/ndk-build",
                    
'NDK_PROJECT_PATH=build',
                    
'APP_BUILD_SCRIPT=src/main/jni/Android.mk',
                    
'NDK_APPLICATION_MK=src/main/jni/Application.mk'
        
}
    
}
    
    dependencies 
{
        compile project
(':openCVLibrary2411')
    
}



And here are the errors:

    Error:(856, 5) error: '__NDK_FPABI__' does not name a type
    
Error:(36, 2) error: #error Bionic header ctype.h does not define either _U nor _CTYPE_U
    
Error:(62, 35) error: '_CTYPE_U' was not declared in this scope
    
Error:(63, 32) error: '_CTYPE_L' was not declared in this scope
    
Error:(64, 32) error: '_CTYPE_U' was not declared in this scope
    
Error:(64, 37) error: '_CTYPE_L' was not declared in this scope
    
Error:(65, 32) error: '_CTYPE_N' was not declared in this scope
    
Error:(66, 33) error: '_CTYPE_X' was not declared in this scope
    
Error:(66, 38) error: '_CTYPE_N' was not declared in this scope
    
Error:(67, 32) error: '_CTYPE_S' was not declared in this scope
    
Error:(68, 32) error: '_CTYPE_P' was not declared in this scope
    
Error:(68, 37) error: '_CTYPE_U' was not declared in this scope
    
Error:(68, 42) error: '_CTYPE_L' was not declared in this scope
    
Error:(68, 47) error: '_CTYPE_N' was not declared in this scope



Does anybody know how to correct it? 

Any tip will be very helpful,

Thanks.

Dan Albert

unread,
Aug 2, 2016, 12:55:53 PM8/2/16
to android-ndk

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/236bbcbe-2f22-4bea-8190-6c8db9a5eb50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dan Albert

unread,
Aug 2, 2016, 1:07:17 PM8/2/16
to android-ndk
Actually, that's not the same bug. Looked similar at first glance though.
 
APP_PLATFORM := android-8

Obsolete. That platform isn't in r12b. Change that to 9 and it'll fix at least one class of issues if not all of them.

LOCAL_SDK_VERSION := 23

This is a no op, btw. LOCAL_SDK_VERSION means nothing in the NDK.

Reply all
Reply to author
Forward
0 new messages