ndk build_static_library make:没有什么可以为'所有'做

时间:2013-03-27 09:04:41

标签: android android-ndk

我在eclipse中在android上构建libjpeg时遇到了问题。 jni包含Android.mk如下:

    LOCAL_PATH := $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_MODULE    := hello-jni
    LOCAL_SRC_FILES := hello-jni.c
    #LOCAL_C_INCLUDES := $(LOCAL_PATH)/jpeg8d-master
    #LOCAL_STATIC_LIBRARIES := libjpeg
    include $(BUILD_STATIC_LIBRARY)
    #include $(LOCAL_PATH)/jpeg8d-master/Android.mk

jpeg8d是我从github下载的源代码。 android.mk

LOCAL_PATH:= $(call my-dir)
# ------------------------------------------------------------------
# Static library for Cocos
# ------------------------------------------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := cocos_jpeg_static
LOCAL_MODULE_FILENAME := libjpeg
LOCAL_SRC_FILES := \
    jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
    jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
    jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
    jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
    jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c \
    jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
    jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \
    jquant2.c jutils.c jmemmgr.c jcarith.c jdarith.c jaricom.c

# Use the no backing store memory manager provided by
# libjpeg. See install.txt
LOCAL_SRC_FILES += \
    jmemnobs.c

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
include $(BUILD_STATIC_LIBRARY)

ndk-build给出提示:

  

make:“全部”没什么可做的。

但如果我设置了jpeg8d Android.mk BUILD_SHARED_LIBRARY,我会得到libjpeg.so。 我不知道为什么。任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

解决方案: 您可以通过LOCAL_MODULE_FILENAME重新定义库名称。在我的问题中,我设置了LOCAL_MODULE_FILENAME=libjpeg,但我没有添加 APP_MODULES:=cocos_jpeg_static(请记住cocos_jpeg_staic LOCAL_MODULE而非LOCAL_MODULE_FILENAME进入{em> jni 目录中的Application.mk不在 jpeg8d-master 目录。

我将此行添加到libjpeg.a

时生成Appliction.mk
APP_MODULES:=cocos_jpeg_static