grpc-java on arm

716 views
Skip to first unread message

hellos...@gmail.com

unread,
Jun 1, 2016, 8:25:26 AM6/1/16
to grpc.io

Hi,


I'm building grpc-java for ARM. For building bazel, I need an ARM version of the file


protoc-gen-grpc-java-0.13.2-linux-x86_32.exe


My understanding is that grpc-java provides an appropriate binary after successful compilation.


I've already compiled and installed protobuf 3.0.0-beta3 and grpc. Both seem to work.


Compiling grpc-java, however, doesn't work:


ubuntu@tegra-ubuntu:~/src/grpc-java$ ./gradlew build
FAILURE: Build failed with an exception.
* Where:
Build file '/home/ubuntu/src/grpc-java/all/build.gradle' line: 32
* What went wrong:
A problem occurred evaluating project ':grpc-all'.
> A problem occurred configuring project ':grpc-benchmarks'.
   > Could not resolve all dependencies for configuration ':grpc-benchmarks:protobufToolsLocator_protoc'.
      > Could not find protoc-linux-arm_32.exe (com.google.protobuf:protoc:3.0.0-beta-3).
        Searched in the following locations:
            https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-3/protoc-3.0.0-beta-3-linux-arm_32.exe
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 13.786 secs

The cause for the failure is that the reposition (repo1.maven.org) doesn't contain a file 'protoc-3.0.0-beta-3-linux-arm_32.exe'.

Locally, I have a working protoc compiler. How can I instruct the gradle script to use that one rather than the one from the repo?

Thanks
Armin

hellos...@gmail.com

unread,
Jun 1, 2016, 9:44:14 AM6/1/16
to grpc.io, hellos...@gmail.com
Okay, I could fix that:

1. Just replace the code that resolves the ref to the executable absolutely. This is just a hack, but it indicates that the build script has a bug there.

               protoc {

-                if (project.hasProperty('protoc')) {

-                  path = project.protoc

-                } else {

-                  artifact = "com.google.protobuf:protoc:${protobufVersion}"

-                }

+               path = '/usr/bin/protoc'

+                //if (project.hasProperty('protoc')) {

+                //  path = project.protoc

+                //} else {

+                //  artifact = "com.google.protobuf:protoc:${protobufVersion}"

+               //  println('#### artifact=' + artifact)

+                //}

              }




2. Fixed the subsequent 'toolchain not found' error

--- a/compiler/build.gradle

+++ b/compiler/build.gradle

@@ -47,6 +47,9 @@ model {

      }

    }

    gcc(Gcc) {

+        target("linux_arm-v7") {

+           println('*** HERE')

+        }

    }

    clang(Clang) {

    }



So that is settled. Now I've another error regarding a " ‘const class google::protobuf::FileOptions’ has no member named ‘javanano_use_deprecated_package’" error. I'm posting that in a new topic.

Thanks
Armin

Eric Anderson

unread,
Jun 1, 2016, 2:48:49 PM6/1/16
to hellos...@gmail.com, grpc.io
Yeah... we've not built Java for arm at all. So this will be a bit more painful.

On Wed, Jun 1, 2016 at 6:44 AM, <hellos...@gmail.com> wrote:
1. Just replace the code that resolves the ref to the executable absolutely. This is just a hack, but it indicates that the build script has a bug there.

You just need to define the protoc build property. For instance by doing `gradle build -Pprotoc=path/to/protoc` (or you could use a gradle.properties, and described in COMPILING.md for skipCodegen).

2. Fixed the subsequent 'toolchain not found' error

It's unclear what the proper fix is here. Maybe we expand the arch mapping we did a bit later:

  components {
    java_plugin(NativeExecutableSpec) {
      if (arch in ['x86_32', 'x86_64']) {
        // If arch is not within the defined platforms, we do not specify the
        // targetPlatform so that Gradle will choose what is appropriate.
        targetPlatform arch
      }
      baseName "$protocPluginBaseName"
    }
  }

hellos...@gmail.com

unread,
Jun 2, 2016, 1:43:49 AM6/2/16
to grpc.io, hellos...@gmail.com
Thanks Eric, that's awesome!

1. Just replace the code that resolves the ref to the executable absolutely. This is just a hack, but it indicates that the build script has a bug there.

You just need to define the protoc build property. For instance by doing `gradle build -Pprotoc=path/to/protoc` (or you could use a gradle.properties, and described in COMPILING.md for skipCodegen).

I totally missed that paragraph, that would have saved me a lot of time. 
 

2. Fixed the subsequent 'toolchain not found' error

It's unclear what the proper fix is here. Maybe we expand the arch mapping we did a bit later:

  components {
    java_plugin(NativeExecutableSpec) {
      if (arch in ['x86_32', 'x86_64']) {
        // If arch is not within the defined platforms, we do not specify the
        // targetPlatform so that Gradle will choose what is appropriate.
        targetPlatform arch
      }
      baseName "$protocPluginBaseName"
    }
  }

Strange enough,  after I've inserted the 
target("linux_arm-v7") {
}

Eric Anderson

unread,
Jun 2, 2016, 12:40:25 PM6/2/16
to Armin Wasicek, grpc.io
On Wed, Jun 1, 2016 at 10:43 PM, <hellos...@gmail.com> wrote:
2. Fixed the subsequent 'toolchain not found' error

It's unclear what the proper fix is here. Maybe we expand the arch mapping we did a bit later:

  components {
    java_plugin(NativeExecutableSpec) {
      if (arch in ['x86_32', 'x86_64']) {
        // If arch is not within the defined platforms, we do not specify the
        // targetPlatform so that Gradle will choose what is appropriate.
        targetPlatform arch
      }
      baseName "$protocPluginBaseName"
    }
  }

Strange enough,  after I've inserted the 
target("linux_arm-v7") {
}

It looks like you may not have finished that thought. I'll note that the problem with your solution is that it ends up trying to build for ARM all the time (in addition to whatever platform you are on). We'll probably need to grab an ARM device here and see what works.
Reply all
Reply to author
Forward
0 new messages