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

Cannot run native binary extracted from resources #920

Open
jackkoenig opened this issue Aug 4, 2023 · 1 comment
Open

Cannot run native binary extracted from resources #920

jackkoenig opened this issue Aug 4, 2023 · 1 comment

Comments

@jackkoenig
Copy link

jackkoenig commented Aug 4, 2023

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant