arm-linux-androideabi-strip unable to rename

☆樱花仙子☆ 提交于 2020-01-06 20:36:34

问题


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 or stack overflow (Posts which are posted with similar problem).

Please post the answers below.


回答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.




回答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



来源:https://stackoverflow.com/questions/24884419/arm-linux-androideabi-strip-unable-to-rename

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!