android.mk LOCAL_MODULE_FILENAME不应包含扩展名

时间:2014-01-03 10:03:26

标签: android ffmpeg android.mk

我正在尝试构建libavcodeclibavutil

中的一些文件

关注this,我创建了Android.mk文件,如下所示:

jni/Android.mk包含

LOCAL_PATH := $(call my-dir)

FFMPEG_TOP := $(LOCAL_PATH)

include $(CLEAR_VARS)

include $(FFMPEG_TOP)/libavutil/Android.mk
include $(FFMPEG_TOP)/libavcodec/Android.mk



LOCAL_PATH := $(FFMPEG_TOP)
LOCAL_MODULE := mylib
LOCAL_ARM_MODE := arm  # remove this if you want thumb mode
LOCAL_SRC_FILES := myfunc1.c myfunc2.c maincfunction.c 3rdparty1.c 3rdparty2.c

LOCAL_SRC_FILES += libavcodec.a libavutil.a

LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)

jni/libavcodec/Android.mk包含

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

SOURCE_H264_DECODER += h264.c h264idct.c h264pred.c h264_parser.c cabac.c
SOURCE_H264_ENCODER += h264enc.c h264dspenc.c

SOURCE_HAVE_ARM = \
    arm/dsputil_arm.c        \
    arm/dsputil_arm_s.S        \
    arm/jrevdct_arm.S \
    arm/mpegvideo_arm.c        \
    arm/simple_idct_arm.S

SOURCE_HAVE_ARMV5TE = \
    arm/mpegvideo_armv5te.c \
    arm/mpegvideo_armv5te_s.S \
    arm/simple_idct_armv5te.S

SOURCE_HAVE_ARMVFP = \
    arm/dsputil_vfp.S \
    arm/float_arm_vfp.S

SOURCE_HAVE_ARMV6 = arm/simple_idct_armv6.S

LOCAL_SRC_FILES := \
   allcodecs.c \
   audioconvert.c \
   bitstream.c \
   bitstream_filter.c \
   dsputil.c \
   eval.c \
   faanidct.c \
   imgconvert.c \
   jrevdct.c \
   opt.c \
   options.c \
   parser.c \
   raw.c \
   resample.c \
   resample2.c \
   simple_idct.c \
   utils.c

LOCAL_SRC_FILES += $(SOURCE_H263_ENCODER)                 
LOCAL_SRC_FILES += $(SOURCE_H264_DECODER)

LOCAL_SRC_FILES += $(SOURCE_HAVE_ARM)                
LOCAL_SRC_FILES += $(SOURCE_HAVE_ARMV5TE)                
LOCAL_SRC_FILES += $(SOURCE_HAVE_ARMVFP)

LOCAL_MODULE := libavcodec

LOCAL_PRELINK_MODULE := false


LOCAL_C_INCLUDES :=                           \
    $(FFMPEG_TOP)/                         \
    $(FFMPEG_TOP)/libavutil/                \
    $(LOCAL_PATH)                            \
    $(LOCAL_PATH)/arm/

LOCAL_CFLAGS += -O4 -mno-thumb-interwork -mno-thumb -marm -DHAVE_AV_CONFIG_H

include $(BUILD_STATIC_LIBRARY)    

jni/libavutil/Android.mk包含     LOCAL_PATH:= $(调用my-dir)

include $(CLEAR_VARS)

LOCAL_SRC_FILES := \
   adler32.c \
   aes.c \
   avstring.c \
   base64.c \
   crc.c \
   des.c \
   fifo.c \
   intfloat_readwrite.c \
   lfg.c \
   lls.c \
   log.c \
   lzo.c \
   mathematics.c \
   md5.c \
   mem.c \
   random.c \
   random_seed.c \
   rational.c \
   rc4.c \
   sha1.c \
   tree.c \
   utils.c

LOCAL_MODULE := libavutil

LOCAL_PRELINK_MODULE := false

LOCAL_C_INCLUDES :=                                 \
    $(FFMPEG_TOP)/                                \
    $(LOCAL_PATH)                 \
    $(LOCAL_PATH)/arm/

LOCAL_CFLAGS += -O4 -mno-thumb-interwork -mno-thumb -marm -DHAVE_AV_CONFIG_H

include $(BUILD_STATIC_LIBRARY)

问题here与我面临的问题无关,尽管错误类似。

我得到的错误是:

Android NDK: jni/inner/Android.mk:mylib: LOCAL_MODULE_FILENAME should not include file extensions
Android NDK: jni/inner/Android.mk:mylib: LOCAL_MODULE_FILENAME must not contain a file extension

请帮忙!! [所以我经常遇到无头问题!]

2 个答案:

答案 0 :(得分:7)

您需要确保在包含构建静态库的make文件后调用include $(CLEAR_VARS)。模块文件名的自动生成仅在该变量为空时才有效,并且您之前的make文件包含在调用$include ($BUILD_STATIC_LIBRARY)

时最终定义它

答案 1 :(得分:0)

尝试在LOCAL_MODULE_FILENAME := libavcodec LOCAL_MODULE_FILENAME += libavutil中使用LOCAL_SRC_FILES += libavcodec.a libavutil.a代替jni/Android.mk