I am trying to generate the executable something like adbd in /sbin.
The executable I wish to have is iwlist with ARM format and the type is static.
I added the folder in the AndroidSourceCode/external and execute the “mm” command to compile
LOCAL_PATH := $(call my-dir)
ifneq ($(TARGET_SIMULATOR),true)
include $(CLEAR_VARS)
LOCAL_MODULE := libiw
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwlib.c
LOCAL_C_INCLUDE += LOCAL_PATH
LOCAL_PRELINK_MODULE := false
include $(BUILD_SHARED_LIBRARY)
#================================================
include $(CLEAR_VARS)
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwlist.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwlist
include $(BUILD_EXECUTABLE)
#================================================
endif # !TARGET_SIMULATOR
The above make file actually works by generating the iwlist executable with
iwlist: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses
shared libs), stripped
However, I am looking for the “statically linked” and I was thinking “LOCAL_FORCE_STATIC_EXECUTABLE := true” this line should help me make this executable statically.
Unfortunately, it doesnt.
Kindly instruct me if you know how to do it.
Thanks in advance.
I have a similar problem but I was not able to compile statically linked any file using the Android toolchain.
You can use another toolchain for that. I have tryied with the toolchain from linaro and It works fine.
You can download here:
https://wiki.linaro.org/WorkingGroups/ToolChain
I downloaded the 4.7 version, untar the file place in my home directory.
To compile is as easy as:
Of course I recommend you to put that bin directory in your path.
That will create a statically linked file: