I am using bazel 8.1.1
My MODULE.bazel contains the following:
bazel_dep(name = "rules_android_ndk", version = "0.1.3")
android_ndk_repository_extension = use_extension("@rules_android_ndk//:extension.bzl", "android_ndk_repository_extension")
use_repo(android_ndk_repository_extension, "androidndk")
When I build I get the following error:
INFO: Repository rules_android_ndk++android_ndk_repository_extension+androidndk instantiated at:
<builtin>: in <toplevel>
Repository rule android_ndk_repository defined at:
C:/users/rob/_bazel_rob/q6nhqnyq/external/rules_android_ndk+/rules.bzl:127:41: in <toplevel>
ERROR: C:/users/rob/_bazel_rob/q6nhqnyq/external/rules_android_ndk+/rules.bzl:116:24: An error occurred during the fetch of repository 'rules_android_ndk++android_ndk_repository_extension+androidndk':
Traceback (most recent call last):
File "C:/users/rob/_bazel_rob/q6nhqnyq/external/rules_android_ndk+/rules.bzl", line 49, column 21, in _android_ndk_repository_impl
_create_symlinks(ctx, ndk_path, clang_directory, sysroot_directory)
File "C:/users/rob/_bazel_rob/q6nhqnyq/external/rules_android_ndk+/rules.bzl", line 116, column 24, in _create_symlinks
ctx.symlink(p, repo_relative_path)
Error in symlink: Cannot write outside of the repository directory for path C:/Users/rob/AppData/Local/Android/Sdk/ndk/28.0.13004108/toolchains/llvm/prebuilt/windows-x86_64/AndroidVersion.txt
ERROR: Analysis of target '//third_party/percetto:percetto_lib' failed; build aborted: Cannot write outside of the repository directory for path C:/Users/rob/AppData/Local/Android/Sdk/ndk/28.0.13004108/toolchains/llvm/prebuilt/windows-x86_64/AndroidVersion.txt
I discovered that p and repo_relative_path are of the same value: C:/Users/rob/AppData/Local/Android/Sdk/ndk/28.0.13004108/toolchains/llvm/prebuilt/windows-x86_64/AndroidVersion.txt
It looks like string.replace at https://github.com/bazelbuild/rules_android_ndk/blob/main/rules.bzl#L112 doesn't work!
for p in ctx.path(ndk_path + clang_directory).readdir():
repo_relative_path = str(p).replace(ndk_path, "")
+ print("p=",p,"repo_relative_path=",repo_relative_path)
# Skip sysroot directory, since it gets its own BUILD file
if repo_relative_path != sysroot_directory:
ctx.symlink(p, repo_relative_path)
Any idea what's happening?
Thank you
I am using bazel 8.1.1
My MODULE.bazel contains the following:
When I build I get the following error:
I discovered that p and repo_relative_path are of the same value: C:/Users/rob/AppData/Local/Android/Sdk/ndk/28.0.13004108/toolchains/llvm/prebuilt/windows-x86_64/AndroidVersion.txt
It looks like string.replace at https://github.com/bazelbuild/rules_android_ndk/blob/main/rules.bzl#L112 doesn't work!
Any idea what's happening?
Thank you