I am trying to edit this build.gradle script to build this software on an arm 64 platform:
“https://github.com/grpc/grpc-java/blob/v0.15.0/compiler/build.gradle#L55”
The initial error I was getting was this one …
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':grpc-compiler'.
> Exception thrown while executing model rule: NativeComponentModelPlugin.Rules#createBinaries(TargetedNativeComponentInternal, PlatformResolvers, BuildTypeContainer, FlavorContainer, ServiceRegistry)
> Invalid NativePlatform: linux_aarch64
I opened this ticket:
“https://github.com/grpc/grpc-java/issues/2202”
the suggested solution was to edit the gradle script to build for this platform.
I made the following change …
platforms {
x86_32 {
architecture "x86"
}
x86_64 {
architecture "x86_64"
}
linux_aarch64 {
operatingSystem "linux"
architecture "arm64"
}
}
components {
java_plugin(NativeExecutableSpec) {
if (arch in ['x86_32', 'x86_64', 'linux_aarch64']) {
// 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"
}
}
The build goes farther now, but I am getting a new error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':grpc-compiler:compileJava_pluginExecutableJava_pluginCpp'.
> No tool chain is available to build for platform 'linux_aarch64':
- Tool chain 'visualCpp' (Visual Studio): Visual Studio is not available on this operating system.
- Tool chain 'gcc' (GNU GCC): Don't know how to build for platform 'linux_aarch64'.
- Tool chain 'clang' (Clang): Don't know how to build for platform 'linux_aarch64'.
I am uncertain how to tell the gcc tool chain to build for the platform linux_aarch64.
I found one guy who had a similar problem
this is what he did …
“http://gradle.1045684.n5.nabble.com/Customizing-path-to-gcc-doesn-t-seem-to-work-td5712422.html”
toolChains {
gcc(Gcc) {
path '/path/to/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/bin'
getCCompiler().executable = 'x86_64-linux-g++'
getCppCompiler().executable = 'x86_64-linux-g++'
getLinker().executable = 'x86_64-linux-ld'
getAssembler().executable = 'x86_64-linux-as'
}
I am guessing that I should do something similar, to specify the arm64 architecture, but I’m not sure exactly what. Could not find the doc on this.
UPDATED
I tried this …
gcc(Gcc) {
getCCompiler().executable = 'aarch64-linux-gnu-gcc'
getCppCompiler().executable = 'aarch64-linux-gnu-g++'
getLinker().executable = 'aarch64-linux-gnu-ld'
getAssembler().executable = 'aarch64-linux-gnu-as'
}
but I got this error …
* What went wrong:
A problem occurred configuring project ':grpc-compiler'.
> Exception thrown while executing model rule: toolChains { ... } @ compiler/build.gradle line 42, column 3
> Could not find method getCCompiler() for arguments [] on Tool chain 'gcc' (GNU GCC) of type org.gradle.nativeplatform.toolchain.internal.gcc.GccToolChain.