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

Make does not work on Windows #1596

Closed
p-offtermatt opened this issue Apr 5, 2022 · 8 comments · Fixed by #1599
Closed

Make does not work on Windows #1596

p-offtermatt opened this issue Apr 5, 2022 · 8 comments · Fixed by #1599
Assignees
Labels
bug DevOps As practice, not role. Subsumes CI/CD, project organization, operationalization etc.

Comments

@p-offtermatt
Copy link
Collaborator

p-offtermatt commented Apr 5, 2022

Running sbt apalacheCurrentPackage gives an error on Windows 11:

[error]         at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
[error]         at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
[error]         at scala.sys.process.ProcessBuilderImpl$Simple.run(ProcessBuilderImpl.scala:75)
[error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.run(ProcessBuilderImpl.scala:106)
[error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$anonfun$runBuffered$1(ProcessBuilderImpl.scala:154)
[error]         at scala.runtime.java8.JFunction0$mcI$sp.apply(JFunction0$mcI$sp.java:23)
[error]         at sbt.internal.util.BufferedLogger.buffer(BufferedLogger.scala:151)
[error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.runBuffered(ProcessBuilderImpl.scala:154)
[error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$bang(ProcessBuilderImpl.scala:120)
[error]         at $c13783896b63ff10eb4d$.$anonfun$root$7(build.sbt:295)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]         at sbt.Execute.work(Execute.scala:291)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:829)
[error] Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
[error]         at java.base/java.lang.ProcessImpl.create(Native Method)
[error]         at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:487)
[error]         at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:154)
[error]         at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
[error]         at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
[error]         at sbt.internal.util.BufferedLogger.buffer(BufferedLogger.scala:151)
[error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.runBuffered(ProcessBuilderImpl.scala:154)
[error]         at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$bang(ProcessBuilderImpl.scala:120)
[error]         at $c13783896b63ff10eb4d$.$anonfun$root$7(build.sbt:295)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]         at sbt.Execute.work(Execute.scala:291)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:829)
[error] (apalacheCurrentPackage) java.io.IOException: Cannot run program "ln": CreateProcess error=2, The system cannot find the file specified

Screenshot 2022-04-05 142442

It is caused by the line s"ln -sfn ${unzipped} ${current_pkg}" ! log
https://github.com/informalsystems/apalache/blob/c9bc39b9543413c94e38eb349c5a560b8407a28a/build.sbt#L295

On Windows, ln does not exist, see https://superuser.com/questions/182553/does-windows-have-the-ln-s-or-equivalent

Changing the line to this (seems to) work:
s"cmd /c mklink /D ${current_pkg} ${unzipped}" ! log

Potentially one could detect the OS and execute a different command depending on it

@thpani
Copy link
Collaborator

thpani commented Apr 5, 2022

Thanks for the bug report!

Since the sbt file can contain arbitrary Scala, we can probably use Files.createSymbolicLink to be platform-independent?

Do you want to give it a try, @p-offtermatt?
FYI @shonfeder

@thpani
Copy link
Collaborator

thpani commented Apr 5, 2022

I'm curious, the tar command 2 lines above the ln worked on Windows?

@p-offtermatt
Copy link
Collaborator Author

Yes, tar is available by default on my machine.

@thpani thpani added the DevOps As practice, not role. Subsumes CI/CD, project organization, operationalization etc. label Apr 5, 2022
@p-offtermatt
Copy link
Collaborator Author

I adjusted this, but it appears to have a problem with privileges, giving me an error message:

[error] java.nio.file.FileSystemException: C:\Users\phili\Documents\Programming\apalache\target\universal\current-pkg: A required privilege is not held by the client.
[error]
[error]         at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
[error]         at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
[error]         at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
[error]         at java.base/sun.nio.fs.WindowsFileSystemProvider.createSymbolicLink(WindowsFileSystemProvider.java:585)
[error]         at java.base/java.nio.file.Files.createSymbolicLink(Files.java:1059)
[error]         at $045410cb8876ab0340f4$.$anonfun$root$7(build.sbt:296)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]         at sbt.Execute.work(Execute.scala:291)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:829)
[error] (apalacheCurrentPackage) java.nio.file.FileSystemException: C:\Users\phili\Documents\Programming\apalache\target\universal\current-pkg: A required privilege is not held by the client.

This curiously occurs even with Powershell started as an administrator.
For reference, I replaced the line with these two:

val target_path: java.nio.file.Path = java.nio.file.Paths.get("", unzipped)
java.nio.file.Files.createSymbolicLink(current_pkg.toPath(), target_path)

@thpani
Copy link
Collaborator

thpani commented Apr 5, 2022

Looks like it's UAC-related? https://stackoverflow.com/q/23217460

@p-offtermatt
Copy link
Collaborator Author

Thanks for the pointer!

@thpani
Copy link
Collaborator

thpani commented Apr 5, 2022

FWIW, your code works on macOS ;)

@p-offtermatt
Copy link
Collaborator Author

I was able to run this after disabling UAC, by editing the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System and switching EnableLUA to 0. This doesn't seem to be very advisable in general, but was the only way I got it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug DevOps As practice, not role. Subsumes CI/CD, project organization, operationalization etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants