我正在尝试使用NDK编译库,但是在命令下运行时,我的c类出现错误。
/home/chetu/AndroidWork/android-ndk-r17c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --sysroot $ SYSROOT V1Analysis.c -o V1Analysis
发生以下错误:-
V1Analysis.c:23:34:致命错误:libavformat / avformat.h:没有这样的文件 或目录
这是V1Analysis.c文件:-
#include <string.h>
#include <jni.h>
#include <android/log.h>
#include <android/bitmap.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avutil.h>
#include <libavutil/fifo.h>
#include <libswscale/swscale.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <cpu-features.h>
#include "helloneon-intrinsics.h"
#define DEBUG 0
#if DEBUG
#include <android/log.h>
# define D(x...) __android_log_print(ANDROID_LOG_INFO,"V1 JNI",x)
#else
# define D(...) do {} while (0)
#endif
#define LOG_TAG "V1JNI"
#define MINIMUM_CRF 10.0
#define MAXIMUM_CRF 36.0
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
这是我的Android.mk文件:-
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
SYSROOT := /home/chetu/AndroidWork/Project/v1golflibrary/ffmpegBuild/AndroidNDK/android-ndk-r8d/platforms/android-9/arch-arm
HOST_PREBUILT := /home/chetu/AndroidWork/android-ndk-r17c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
LOCAL_MODULE := V1Analysis
LOCAL_SRC_FILES := V1Analysis.c
LOCALC_FLAGS := -fpic
#LOCAL_LDFLAGS := -static,-fpic
#LOCAL_C_INCLUDES += /home/chetu/AndroidWork/Project/v1golflibrary/ffmpegBuild/ffmpeg/ffmpeg-android/dist/include
LOCAL_STATIC_LIBRARIES := cpufeatures
LOCAL_C_INCLUDES += /home/chetu/AndroidWork/Project/v1golflibrary/ffmpegBuild/ffmpeg/ffmpeg-android/dist/include
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_CFLAGS := -DHAVE_NEON=1
LOCAL_SRC_FILES += helloneon-intrinsics.c.neon
LOCAL_LDLIBS += -L/home/chetu/AndroidWork/Project/v1golflibrary/ffmpegBuild/ffmpeg/ffmpeg-android/dist/lib-neon
LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -lavcodec -lavformat -lswscale -lavutil -lx264 -lmp3lame -llog -lc -lz -ljnigraphics
else
LOCAL_LDLIBS += -L/home/chetu/AndroidWork/Project/v1golflibrary/ffmpegBuild/ffmpeg/ffmpeg-android/dist/lib-nofp
LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -lavcodec -lavformat -lswscale -lavutil -llog -lc -lz -ljnigraphics
endif
include $(BUILD_SHARED_LIBRARY)
#include $(BUILD_EXECUTABLE)
#all:
#mv ${/home/chetu/AndroidWork/Project/v1golflibrary/ffmpegBuild/jni/lib/libV1Analysis.so}
$(call import-module,android/cpufeatures)
我是NDK开发的新手,请帮助我。我被困在两个2周内。提前致谢。