Comments (10)
The next error I encounter is:
ERROR: Failed to find ndk binary path, should be at './host-tools/bin'
I can't find any directories named "host-tools" in the NDK tree, so I think this is another bug.
from ndk.
Oops, ndk-gdb.py wasn't updated for some paths moving around. I believe this patch should fix things:
diff --git a/ndk-gdb.py b/ndk-gdb.py
index 59071be..25268c6 100755
--- a/ndk-gdb.py
+++ b/ndk-gdb.py
@@ -182,11 +182,7 @@ def extract_launchable(xmlroot):
def ndk_bin_path():
- path = os.path.join(NDK_PATH, "host-tools", "bin")
- if not os.path.exists(path):
- error("Failed to find ndk binary path, should be at '{}'".format(path))
-
- return path
+ return os.path.dirname(os.path.realpath(__file__))
def handle_args():
from ndk.
Sorry, this as well:
diff --git a/ndk-gdb.py b/ndk-gdb.py
index 25268c6..555e665 100755
--- a/ndk-gdb.py
+++ b/ndk-gdb.py
@@ -32,8 +32,8 @@ import xml.etree.cElementTree as ElementTree
import logging
# Shared functions across gdbclient.py and ndk-gdb.py.
-# ndk-gdb is installed to $NDK/host-tools/bin
-NDK_PATH = os.path.normpath(os.path.join(os.path.dirname(__file__), '../..'))
+# ndk-gdb is installed to $NDK/prebuilt/<platform>/bin
+NDK_PATH = os.path.normpath(os.path.join(os.path.dirname(__file__), '../../..'))
sys.path.append(os.path.join(NDK_PATH, "python-packages"))
import gdbrunner
from ndk.
👍 Thanks, getting further with those patches.
from ndk.
Next issue is:
make: ./build/core/build-local.mk: No such file or directory
make: *** No rule to make target `./build/core/build-local.mk'. Stop.
Relevant code is:
make_args = [args.make_cmd, "--no-print-dir", "-f",
os.path.join(NDK_PATH, "build/core/build-local.mk"),
"-C", args.project, "DUMP_{}".format(variable)]
It looks like this error is due to the fact that NDK_PATH is a relative path, and ./build/core/build-local.mk
is therefore interpreted by make as relative to the project directory given as the -C
option.
from ndk.
Since the thing that caused this issue was the move from the package root into prebuilts/
, does it all work if you undo those patches and just move the script up to the top level?
from ndk.
Fixed a couple of these bugs, here's are the current differences between master and the r11 release:
diff --git a/ndk-gdb.py b/ndk-gdb.py
index 59071be..c8cf560 100755
--- a/ndk-gdb.py
+++ b/ndk-gdb.py
@@ -32,8 +32,8 @@ import xml.etree.cElementTree as ElementTree
import logging
# Shared functions across gdbclient.py and ndk-gdb.py.
-# ndk-gdb is installed to $NDK/host-tools/bin
-NDK_PATH = os.path.normpath(os.path.join(os.path.dirname(__file__), '../..'))
+# ndk-gdb is installed to $NDK/prebuilt/<platform>/bin
+NDK_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../..'))
sys.path.append(os.path.join(NDK_PATH, "python-packages"))
import gdbrunner
@@ -116,7 +116,7 @@ class ArgumentParser(gdbrunner.ArgumentParser):
"--stdcxx-py-pr", dest="stdcxxpypr",
help="Use C++ library pretty-printer",
choices=["auto", "none", "gnustl", "stlport"],
- default="none")
+ default="auto")
def extract_package_name(xmlroot):
@@ -182,11 +182,7 @@ def extract_launchable(xmlroot):
def ndk_bin_path():
- path = os.path.join(NDK_PATH, "host-tools", "bin")
- if not os.path.exists(path):
- error("Failed to find ndk binary path, should be at '{}'".format(path))
-
- return path
+ return os.path.dirname(os.path.realpath(__file__))
def handle_args():
@@ -235,7 +231,7 @@ def find_project(args):
manifest_name = "AndroidManifest.xml"
if args.project is not None:
log("Using project directory: {}".format(args.project))
- args.project = os.path.realpath(args.project)
+ args.project = os.path.realpath(os.path.expanduser(args.project))
if not os.path.exists(os.path.join(args.project, manifest_name)):
msg = "could not find AndroidManifest.xml in '{}'"
error(msg.format(args.project))
@@ -421,7 +417,7 @@ def get_gdbserver_path(args, package_name, app_data_dir, arch):
# We need to upload our gdbserver
log("App gdbserver not found at {}, uploading.".format(app_gdbserver_path))
- local_path = "{}/gdbserver/{}/gdbserver"
+ local_path = "{}/prebuilt/android-{}/gdbserver/gdbserver"
local_path = local_path.format(NDK_PATH, arch)
remote_path = "/data/local/tmp/{}-gdbserver".format(arch)
args.device.push(local_path, remote_path)
@@ -447,15 +443,15 @@ def get_gdbserver_path(args, package_name, app_data_dir, arch):
return remote_path
-def pull_binaries(device, out_dir, is64bit):
+def pull_binaries(device, out_dir, app_64bit):
required_files = []
libraries = ["libc.so", "libm.so", "libdl.so"]
- if is64bit:
+ if app_64bit:
required_files = ["/system/bin/app_process64", "/system/bin/linker64"]
library_path = "/system/lib64"
else:
- required_files = ["/system/bin/app_process", "/system/bin/linker"]
+ required_files = ["/system/bin/linker"]
library_path = "/system/lib"
for library in libraries:
@@ -470,12 +466,21 @@ def pull_binaries(device, out_dir, is64bit):
log("Pulling '{}' to '{}'".format(required_file, local_path))
device.pull(required_file, local_path)
+ # /system/bin/app_process is 32-bit on 32-bit devices, but a symlink to
+ # app_process64 on 64-bit. If we need the 32-bit version, try to pull
+ # app_process32, and if that fails, pull app_process.
+ if not app_64bit:
+ destination = os.path.realpath(out_dir + "/system/bin/app_process")
+ try:
+ device.pull("/system/bin/app_process32", destination)
+ except:
+ device.pull("/system/bin/app_process", destination)
-def generate_gdb_script(args, sysroot, binary_path, is64bit, connect_timeout=5):
+def generate_gdb_script(args, sysroot, binary_path, app_64bit, connect_timeout=5):
gdb_commands = "file '{}'\n".format(binary_path)
solib_search_path = [sysroot, "{}/system/bin".format(sysroot)]
- if is64bit:
+ if app_64bit:
solib_search_path.append("{}/system/lib64".format(sysroot))
else:
solib_search_path.append("{}/system/lib".format(sysroot))
@@ -560,7 +565,7 @@ def find_pretty_printer(pretty_printer):
path = os.path.join("stlport", "stlport")
function = "register_stlport_printers"
pp_path = os.path.join(
- NDK_PATH, "host-tools", "share", "pretty-printers", path)
+ ndk_bin_path(), "..", "share", "pretty-printers", path)
return pp_path, function
@@ -636,9 +641,9 @@ def main():
pid = pids[0]
# Pull the linker, zygote, and notable system libraries
- is64bit = "64" in abi
- pull_binaries(device, out_dir, is64bit)
- if is64bit:
+ app_64bit = "64" in abi
+ pull_binaries(device, out_dir, app_64bit)
+ if app_64bit:
zygote_path = os.path.join(out_dir, "system", "bin", "app_process64")
else:
zygote_path = os.path.join(out_dir, "system", "bin", "app_process")
@@ -660,6 +665,9 @@ def main():
def start_jdb():
log("Starting jdb to unblock application.")
+ # Give gdbserver some time to attach.
+ time.sleep(0.5)
+
# Do setup stuff to keep ^C in the parent from killing us.
signal.signal(signal.SIGINT, signal.SIG_IGN)
windows = sys.platform.startswith("win")
@@ -686,7 +694,7 @@ def main():
# Start gdb.
- gdb_commands = generate_gdb_script(args, out_dir, zygote_path, is64bit)
+ gdb_commands = generate_gdb_script(args, out_dir, zygote_path, app_64bit)
gdb_flags = []
if args.tui:
gdb_flags.append("--tui")
from ndk.
I was experiencing the same issues as @jfirebaugh and have been resolved with the patch above when applied to a fresh download of the ndk. (OS X 64bit)
from ndk.
Fixed in r11b.
from ndk.
r11b is live: http://developer.android.com/ndk/downloads/index.html#download
from ndk.
Related Issues (20)
- [BUG]Undefined symbol :operator new[](unsigned long) when using r25 or r26 version of NDK HOT 3
- [Bug]: ld.lld: error: undefined symbol: __aeabi_l2d HOT 4
- [BUG] Unable to Handle Exceptions Properly HOT 2
- [BUG] With Buildozer for Python/Kivy project for Android NDK 26b HOT 6
- [Bug]: Cannot select while compiling llama.cpp on Windows HOT 4
- Simpleperf: Only one FEAT_FILE2 feature section can be read from the file HOT 2
- AES support (arm/arm64 vaeseq_u8) HOT 12
- [FR] clang driver should default to gnu hashes if the target api level is >= 23? HOT 7
- [Bug]: Segmentation Fault trying to run an LLVM pass HOT 2
- [Bug] clang frontend crashes on NDK 28.0.11617993 HOT 11
- [BUG] Building Library\Bee\artifacts\Android\a7sem\2b6k1szry106.o failed [RAM ISSUE?] HOT 9
- [FR] remove superfluous LLVM libraries HOT 10
- [BUG] clang frontend crashes on both r26d and canary version HOT 5
- [Bug] ndk clang building release raise error `declaration does not match` while llvm upstream compiles HOT 8
- [FR] improve bad diagnostic for `__REMOVED_IN` on `ALooper_pollAll` HOT 8
- [BUG] With Compose AndroidView on API 29, ANativeWindow_fromSurface with SurfaceView without an additional ViewGroup makes AndroidViewsHandle go black HOT 3
- [FR] Update Vulkan headers in sysroot of NDK r27 to enable FFmpeg's Vulkan integration HOT 19
- [Feature request] consider to provide libc.a for each API level HOT 6
- [BUG] using thread_local in x64 Android 12L/13 desktop simulator for release build generates invalid init function for thread_local variable that leads to SIGSEGV HOT 1
- [BUG] 23.1.77 Build errors on Unity 2022.3.21f1 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ndk.