2023/1/13

ndk build failed : "permission denied"

好誇張,新版ndk 使用的 windows api 不支援 windows 7,所以 windows 7 run 會 fail:
    Run Build Command(s):D:\Android\AndroidSdk\cmake\3.22.1\bin\ninja.exe cmTC_1e3b7 && [1/2] 
    Building C object CMakeFiles/cmTC_1e3b7.dir/testCCompiler.c.o
    [2/2] Linking C executable cmTC_1e3b7
    FAILED: cmTC_1e3b7 
    cmd.exe /C "cd . && D:\Android\AndroidSdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe 
--target=aarch64-none-linux-android30 --sysroot=D:/Android/AndroidSdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/sysroot 
-DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat 
-Werror=format-security -fexceptions  -O2 -g -DNDEBUG -Wl,--build-id=sha1 -Wl,--fatal-warnings -Qunused-arguments -Wl,--no-undefined  
-Wl,--gc-sections CMakeFiles/cmTC_1e3b7.dir/testCCompiler.c.o -o cmTC_1e3b7  -latomic -lm && cd ."
    ld: error: failed to write to the output file: Permission denied
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.
ref: 內容是:

You are correct. ProcessMonitor seems to indicate that in NDK version 23.1.7779620 the ld.exe is using a newer API calls that are not supported on Win7.
enter image description here
It looks like ld erroneously interprets the failed API call as a "permission denied" error. The same happens in NDK version 23.0.7599858.
The last NDK that seems to work on Win7 is 22.1.7171670.
After the system was upgraded to Win10 ld started to work normally for the 23.x NDK versions.

但是最新版的android studio 好像不允許自行決定 ndk 位置,而且每次都會自動更新到最新版..
這邊(archive) 才能下載到舊板。

沒有留言:

張貼留言