Dan M. Katz
Dan M. Katz

Reputation: 337

ADT tool chain not producing output for static libraries

Trying to build a static NDK library using Android's ADT Eclipse tool chain. However, whenever I build with BUILD_STATIC_LIBRARY, no output is produced: I get the message

make: Nothing to be done for `all'."

Any recommendations?

LOCAL_PATH          := $(call my-dir)
STL_PATH            := "C:/Android/ndk/sources/cxx-stl/gnu-libstdc++/4.6/include"
PLATFORM_INCLUDE    := "C:/Android/ndk/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include"
APP_STL             := gnustl_static

include $(CLEAR_VARS)

LOCAL_MODULE        := libCore
LOCAL_CPPFLAGS      += -std=c++11 -fexceptions -D_OS_ANDROID
LOCAL_LDLIBS        := -lGLESv2 -lEGL -lstdc++

LOCAL_C_INCLUDES    += $(LOCAL_PATH)/Headers
...

LOCAL_SRC_FILES     += Source/Engine/Game.cpp
...

include $(BUILD_STATIC_LIBRARY)

Upvotes: 1

Views: 939

Answers (1)

appsroxcom
appsroxcom

Reputation: 2821

Here is the content of Android.mk file of two-libs sample project from Android NDK.

LOCAL_PATH:= $(call my-dir)

# first lib, which will be built statically
#
include $(CLEAR_VARS)

LOCAL_MODULE    := libtwolib-first
LOCAL_SRC_FILES := first.c

include $(BUILD_STATIC_LIBRARY)

# second lib, which will depend on and include the first one
#
include $(CLEAR_VARS)

LOCAL_MODULE    := libtwolib-second
LOCAL_SRC_FILES := second.c

LOCAL_STATIC_LIBRARIES := libtwolib-first

include $(BUILD_SHARED_LIBRARY)

You may try building the static library as part of another shared library as shown in the example.

I just did a ndk-build on the two-libs sample project and i could see the .a file along with .so in obj\local\armeabi directory.

Edit: By default, ndk-build will only build shared libraries and executables, and the modules they depend on. To force a build specify libCore in APP_MODULES as follows.

APP_MODULES := libCore

or in command line as

ndk-build APP_MODULES=libCore

Upvotes: 2

Related Questions