Skip to content

[BUG] Cannot launch ndk-lldb in NDK in v26.1.10909125 #1994

Closed
@cmannett85-arm

Description

@cmannett85-arm

Description

I installed the NDKs via the sdkmanager. On 26.1.10909125 launching ndk-lldb:

~/Android/Sdk/ndk/26.1.10909125$ ./ndk-lldb 
ERROR: Failed to find make in '/home/camman01/Android/Sdk/ndk/26.1.10909125/prebuilt/linux-x86_64/bin/ndkgdb.pyz'

Whilst on 25.2.9519653 (same parent directory, same machine, same sdkmanager install, same terminal):

~/Android/Sdk/ndk/25.2.9519653$ ./ndk-lldb 
ERROR: Could not find AndroidManifest.xml in current directory or a parent directory.
       Launch this script from inside a project, or use --project=<path>.

Looking in the ndkgdb.pyz for 26.1.10909125 the error is from:

def ndk_bin_path():
    return os.path.dirname(os.path.realpath(__file__))

def handle_args():
    ...
    ndk_bin = ndk_bin_path()
    args.make_cmd = find_program("make", [ndk_bin])
    args.jdb_cmd = find_program("jdb", paths)
    if args.make_cmd is None:
        error("Failed to find make in '{}'".format(ndk_bin))
   ...

Looks pretty inoccuous, and running the equivalent Python command yields the expected result:

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.dirname(os.path.realpath("~/Android/Sdk/ndk/26.1.10909125/prebuilt/linux-x86_64/bin/ndkgdb.pyz"))
'/home/camman01/Android/Sdk/ndk/25.2.9519653/~/Android/Sdk/ndk/26.1.10909125/prebuilt/linux-x86_64/bin'

Comparing it to the previous NDK version, there's no obvious related code change, but the Python file has become a zipapp (hence the change in extension). I suspect the __file__ relates to the embedded script so calling os.path.dirname(..) on it returns the top-level zipapp file rather than its owning directory.

Affected versions

r26

Canary version

No response

Host OS

Linux

Host OS version

Ubuntu 22.04.3 LTS

Affected ABIs

armeabi-v7a, arm64-v8a, x86, x86_64

Build system

ndk-build

Other build system

No response

minSdkVersion

34

Device API level

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Merged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions