Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG] ndk-stack broken in Android NDK r26 #1938

@vmxken

Description

@vmxken

Description

Problem finding llvm-analyzer. Seems that the change where the ndkstack.py has been moved in ndkstack.pyz is causing the problem. The function ndkstack.py:get_ndk_path() seems to return incorrect paths, because the pyz-format seem to add directory nesting.

Traceback (most recent call last):
  File "/home/ken/android-tools/android-ndk/android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/python3/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/ken/android-tools/android-ndk/android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/python3/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/ken/android-tools/android-ndk/android-ndk-r26/prebuilt/linux-x86_64/bin/ndkstack.pyz/__main__.py", line 3, in <module>
  File "/home/ken/android-tools/android-ndk/android-ndk-r26/prebuilt/linux-x86_64/bin/ndkstack.pyz/ndkstack.py", line 364, in main
  File "/home/ken/android-tools/android-ndk/android-ndk-r26/prebuilt/linux-x86_64/bin/ndkstack.pyz/ndkstack.py", line 93, in find_llvm_symbolizer
OSError: Unable to find llvm-symbolizer

Updating the path detection ndkstack.py with the diff below seems to fix the problem.

ken@porsas ~/android-tools/android-ndk/android-ndk-r26/prebuilt/linux-x86_64/bin/k () $ diff -wibu ndkstack.py.orig ndkstack.py
--- ndkstack.py.orig	2023-09-20 10:16:26.134510865 +0300
+++ ndkstack.py	2023-09-20 10:13:41.000000000 +0300
@@ -61,9 +61,9 @@
     # `android-ndk-r18/prebuilt/linux-x86_64/bin/ndk-stack`...
     # ...get `android-ndk-r18/`:
     ndk_bin = os.path.dirname(os.path.realpath(__file__))
-    ndk_root = os.path.abspath(os.path.join(ndk_bin, "../../../"))
+    ndk_root = os.path.abspath(os.path.join(ndk_bin, "../../../../"))
     # ...get `linux-x86_64`:
-    ndk_host_tag = os.path.basename(os.path.abspath(os.path.join(ndk_bin, "../")))
+    ndk_host_tag = os.path.basename(os.path.abspath(os.path.join(ndk_bin, "../../")))
     return (ndk_root, ndk_bin, ndk_host_tag)
 
 

Affected versions

r26

Canary version

No response

Host OS

Linux

Host OS version

Debian 11

Affected ABIs

armeabi-v7a, arm64-v8a, x86, x86_64

Build system

ndk-build

Other build system

No response

minSdkVersion

any

Device API level

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions