我正在尝试获取我的 Android.mk 文件来优化二进制文件:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := fred
LOCAL_SRC_FILES := fred.c
LOCAL_LDLIBS := -llog
LOCAL_CFLAGS = -O3
NDKDEBUG = 0
include $(BUILD_SHARED_LIBRARY)
然后我保存它,然后运行
$NDK/ndk-build -B V=1
然后我在生成的库上运行 md5sum ,它与使用构建的库没有区别
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := fred
LOCAL_SRC_FILES := fred.c
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
那么,我做错了什么?
编译器的输出似乎是:
/home/AStupidNoob/Documents/Android/android-ndk-r7b/toolchains/arm-linux-androideabi-
4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -MMD -MP -MF /home/AStupidNoob
/workspace/Fred/obj/local/armeabi/objs/fred/fred.o.d -fpic -ffunction-sections -funwind-
tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__
-D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/home/AStupidNoob
/workspace/Fred/jni -DANDROID -O3 -Wa,--noexecstack -O2 -DNDEBUG -g -I/home/AStupidNoob
/Documents/Android/android-ndk-r7b/platforms/android-4/arch-arm/usr/include -c
/home/AStupidNoob/workspace/Fred/jni/fred.c -o /home/AStupidNoob/workspace/Fred/obj
/local/armeabi/objs/fred/fred.o
我不确定这是否可行,但似乎问题可能在于 3 个优化标志 -Os -O2 -O3,但我该如何解决这个问题?
谢谢!