Cannot run native binary extracted from resources
jackkoenig opened this issue · 1 comments
jackkoenig commented
Describe the bug
Cannot run native binary extracted from resources
Scastie snippet link
https://scastie.scala-lang.org/sjiQrl59SFSwlJu4mPs5XQ
To Reproduce
Run the above Scastie and you will see
java.io.IOException: Cannot run program "/home/sbtRunnerContainer/.cache/llvm-firtool/1.48.0/bin/firtool" (in directory "/tmp/scastie17785198868832216054"): error=2, No such file or directory
Expected behavior
It would be really helpful to be able to run this binary as it is required for Chisel to fully function. From an old discussion on Gitter, this is probably due to default Docker security settings. If it's possible to change this, it would be super helpful for Chisel users.
Screenshot ( Optional )
No response
Version
Scastie website
What browsers are you seeing the problem on?
Safari
Relevant log output
2023.08.04 15:29:13:849 run-main-0 DEBUG firtoolresolver.Main.checkPath:63
Checking FIRTOOL_PATH for firtool
2023.08.04 15:29:13:865 run-main-0 DEBUG firtoolresolver.Main.checkPath:69
FIRTOOL_PATH not set
2023.08.04 15:29:13:867 run-main-0 DEBUG firtoolresolver.Main.checkResources:107
Checking resources for firtool
2023.08.04 15:29:13:869 run-main-0 DEBUG firtoolresolver.Main.checkResources:124
Firtool version 1.48.0 found in resources
2023.08.04 15:29:13:871 run-main-0 DEBUG firtoolresolver.Main.checkResources:134
Firtool binary /home/sbtRunnerContainer/.cache/llvm-firtool/1.48.0/bin/firtool already exists
proc(ArraySeq(Shellable(List(/home/sbtRunnerContainer/.cache/llvm-firtool/1.48.0/bin/firtool)), Shellable(List(--version))))
java.io.IOException: Cannot run program "/home/sbtRunnerContainer/.cache/llvm-firtool/1.48.0/bin/firtool" (in directory "/tmp/scastie17785198868832216054"): error=2, No such file or directory
...
jackkoenig commented
Just to note, this does work in scala-cli:
$ cat test.scala
//> using repository "sonatype-s01:snapshots"
//> using scala "2.13.11"
//> using lib "org.chipsalliance:llvm-firtool:1.48.0-SNAPSHOT"
//> using lib "org.chipsalliance::firtool-resolver:0.1.0-SNAPSHOT"
//> using lib "com.lihaoyi::os-lib:0.9.1"
//> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations"
object Main extends App {
val bin = firtoolresolver.Resolve("1.48.0-SNAPSHOT", verbose = true)
val binPath = bin.toOption.get.path.toString
val proc = os.proc(binPath, "--version")
println(proc)
proc.call(stdout = os.Inherit, stderr = os.Inherit)
}
$ scala-cli test.scala
Downloading 4 dependencies
Compiling project (Scala 2.13.11, JVM)
Compiled project (Scala 2.13.11, JVM)
2023.08.04 08:49:01:873 main DEBUG firtoolresolver.Main.checkPath:63
Checking FIRTOOL_PATH for firtool
2023.08.04 08:49:01:930 main DEBUG firtoolresolver.Main.checkPath:69
FIRTOOL_PATH not set
2023.08.04 08:49:01:932 main DEBUG firtoolresolver.Main.checkResources:107
Checking resources for firtool
2023.08.04 08:49:01:974 main DEBUG firtoolresolver.Main.checkResources:124
Firtool version 1.48.0 found in resources
2023.08.04 08:49:01:976 main DEBUG firtoolresolver.Main.checkResources:134
Firtool binary /Users/jackk/Library/Caches/org.chipsalliance.llvm-firtool/1.48.0/bin/firtool already exists
proc(ArraySeq(Shellable(List(/Users/jackk/Library/Caches/org.chipsalliance.llvm-firtool/1.48.0/bin/firtool)), Shellable(List(--version))))
LLVM (http://llvm.org/):
LLVM version 17.0.0git
Optimized build.
CIRCT firtool-1.48.0