Skip to content Skip to sidebar Skip to footer

Arm-linux-androideabi-strip Unable To Rename

Getting the arm-linux-androideabi-strip so many times, with multiple reasons as mentioned below. reason: File exists reason: Resource busy Was not able to get an answer over google

Solution 1:

if you are getting error saying arm-linux-androideabi-strip unable to rename and reason as file exists and resource busy like that, please observe that some Tortoise version of the resource keeper (Ex: TGitCache.exe) is running the processes, try killing it or stopping it gracefully, then try building again. It will succeed. It could be anyother resource keeping process as well and most of the times its repositories softwares.


Solution 2:

I hit the same issue in Feb. 2016, on a very small native shared library build, while my big .so projects worked for years without any problems. It seems to be some kind of race condition int the command arm-linux-androideabi-strip (or i686-linux-android-strip, whatever abi you're building). The strip command tries to replace the original .so file with the stripped one, before it actually closes the original file, I guess. None of the answers found here or in other technical posts worked well for me. The build might have worked right in about 20% of cases, while giving me the [...]-linux-androideabi-strip unable to rename error in 80% of builds. Wasted the whole afternoon and evening on this issue...

My workaround:

Modified the cmd-strip macro in the file [android-ndk]/build/core/default-build-commands.mk as follows (see comments with my name):

# The strip command is only used for shared libraries and executables.
# It is thus safe to use --strip-unneeded, which is only dangerous
# when applied to static libraries or object files.
# GKochaniak, at the end of next line added: -o $(call host-path,$1).strip 
cmd-strip = $(PRIVATE_STRIP) --strip-unneeded $(call host-path,$1) -o $(call host-path,$1).strip

Now the build, instead of one libMyShared.so produces two files in the final install directory: libMyShared.so (orignial, un-stripped) and libMyShared.so.strip (stripped). We only need to delete the original and rename the stripped file. I did this by modifying [android-ndk]/build/core/build-binary.mk (same folder) as follows:

$(LOCAL_INSTALLED): $(LOCAL_BUILT_MODULE) clean-installed-binaries
    $(call host-echo-build-step,$(PRIVATE_ABI),Install) "$(PRIVATE_NAME) => $(call pretty-dir,$(PRIVATE_DST))"
    $(hide) $(call host-install,$(PRIVATE_SRC),$(PRIVATE_DST))
    $(hide) $(PRIVATE_STRIP_CMD)
# GKochaniak added 2 lines below:   
    rm $(PRIVATE_DST)
    mv $(PRIVATE_DST).strip $(PRIVATE_DST)

Note: as I work on Windows, I had to put into into my system path the Cygwin bin folder with rm.exe and mv.exe commands, as the paths in this make file use forward slashes, so it was a problem when I tried to use del, ren commands.

Greg


Post a Comment for "Arm-linux-androideabi-strip Unable To Rename"