在Android.mk的变化不改变库 [英] Changes in Android.mk not changing libs

查看:282
本文介绍了在Android.mk的变化不改变库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的Andr​​oid.mk文件,以优化的二进制文件:

I'm trying to get my Android.mk file to optimize the binaries:

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)

我保存此,并运行

I then save this, and run

$NDK/ndk-build -B V=1

我然后对所得库运行的md5sum,并有一个与

I then run md5sum on the resulting library, and there is no difference between it and one built with

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := fred
LOCAL_SRC_FILES := fred.c
LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)

那么,我究竟做错了什么?

So, what am I doing wrong?

编译器的输出好像是:

/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,但我怎么解决这个问题?

I'm not sure if this is OK, but it seems that the problem is perhaps the 3 optimization flags, -Os -O2 -O3, but how do I fix this?

谢谢!

推荐答案

看到 APP_OPTIM 变量。我设置矿在优化code我Application.mk文件发布。 (我不知道如果你能得到你正在寻找各种 -O#选择这样的粒度,但至少你得到的东西。)

Look into the APP_OPTIM variable. I set mine to release in my Application.mk file for optimized code. (I'm not sure if you can get the granularity you are looking for with various -O# options this way, but at least you get something.)

这篇关于在Android.mk的变化不改变库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆