style95 commented on issue #5196:
URL: https://github.com/apache/openwhisk/issues/5196#issuecomment-1135909801

   I could build OpenWhisk with an ugly workaround.
   This is not a good solution and this issue must be addressed, but anyone who 
suffers from this might take this approach.
   
   ### Summary
   In short, what I did to build OpenWhisk is as follows.
   
   ```bash
   $ export GRADLE_OPTS=-Dorg.gradle.project.buildDir=/tmp/gradle-build
   $ ./gradlew distDocker
   $ mv /tmp/gradle-build core/scheduler/build
   $ unset GRADLE_OPTS
   $ ./gradlew distDocker -x :core:scheduler:generateProto
   ```
   
   -----
   
   ### Details
   
   The main issue was the gradle plugin could not properly recognize M1 macs.
   So I added the following to the `core/scheduler/build.gradle`.
   
https://gist.github.com/style95/ac7bb101c64b1308e7e92830ff0a74c0/revisions#diff-49a96e7eea8a94af862798a45174e6ac43eb4f8b4bd40759b5da63ba31ec3ef7R87
   
   It looks for `protoc_platform` so I added the following to the 
`~/.gradle/gradle.properties`
   
   ```bash
   protoc_platform=osx-x86_64
   ```
   This is basically the same thing as what is described in the issue but the 
protoc version should be `3.4.0`.
   
   After then it will complain about the not found log.
   
   ```bash
   * What went wrong:
   Execution failed for task ':core:scheduler:generateProto'.
   > protoc: stdout: . stderr: Exception in thread "main" 
java.io.FileNotFoundException: build/akka-grpc-gradle-plugin.log (No such file 
or directory)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at java.io.PrintWriter.<init>(PrintWriter.java:192)
        at java.io.PrintWriter.<init>(PrintWriter.java:232)
        at akka.grpc.gen.FileLogger.<init>(Logging.scala:35)
        at akka.grpc.gen.Main$.$anonfun$logger$1(Main.scala:48)
        at scala.Option.map(Option.scala:163)
        at 
akka.grpc.gen.Main$.delayedEndpoint$akka$grpc$gen$Main$1(Main.scala:48)
        at akka.grpc.gen.Main$delayedInit$body.apply(Main.scala:14)
        at scala.Function0.apply$mcV$sp(Function0.scala:39)
        at scala.Function0.apply$mcV$sp$(Function0.scala:39)
        at 
scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
        at scala.App.$anonfun$main$1$adapted(App.scala:80)
        at scala.collection.immutable.List.foreach(List.scala:392)
        at scala.App.main(App.scala:80)
        at scala.App.main$(App.scala:78)
        at akka.grpc.gen.Main$.main(Main.scala:14)
        at akka.grpc.gen.Main.main(Main.scala)
     --akkaGrpc_out: protoc-gen-akkaGrpc: Plugin failed with status code 1.
   ```
   
   The plugin sets the log location based on the `buildDir` of the project.
   
https://github.com/akka/akka-grpc/blob/df0bd8fd9e545aadc6d0e7543a39bda61eb6a133/gradle-plugin/src/main/groovy/akka/grpc/gradle/AkkaGrpcPlugin.groovy#L66
   
   So I changed its location to somewhere else like below and run `./gradlew 
distDocker`.
   
   ```bash
   $ export GRADLE_OPTS=-Dorg.gradle.project.buildDir=/tmp/gradle-build
   $ ./gradlew distDocker
   ```
   
   The build itself will still fail because dependency resolution is failed, 
but it will pass the `:core:scheduler:generateProto` task.
   And the built codes will be placed in `/tmp/gradle-build`.
   So I just move the built results to `core/scheduler/build`.
   
   After then unset the `GRADLE_OPTS` and rerun `distDocker` without the 
`core:scheduler:generateProto` task.
   
   ```bash
   $ mv /tmp/gradle-build core/scheduler/build
   $ unset GRADLE_OPTS
   $ ./gradlew distDocker -x :core:scheduler:generateProto
   ```
   
   What I am curious about is I tried setting the `buildDir` as the 
`core/scheduler/build` directly, but it didn't work.
   It couldn't find the log file even if there was a log file.
   Not quite sure the reason.
   
   Anyway, I hope this helps anyone who tries to build OpenWhisk on M1 Mac 
until we address this issue.
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to