无法使用gnustl_shared构建静态库

时间:2017-03-07 11:05:11

标签: android c++ android-ndk ndk-build

我想构建一个静态库,比如libstatic.a,与gnustl_shared链接

static.hpp

namespace Static {
  void func();
}

static.cpp

#include "static.hpp"
#include <iostream>

namespace Static {
  void func() {
    std::cout << "Static::func()." << std::endl;
  }
}

Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libstatic
LOCAL_SRC_FILES := static.cpp
include $(BUILD_STATIC_LIBRARY)

Application.mk

NDK_TOOLCHAIN_VERSION := 4.9
APP_ABI := x86_64
APP_STL := gnustl_shared
APP_PLATFORM := android-21
APP_CPPFLAGS := -std=c++11 -frtti -fexceptions
APP_OPTIM := debug

我运行ndk-build并且只复制了libgnustl_shared.so。没有生成静态库。

[x86_64] Prebuilt       : libgnustl_shared.so <= <NDK>/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/
[x86_64] Install        : libgnustl_shared.so => libs/x86_64/libgnustl_shared.so

目录结构

├── jni
│   ├── Android.mk
│   ├── Application.mk
│   ├── static.cpp
│   └── static.hpp

任何人都知道可能出现什么问题?

0 个答案:

没有答案