-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Android c++ build under Windows, command line to long #7982
Comments
@laszlocsomor how do you typical deal with issues like this on Windows? Param files? |
yes, param files should work (like normal bazel k8 build does) |
@jin: Yes, with param files. Beware there's no standard encoding (that I know), so use ASCII to stay safe. |
It's weird to run an arm linux binary on Windows, I guess the rule doesn't work on Windows at all? Anyway, this issue looks obsolete, please reopen if the issue still exists. |
This issue still exist, but I'm sorry for not being able to show you the smallest example. Windows: 10 Pro 21H2 (19044.1348) At least, I can reproduce this error with google/mediapipe repository. diff --git a/WORKSPACE b/WORKSPACE
index 9dbbff3..1cfaecc 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -96,6 +96,7 @@ http_archive(
],
patches = [
"@//third_party:com_github_glog_glog_9779e5ea6ef59562b030248947f787d1256132ae.diff",
+ "@//third_party:com_github_glog_glog_no_gflags.diff",
],
patch_args = [
"-p1",
diff --git a/third_party/com_github_glog_glog_no_gflags.diff b/third_party/com_github_glog_glog_no_gflags.diff
new file mode 100644
index 0000000..f266d7e
--- /dev/null
+++ b/third_party/com_github_glog_glog_no_gflags.diff
@@ -0,0 +1,28 @@
+diff --git a/bazel/glog.bzl b/bazel/glog.bzl
+index a46e2d1..5f63514 100644
+--- a/bazel/glog.bzl
++++ b/bazel/glog.bzl
+@@ -107,12 +107,12 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
+ "src/utilities.h",
+ "src/vlog_is_on.cc",
+ ] + select({
+- "@bazel_tools//src/conditions:windows": windows_only_srcs,
++ "@//mediapipe:windows": windows_only_srcs,
+ "//conditions:default": [":config_h"],
+ }),
+ copts =
+ select({
+- "@bazel_tools//src/conditions:windows": common_copts + windows_only_copts,
++ "@//mediapipe:windows": common_copts + windows_only_copts,
+ "@bazel_tools//src/conditions:darwin": common_copts + linux_or_darwin_copts + darwin_only_copts,
+ "@bazel_tools//src/conditions:freebsd": common_copts + linux_or_darwin_copts + freebsd_only_copts,
+ ":wasm": common_copts + wasm_copts,
+@@ -128,7 +128,7 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
+ native.cc_library(
+ name = "glog_headers",
+ deps = select({
+- "@bazel_tools//src/conditions:windows": [":windows_glog_headers"],
++ "@//mediapipe:windows": [":windows_glog_headers"],
+ "//conditions:default": [":default_glog_headers"],
+ }),
+ ) After that, when I run the below command, then this error occurs (total parameter's length is about 35,000). bazel build -c opt --action_env PYTHON_BIN_PATH="C://path//to//python.exe" --verbose_failures --config=android_arm64 --noenable_platform_specific_config --cxxopt=-std=c++17 //mediapipe/examples/android/src/java/com/google/mediapipe/apps/facedetectiongpu:facedetectiongpu
|
I'm not sure but it may be caused by the below line. Line 17 in 90a8c27
If I change 0 to 1, the error has gone. |
@ahumesky Do all android toolchains support parameter files? If so we probably could turn it on by default to avoid this command length issue on Windows. |
Fix #7982 Currently, on Windows, `ar` command can fail when using Android NDK and the arguments length is too long. This PR resolves it by enabling `--features=compiler_param_file` option for Android NDK, but I'm not sure if all commands in all versions of NDK that should be supported are compatible with this. Closes #14457. PiperOrigin-RevId: 448334050
Description of the problem / feature requests
I am trying to build a c++ library using bazel under windows. I am using the following command:
bazel build <target> --compilation_mode=opt --crosstool_top=@androidndk//:default_crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a
I am getting the following error message:
Action failed to execute: java.io.IOException: ERROR: src/main/native/windows/processes-jni.cc(429): CreateProcessWithExplicitHandles("<user>\_bazel_exb_a\kkszmrzt\execroot\dbsdk\external\androidndk\ndk\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ar" rcsD bazel-out/armeabi-v7a-(...)): command is longer than CreateProcessW's limit (32767 characters)
Unlike Linux/windows build that are using a linker input file for commands the ndk version passes all parameters via command line
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
What operating system are you running Bazel on?
What's the output of
bazel info release
?Have you found anything relevant by searching the web?
The text was updated successfully, but these errors were encountered: