Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protoc-gen-scala: program not found or is not executable #5

Closed
pcalcado opened this issue Dec 22, 2014 · 2 comments
Closed

protoc-gen-scala: program not found or is not executable #5

pcalcado opened this issue Dec 22, 2014 · 2 comments

Comments

@pcalcado
Copy link

Hey,

This may not be a bug, so sorry if this is not the right place but I couldn't find a mailing list.

I am investigating ScalaPB as a replacement for sbtprotobuf and pure-Java classes.

When I run the generation command I get this:

> protobuf:protobufGenerate
[info] Compiling 2 protobuf files to /<snip>/server/target/scala-2.10/src_managed/main/compiled_protobuf,/<snip>/server/target/scala-2.10/src_managed/main/compiled_protobuf
[info] Compiling schema /<snip>/server/src/main/protobuf/abc.proto
[info] Compiling schema /<snip>/server/src/main/protobuf/soundcloud.proto
[error] protoc-gen-scala: program not found or is not executable
[error] --scala_out: protoc-gen-scala: Plugin failed with status code 1.
[trace] Stack trace suppressed: run 'last abc/protobuf:protobufGenerate' for the full output.
[error] (abc/protobuf:protobufGenerate) protoc returned exit code: 1
[error] Total time: 0 s, completed Dec 22, 2014 6:25:37 PM

Full output:

> last abc/protobuf:protobufGenerate
[info] Compiling 2 protobuf files to /<snip>/server/target/scala-2.10/src_managed/main/compiled_protobuf,/<snip>/server/target/scala-2.10/src_managed/main/compiled_protobuf
[debug] protoc options:
[debug]     --java_out=/<snip>/server/target/scala-2.10/src_managed/main/compiled_protobuf
[debug]     --scala_out=/<snip>/server/target/scala-2.10/src_managed/main/compiled_protobuf
[info] Compiling schema /<snip>/server/src/main/protobuf/abc.proto
[info] Compiling schema /<snip>/server/src/main/protobuf/soundcloud.proto
[error] protoc-gen-scala: program not found or is not executable
[error] --scala_out: protoc-gen-scala: Plugin failed with status code 1.
java.lang.RuntimeException: protoc returned exit code: 1
    at scala.sys.package$.error(package.scala:27)
    at sbtprotobuf.ProtobufPlugin$.sbtprotobuf$ProtobufPlugin$$compile(ProtobufPlugin.scala:86)
    at sbtprotobuf.ProtobufPlugin$$anonfun$sourceGeneratorTask$1$$anonfun$6.apply(ProtobufPlugin.scala:110)
    at sbtprotobuf.ProtobufPlugin$$anonfun$sourceGeneratorTask$1$$anonfun$6.apply(ProtobufPlugin.scala:109)
    at sbt.FileFunction$$anonfun$cached$1.apply(Tracked.scala:188)
    at sbt.FileFunction$$anonfun$cached$1.apply(Tracked.scala:188)
    at sbt.FileFunction$$anonfun$cached$2$$anonfun$apply$3$$anonfun$apply$4.apply(Tracked.scala:202)
    at sbt.FileFunction$$anonfun$cached$2$$anonfun$apply$3$$anonfun$apply$4.apply(Tracked.scala:198)
    at sbt.Difference.apply(Tracked.scala:177)
    at sbt.Difference.apply(Tracked.scala:158)
    at sbt.FileFunction$$anonfun$cached$2$$anonfun$apply$3.apply(Tracked.scala:198)
    at sbt.FileFunction$$anonfun$cached$2$$anonfun$apply$3.apply(Tracked.scala:197)
    at sbt.Difference.apply(Tracked.scala:177)
    at sbt.Difference.apply(Tracked.scala:152)
    at sbt.FileFunction$$anonfun$cached$2.apply(Tracked.scala:197)
    at sbt.FileFunction$$anonfun$cached$2.apply(Tracked.scala:195)
    at sbtprotobuf.ProtobufPlugin$$anonfun$sourceGeneratorTask$1.apply(ProtobufPlugin.scala:112)
    at sbtprotobuf.ProtobufPlugin$$anonfun$sourceGeneratorTask$1.apply(ProtobufPlugin.scala:107)
    at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:35)
    at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:34)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
    at sbt.std.Transform$$anon$4.work(System.scala:64)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:244)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[error] (abc/protobuf:protobufGenerate) protoc returned exit code: 1

From all this I assume I need to have a plugin called protoc-gen-scala (I thought ScalaPB had its own plugin?). Google takes me to this project: https://github.com/ktoso/protoc-gen-scala, which seems quite old. Either way the build instructions there don't work for me either, so my question becomes: how do I setup protoc-gen-scala to work with ScalaPB?

Here is my plugins.sbt

addSbtPlugin("com.typesafe.sbt" % "sbt-start-script" % "0.10.0")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")

addSbtPlugin("org.ensime" % "ensime-sbt-cmd" % "0.1.2")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.7.1")

addSbtPlugin("com.trueaccord.scalapb" % "sbt-scalapb" % "0.4.0")

And here are the relevant bits in Build.scala:

/...
import com.trueaccord.scalapb.{ScalaPbPlugin => PB}
/...
lazy val buildSettings = super.settings ++ Defaults.coreDefaultSettings ++ graphSettings ++ microserviceConfig ++ PB.protobufSettings

I've tried versions released before November and had the same issues.

Thanks!

@thesamet
Copy link
Contributor

Hi Phil,

Just running "compile" will generate Scala sources and compile them,
If you want to just generate the sources without compiling them use:

protobuf:protobufScalaGenerate

I'll add some documentation for this, I figured most people would just invoke it through the 'compile' command. Also note that currently, the SBT plugin should work only on Unix-like systems.

@pcalcado
Copy link
Author

Thanks, that's exactly what I was looking for!

Feel free to close the issue, I won't do it myself because you may want to use it to track the documentation work.

Cheers and congrats on the good work here.

@nadavsr nadavsr closed this as completed in 5144ef4 Jan 1, 2015
thesamet added a commit that referenced this issue May 29, 2018
add scalacOptions for Scala.js source map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants