NDK无法识别某些LOCAL_LDFLAGS特定标志

时间:2014-06-05 09:25:06

标签: android-ndk

我正在尝试使用下一组标志

来减小生成的NDK二进制文件的大小
LOCAL_LDFLAGS := -Wl, --gc-sections, --icf=safe

但输出下一个错误

arm-linux-androideabi-g++: error: unrecognized command line option '--gc-sections,'
arm-linux-androideabi-g++: error: unrecognized command line option '--icf=safe'

是不是真的不支持,或者我需要选择不同的工具链?我正在使用4.8(NDK_TOOLCHAIN_VERSION:= 4.8)

1 个答案:

答案 0 :(得分:1)

发现问题,以防其他用户使用,这里就是这样。事实上这是一个非常愚蠢的错误。 LOCAL_LDFLAGS要求命令之间不存在空格。

所以这个:

LOCAL_LDFLAGS := -Wl, --gc-sections, --icf=safe

成为这个:

LOCAL_LDFLAGS := -Wl,--gc-sections,--icf=safe