使用 Android NDK r11 的链接错误
Linking error using Android NDK r11
我在使用 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
我的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)
我的 main.cpp 是空的:
#include <jni.h>
#include <android/log.h>
#include <cstdio>
#include <iostream>
int main() {
return 0;
}
可能是什么问题?
我通过将 Android NDK 降级到 r10 版本解决了这个问题。
https://github.com/android-ndk/ndk/issues/44
您的目标是不受支持的 API 级别(前 GB)。
我在使用 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
我的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)
我的 main.cpp 是空的:
#include <jni.h>
#include <android/log.h>
#include <cstdio>
#include <iostream>
int main() {
return 0;
}
可能是什么问题?
我通过将 Android NDK 降级到 r10 版本解决了这个问题。
https://github.com/android-ndk/ndk/issues/44
您的目标是不受支持的 API 级别(前 GB)。