Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vmxken opened this issue Sep 20, 2023 · 5 comments
Closed

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

vmxken opened this issue Sep 20, 2023 · 5 comments
Assignees
Labels

Comments

@vmxken
Copy link

vmxken commented Sep 20, 2023

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

@vmxken vmxken added the bug label Sep 20, 2023
@github-project-automation github-project-automation bot moved this to Triaged in NDK r26b Sep 20, 2023
@calvin2021y
Copy link

get the same problem for macOS

@DanAlbert
Copy link
Member

Yes. It's broken on all OSs.

@bruce-yan

This comment was marked as duplicate.

@DanAlbert

This comment was marked as resolved.

@DanAlbert
Copy link
Member

This was actually covered by a test, the test was just useless because it was really only testing a mock, which was of course out of date. https://android-review.googlesource.com/c/platform/ndk/+/2764068 fixes the bug, and removes the reliance on the mock so the test will actually catch a regression before it ships in the future.

The fix in the OP was more or less correct, but it was actually ndk_bin that was defined incorrectly, because __file__ is what changed.

@DanAlbert DanAlbert self-assigned this Sep 26, 2023
@DanAlbert DanAlbert moved this from Triaged to Needs cherry-pick in NDK r26b Oct 4, 2023
@github-project-automation github-project-automation bot moved this from Needs cherry-pick to Triaged in NDK r26b Oct 5, 2023
@DanAlbert DanAlbert moved this from Triaged to Merged in NDK r26b Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Merged
Development

No branches or pull requests

4 participants