移植编译alsa-util时遇到一个奇葩错误如下
[ 98% 218/222] target C: aplay <= vendor/xxxx/bin/alsa-utils-1.1.9/aplay/aplay.c
vendor/xxxx/bin/alsa-utils-1.1.9/aplay/aplay.c:3:1: warning: return type of 'main' is not 'int' [-Wmain-return-type]
void main()
^
vendor/xxxx/bin/alsa-utils-1.1.9/aplay/aplay.c:3:1: note: change return type to 'int'
void main()
^~~~
int
1 warning generated.
[ 99% 221/222] target Strip: aplay (out/target/product/xxxx/obj/EXECUTABLES/aplay_intermediates/aplay)
FAILED: out/target/product/se1000/obj/EXECUTABLES/aplay_intermediates/aplay
/bin/bash -c "CLANG_BIN=prebuilts/clang/host/linux-x86/clang-r383902b1/bin CROSS_COMPILE=prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android- XZ=prebuilts/build-tools/linux-x86/bin/xz build/soong/scripts/strip.sh -i out/target/product/xxxx/symbols/system/bin/aplay -o out/target/product/xxxx/obj/EXECUTABLES/aplay_intermediates/aplay -d out/target/product/xxxx/obj/EXECUTABLES/aplay_intermediates/aplay.strip.d --keep-mini-debug-info"
rm: out/target/product/xxxx/obj/EXECUTABLES/aplay_intermediates/aplay: Is a directory
看out下文件aplay.o已经生成,就在最后一步报错了,不像是代码问题
为了验证是否是代码问题,写了个空main函数的aplay.c来编译还是报一样的错误,证明不是代码问题
报错时Android.mk写法如下:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := aplay
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/../alsa-lib-1.1.9/include LOCAL_SRC_FILES := aplay/aplay.c#LOCAL_SHARED_LIBRARIES := libasound
LOCAL_STATIC_LIBRARIES := libasound
LOCAL_CFLAGS += -Wall -Wno-unused-parameter -std=gnu99
include $(BUILD_EXECUTABLE)
分析难道是module name与C文件或文件夹重名导致的?
修改LOCAL_MODULE 后编译OK
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := alsa_aplay
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/../alsa-lib-1.1.9/include LOCAL_SRC_FILES := aplay/aplay.c#LOCAL_SHARED_LIBRARIES := libasound
LOCAL_STATIC_LIBRARIES := libasound
LOCAL_CFLAGS += -Wall -Wno-unused-parameter -std=gnu99
#LOCAL_WHOLE_STATIC_LIBRARIES := alpu_fa_000_static
include $(BUILD_EXECUTABLE)
本文发布于:2024-02-04 14:37:38,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170709517456434.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |