Android NDK make.exe: *** No rule to make target

完整错误:

make.exe: *** No rule to make target D:/source/speex-1.2.1/jni/libspeex/resample.c', needed by D:/source/speex-1.2.1/obj/local/armeabi/objs/speex/libspeex/resample.o’. Stop.

本质原因:被编译的源文件不存在。

根据报错路径去查一下具体的位置即可确认。

而引c++或c文件不存在的原因一般有如下几种

  1. 代码仓库提交问题
    例如脚本编译的是几个模块,但提交人仅提交脚本,而没提交源文件,这样就导致需要编译的文件不存在。
  2. 修改了工程或代码的路径,但脚本中的路径没有修改
    这种常见于工程的复制或分支,脚本中没有使用相对路径会引起这个(路径还是原来的)
  3. 网上教程陈旧,没有随开源项目的演进更新脚本(Android speex 的编译)
    如这篇文章 speex编解码在android上实现,文章是2012年写的,文中这样描述:
    1、去Speex官网下载最新Speex源码。
    2、创建新的android工程,并创建jni文件夹。
    3、把speex源码目录下的libspeex和include目录及其子目录文件全部拷贝到$project/jni目录下。
    4、在jni目录下新增Android.mk文件,编辑内容如下:
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE:= libspeex
LOCAL_CFLAGS = -DFIXED_POINT -DUSE_KISS_FFT -DEXPORT="" -UHAVE_CONFIG_H
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include

LOCAL_SRC_FILES :=\
libspeex/bits.c \
libspeex/buffer.c \
libspeex/cb_search.c \
libspeex/exc_10_16_table.c \
libspeex/exc_10_32_table.c \
libspeex/exc_20_32_table.c \
libspeex/exc_5_256_table.c \
libspeex/exc_5_64_table.c \
libspeex/exc_8_128_table.c \
libspeex/fftwrap.c \
libspeex/filterbank.c \
libspeex/filters.c \
libspeex/gain_table.c \
libspeex/gain_table_lbr.c \
libspeex/hexc_10_32_table.c \
libspeex/hexc_table.c \
libspeex/high_lsp_tables.c \
libspeex/jitter.c \
libspeex/kiss_fft.c \
libspeex/kiss_fftr.c \
libspeex/lpc.c \
libspeex/lsp.c \
libspeex/lsp_tables_nb.c \
libspeex/ltp.c \
libspeex/mdf.c \
libspeex/modes.c \
libspeex/modes_wb.c \
libspeex/nb_celp.c \
libspeex/preprocess.c \
libspeex/quant_lsp.c \
libspeex/resample.c \
libspeex/sb_celp.c \
libspeex/scal.c \
libspeex/smallft.c \
libspeex/speex.c \
libspeex/speex_callbacks.c \
libspeex/speex_header.c \
libspeex/stereo.c \
libspeex/vbr.c \
libspeex/vq.c \
libspeex/window.c \
speex_jni.cpp \

include $(BUILD_SHARED_LIBRARY)

而现在下载的最新源代码中已经没有如下文件:
#libspeex/buffer.c
#libspeex/fftwrap.c
#libspeex/filterbank.c
#libspeex/jitter.c
#libspeex/mdf.c
#libspeex/preprocess.c
#libspeex/resample.c
#libspeex/scal.c \

编译的时候也就报错了如题之错误。

这种情况下我们确认是源文件已经不需要了或已经删除,则将mk文件(脚本)中“缺失”的文件删除就可以编译成功。
附此时正确的mk描述文件内容

LOCAL_PATH := $(call my-dir)
 
include $(CLEAR_VARS)
 
LOCAL_MODULE:= libspeex
LOCAL_CFLAGS = -DFIXED_POINT -DUSE_KISS_FFT -DEXPORT="" -UHAVE_CONFIG_H
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
 
LOCAL_SRC_FILES :=\
libspeex/bits.c \
libspeex/cb_search.c \
libspeex/exc_10_16_table.c \
libspeex/exc_10_32_table.c \
libspeex/exc_20_32_table.c \
libspeex/exc_5_256_table.c \
libspeex/exc_5_64_table.c \
libspeex/exc_8_128_table.c \
libspeex/filters.c \
libspeex/gain_table.c \
libspeex/gain_table_lbr.c \
libspeex/hexc_10_32_table.c \
libspeex/hexc_table.c \
libspeex/high_lsp_tables.c \
libspeex/kiss_fft.c \
libspeex/kiss_fftr.c \
libspeex/lpc.c \
libspeex/lsp.c \
libspeex/lsp_tables_nb.c \
libspeex/ltp.c \
libspeex/modes.c \
libspeex/modes_wb.c \
libspeex/nb_celp.c \
libspeex/quant_lsp.c \
libspeex/sb_celp.c \
libspeex/smallft.c \
libspeex/speex.c \
libspeex/speex_callbacks.c \
libspeex/speex_header.c \
libspeex/stereo.c \
libspeex/vbr.c \
libspeex/vq.c \
libspeex/window.c \
speex_jni.cpp \

include $(BUILD_SHARED_LIBRARY)

如果此后(2022.10.27)的读者参考的话,如果编译出现问题,仔细核对一下文件,对应增减应该可以正常编译过去。

注:关于speex 编译这个如果是先编译成静态库,再编译为动态库,mk文件应该不会因为没有同步更新源文件而出现这个问题。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值