1

I want to build a static library, say libstatic.a, linking with 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

I run ndk-build and only libgnustl_shared.so is copied. No static library is generated.

[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

Directory structure

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

Anyone has any idea what could be wrong?

cck
  • 11
  • 3

0 Answers0