gpt4 book ai didi

android - 如何通过 Android NDK r20 使用 ndk-stack?

转载 作者:行者123 更新时间:2023-11-30 01:34:13 27 4
gpt4 key购买 nike

我正在尝试使用 ndk 提供的 ndk-stack 命令。

不幸的是,当我运行它时,脚本崩溃了。

我在windows上运行的命令是...

ndk-stack.cmd -sym build/intermediates/cmake/debug/obj/armeabi-v7a -dump stack.txt

stack.txt 文件包含来自 logcat 的墓碑。

我收到的错误是......

Traceback (most recent call last): File "C:\Android\android-ndk-r20\prebuilt\windows-x86_64\bin\ndk-stack.py", line 134, in main() File "C:\Android\android-ndk-r20\prebuilt\windows-x86_64\bin\ndk-stack.py", line 83, in main proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) File "C:\Android\android-ndk-r20\prebuilt\windows-x86_64\lib\python2.7/subprocess.py", line 711, in init errread, errwrite) File "C:\Android\android-ndk-r20\prebuilt\windows-x86_64\lib\python2.7/subprocess.py", line 948, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified [Finished in 0.1s]

最佳答案

cferris 前几天修复了这个问题:https://android-review.googlesource.com/c/platform/ndk/+/977970

这是您需要在本地应用的补丁(或等待 NDK r21):

diff --git a/ndk-stack.py b/ndk-stack.py
index 93aa0297..f1bb4cd6 100755
--- a/ndk-stack.py
+++ b/ndk-stack.py
@@ -32,6 +32,10 @@ def find_llvm_symbolizer():

Returns: An absolute path to llvm-symbolizer(1)."""

+ llvm_symbolizer = 'llvm-symbolizer'
+ if os.name == 'nt':
+ # Windows has to include the exe or it won't be found.
+ llvm_symbolizer += '.exe'
# ndk-stack is installed to $NDK/prebuilt/<platform>/bin, so from
# `~/Downloads/android-ndk-r18/prebuilt/linux-x86_64/bin/ndk-stack`...
# ...get `/usr/enh/Downloads/android-ndk-r18/`:
@@ -42,14 +46,14 @@ def find_llvm_symbolizer():
# And from there construct the llvm-symbolizer path.
llvm_bin = os.path.join(ndk_root, 'toolchains', 'llvm', 'prebuilt', arch,
'bin')
- path = os.path.join(llvm_bin, 'llvm-symbolizer')
+ path = os.path.join(llvm_bin, llvm_symbolizer)
if os.path.exists(path):
return path

# Okay, maybe we're a standalone toolchain? (https://github.com/android-ndk
/ndk/issues/931)
# In that case, llvm-symbolizer and ndk-stack are conveniently in
# the same directory...
- return os.path.abspath(os.path.join(ndk_bin, 'llvm-symbolizer'))
+ return os.path.abspath(os.path.join(ndk_bin, llvm_symbolizer))


def main():

基本上“您需要将 .exe 添加到提到 llvm-symbolizer 的两个地方”。 (我引入这个错误是因为我认为你不需要明确地说“blah.exe”。)

关于android - 如何通过 Android NDK r20 使用 ndk-stack?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56779125/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com