Hi,
I tried to build my own C++ shared libraries on Windows, but encountered some Bazel build errors.
My Android NDK version is 21.1.6352462, Bazel version is 6.3.2.
Here is my configure setting:
Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: y
Please specify the (min) Android NDK API level to use.:21
Please specify the Android SDK API level to use.:31
Please specify an Android build tools version to use.:33.0.0
I have tried the following two build commands:
bazel build -c opt --config=android_arm //tensorflow/lite:libtensorflowlite.so
bazel build -c opt --config=android_arm64 //tensorflow/lite:libtensorflowlite.so
But I keep getting this error:
Clang error: No such file or directory: /d2ReducedOptimizeHugeFunctions
d2ReducedOptimizeHugeFunctions
is an option for Windows build.
build:linux --copt="-Wno-deprecated"
build:linux --copt="-Wno-deprecated-declarations"
build:linux --copt="-Wno-ignored-attributes"
build:linux --copt="-Wno-array-bounds"
# Add unused-result as an error on Linux.
build:linux --copt="-Wunused-result"
build:linux --copt="-Werror=unused-result"
# Add switch as an error on Linux.
build:linux --copt="-Wswitch"
build:linux --copt="-Werror=switch"
# Required for building with clang
build:linux --copt="-Wno-error=unused-but-set-variable"
# Linux ARM64 specific options
build:linux_arm64 --copt="-mtune=generic" --copt="-march=armv8-a" --copt="-O3"
# On Windows, `__cplusplus` is wrongly defined without this switch
# See https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
build:windows --copt=/Zc:__cplusplus
Are you using Windows? Does it work if you remove those lines?
Hi Terry_Woncheol_Heo,
Thank you for your reply.
Yes, I build the library on windows, and I attempted to comment out these two lines of code in .bazelrc.
build:windows --copt=/d2ReducedOptimizeHugeFunctions
build:windows --host_copt=/d2ReducedOptimizeHugeFunctions
The same error still persists.
ERROR:
C:/users/administrator/_bazel_administrator/ejytmwk2/external/XNNPACK/BUILD.bazel:4739:19: Compiling src/f32-gemm/gen/f32-gemminc-1x12-minmax-asm-aarch64-neonfma-cortex-a53.S failed: (Exit 1): clang failed: error executing command (from target @XNNPACK//:asm_microkernels) external\androidndk\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\clang -gcc-toolchain external/androidndk/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64 -target ... (remaining 52 arguments skipped)
clang: error: no such file or directory: '/d2ReducedOptimizeHugeFunctions'