Working on the same problem. You can get past this error with the following:
toolChains {
// If you have both VC and Gcc installed, VC will be selected, unless you
// set 'vcDisable=true'
if (!vcDisable) {
visualCpp(VisualCpp) {
}
}
clang(Clang)
gcc(Gcc){
target("linux_aarch64") {
cppCompiler.executable = "/usr/bin/gcc"
}
}
}
EDIT: got it fixed!
First, I’m working on branch v0.13.2 because that’s what I need to compile bazel to compile tensorflow.
diff --git a/compiler/build.gradle b/compiler/build.gradle
index a487992..f1d593b 100644
--- a/compiler/build.gradle
+++ b/compiler/build.gradle
@@ -46,10 +46,13 @@ model {
visualCpp(VisualCpp) {
}
}
- gcc(Gcc) {
- }
- clang(Clang) {
+ clang(Clang)
+ gcc(Gcc){
+ target("linux_aarch64") {
+ cppCompiler.executable = "/usr/bin/gcc"
+ }
}
+
}
platforms {
@@ -59,11 +62,15 @@ model {
x86_64 {
architecture "x86_64"
}
+ linux_aarch64 {
+ architecture "arm64"
+ operatingSystem "linux"
+ }
}
components {
java_plugin(NativeExecutableSpec) {
- if (arch in ['x86_32', 'x86_64']) {
+ if (arch in ['x86_32', 'x86_64', 'arm64']) {
// If arch is not within the defined platforms, we do not specify the
// targetPlatform so that Gradle will choose what is appropriate.
targetPlatform arch
@@ -91,7 +98,7 @@ model {
// Clang under OSX doesn't support these options.
linker.args "-Wl,-Bstatic", "-lprotoc", "-lprotobuf", "-static-libgcc",
"-static-libstdc++",
- "-Wl,-Bdynamic", "-lpthread", "-s"
+ "-lpthread", "-lc", "-s", "-static"
}
addEnvArgs("LDFLAGS", linker.args)
} else if (toolChain in VisualCpp) {
I don’t know if I needed to change the linker options, but I figured it couldn’t hurt based on some of the bazel docs.
Also, here’s my gradle.properties file
skipCodegen=false
protoc=/usr/bin/protoc
Where the /usr/bin/protoc was a custom compiled version as described in the grpc-java docs.