IOException when running sbt

438 views
Skip to first unread message

Jonathan Ferguson

unread,
Apr 30, 2018, 10:42:11 PM4/30/18
to ScalaPB
Hello,

  I am getting an IOException when running `sbt compile` the error suggests a executable can not be found.

I've created a sample project to replicate the error  https://bitbucket.org/jonoabroad/scalapb-example

I'm running Java8 on NixOS 17.09 with sbt 1.1.2

Any pointers would be greatly appreciated.

Thanks
Jono

Nadav Samet

unread,
Apr 30, 2018, 11:25:00 PM4/30/18
to Jonathan Ferguson, ScalaPB
Hi Jonathan, sbt-protoc uses a package called protoc-jar to launch protoc. It contains an executable for it for linux, windows and mac. It appears that extracting or launching the extracted file is failing.

Several things you could try:
1. Try to use protoc-jar directly as described on their README and see if it works on your system:
java -jar protoc-jar-3.5.1.1.jar -v2.4.1 --version

(after downloading the jar of course)
If it run/or doesn't run, we isolated the problem (it's either in sbt/sbt-protoc or in protoc-jar) and we can take it from there.

2. Alternatively, you can bypass protoc-jar but installing your own protoc binary on your system and adding this to your build.sbt:
PB.runProtoc in Compile := (args => Process("/path/to/protoc", args)!)
 However, it would be cool if we find how to get things to work out of the box for NixOS.

--
You received this message because you are subscribed to the Google Groups "ScalaPB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalapb+unsubscribe@googlegroups.com.
To post to this group, send email to sca...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalapb/083a4ca2-76d9-4e93-86c3-67be347cdccb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-Nadav

Jonathan Ferguson

unread,
Apr 30, 2018, 11:46:57 PM4/30/18
to Nadav Samet, ScalaPB
hey, thanks for the quick reply

1 give

$ java -jar protoc-jar-3.5.1.1.jar -v2.4.1 --version
protoc-jar: protoc version: 2.4.1, detected platform: linux-x86_64 (linux/amd64)
protoc-jar: embedded: bin/2.4.1/protoc-2.4.1-linux-x86_64.exe
protoc-jar: executing: [/tmp/protocjar865719994146632508/bin/protoc.exe, --version]
protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/tmp/protocjar865719994146632508/bin/protoc.exe": error=2, No such file or directory
protoc-jar: executing: [/tmp/protocjar865719994146632508/bin/protoc.exe, --version]
protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/tmp/protocjar865719994146632508/bin/protoc.exe": error=2, No such file or directory
protoc-jar: executing: [/tmp/protocjar865719994146632508/bin/protoc.exe, --version]
protoc-jar: protoc version: 2.4.1, detected platform: linux-x86_64 (linux/amd64)
protoc-jar: embedded: bin/2.4.1/protoc-2.4.1-linux-x86_64.exe
protoc-jar: executing: [/home/jonoabroad/protocjar3793699017347780540/bin/protoc.exe, --version]
protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/home/jonoabroad/protocjar3793699017347780540/bin/protoc.exe": error=2, No such file or directory
protoc-jar: executing: [/home/jonoabroad/protocjar3793699017347780540/bin/protoc.exe, --version]
protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/home/jonoabroad/protocjar3793699017347780540/bin/protoc.exe": error=2, No such file or directory
protoc-jar: executing: [/home/jonoabroad/protocjar3793699017347780540/bin/protoc.exe, --version]
protoc-jar: java.io.IOException: Cannot run program "/home/jonoabroad/protocjar3793699017347780540/bin/protoc.exe": error=2, No such file or directory
java.io.IOException: Cannot run program "/home/jonoabroad/protocjar3793699017347780540/bin/protoc.exe": error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at com.github.os72.protocjar.Protoc.runProtoc(Protoc.java:116)
    at com.github.os72.protocjar.Protoc.runProtoc(Protoc.java:81)
    at com.github.os72.protocjar.Protoc.main(Protoc.java:52)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 3 more



I'll prod some more, I assume I am missing some expected dependency from fat linux installs

On 1 May 2018 at 13:24, Nadav Samet <thes...@gmail.com> wrote:
Hi Jonathan, sbt-protoc uses a package called protoc-jar to launch protoc. It contains an executable for it for linux, windows and mac. It appears that extracting or launching the extracted file is failing.

Several things you could try:
1. Try to use protoc-jar directly as described on their README and see if it works on your system:
java -jar protoc-jar-3.5.1.1.jar -v2.4.1 --version

(after downloading the jar of course)
If it run/or doesn't run, we isolated the problem (it's either in sbt/sbt-protoc or in protoc-jar) and we can take it from there.

2. Alternatively, you can bypass protoc-jar but installing your own protoc binary on your system and adding this to your build.sbt:
PB.runProtoc in Compile := (args => Process("/path/to/protoc", args)!)
 However, it would be cool if we find how to get things to work out of the box for NixOS.

On Mon, Apr 30, 2018 at 7:42 PM, Jonathan Ferguson <jonathan@underscoreconsulting.com> wrote:
Hello,

  I am getting an IOException when running `sbt compile` the error suggests a executable can not be found.

I've created a sample project to replicate the error  https://bitbucket.org/jonoabroad/scalapb-example

I'm running Java8 on NixOS 17.09 with sbt 1.1.2

Any pointers would be greatly appreciated.

Thanks
Jono

--
You received this message because you are subscribed to the Google Groups "ScalaPB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalapb+unsubscribe@googlegroups.com.
To post to this group, send email to sca...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalapb/083a4ca2-76d9-4e93-86c3-67be347cdccb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-Nadav



--
Jonathan Ferguson
Underscore Consulting
http://underscore.io/
@jonoabroad

Nadav Samet

unread,
Apr 30, 2018, 11:56:23 PM4/30/18
to Jonathan Ferguson, ScalaPB
Ok, you can have a look at what protoc-jar does here: https://github.com/os72/protoc-jar/blob/master/src/main/java/com/github/os72/protocjar/Protoc.java

Since the error is "No such file or directory" I don't think it means you miss a dependency.

Is it possible that the user running the process is unable to write to /tmp? When the process forks to launch the extracted file, is it possible that the subprocess is unable to read /tmp?
--
-Nadav

Jonathan Ferguson

unread,
Apr 30, 2018, 11:57:55 PM4/30/18
to Nadav Samet, ScalaPB
I can write to /tmp
```
$ echo "I am a moose" > /tmp/IamAMoose

[jonoabroad@chewbacca:~/Development/example]$ cat /tmp/IamAMoose
I am a moose

```


Nadav Samet

unread,
May 1, 2018, 12:17:19 AM5/1/18
to Jonathan Ferguson, ScalaPB
Based on the last comment it looks like it's an issue between protoc-jar and nixos. I think that the best solution, for the time being, would be option #2 above. 
--
-Nadav
Reply all
Reply to author
Forward
0 new messages