Search code examples
c++android-ndkjava-native-interface

Linking error using Android NDK r11


I'm facing the following problem with Android NDK r11:

/usr/local/google/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-20805/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../../android/support/src/stdio/strtod.c:3111: error: undefined reference to '__fpclassifyd' /usr/local/google/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-20805/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../../android/support/src/stdio/vfprintf.c:250: error: undefined reference to '__isfinite' collect2.exe: error: ld returned 1 exit status

My Android.mk:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
CXXFLAGS += -arch x86_64 -arch i386
LOCAL_EXPORT_C_INCLUDES = $(LOCAL_PATH)/..
#include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)

GLOBAL_C_INCLUDES := $(LOCAL_PATH)/../src 

LOCAL_SRC_FILES =  ../src/main_to_delete.cpp
LOCAL_MODULE := SomeJavaLib
LOCAL_MODULE_FILENAME := libSomeJavaLib

#LOCAL_CPP_FEATURES += exceptions
#LOCAL_CPPFLAGS += -std=c++11 
LOCAL_LDLIBS += -latomic
#LOCAL_EXPORT_CPPFLAGS := -fexceptions -frtti


include $(BUILD_SHARED_LIBRARY)

My main.cpp is just empty:

#include <jni.h>
#include <android/log.h>
#include <cstdio>
#include <iostream>

int main() {
    return 0;
}

What can be the issue?


Solution

  • I resolved this issue by downgrading the Android NDK to r10 version.