mmhelloworld/idris-jvm

Invoking idris-codegen-jvm on Windows 7 Enterprise fails at "rawSystem" call

harveywi opened this issue · 6 comments

I'm trying to run the Idris JVM bytecode backend on a Windows 7 Enterprise machine. I follow all of the installation steps. When I try to compile the "pythag.idr" example given on the Github landing page, I get the following error:

c:\Temp>idris --portable-codegen jvm pythag.idr -o target idris-codegen-jvm: rawSystem: does not exist (No such file or directory)

After some experimentation, I think this is because rawSystem (a Haskell function) is pedantic and requires the ".bat" at the end of "idris-codegen-jvm". I confirmed this by experimenting with some other .bat files on my machine.

As a workaround, I tried to hack around this by creating a Windows shortcut to the batch file with no file extension, but that did not work. Also, running things inside of a Cygwin shell or a Windows PowerShell does not help.

In lieu of a workaround, there may be a code change that is more Windows friendly: Instead of using the Haskell rawSystem function to invoke idris-codegen-jvm, the "system" function could possibly be used instead. However, this may not be ideal - I am not too familiar with the Haskell System.Process module.

Hi,

Thank you for trying out idris-jvm. Are you sure you have <IDRIS_JVM_EXTRACTED_DIR>/codegen/bin in your PATH as mentioned in README? Idris-codegen-jvm.bat should be available on that directory. I will reach home in few minutes and I should be able to verify this with my old windows machine. I will keep you posted here.

Hi, thanks for the quick response!

Yes, I have confirmed that <IDRIS_JVM_EXTRACTED_DIR>/codegen/bin is in my PATH environment variable, and that idris-codegen-jvm.bat is in that directory. Some additional proof:

Running where idris-codegen-jvm at the command prompt prints out C:\Temp\idris-jvm-1.0-SNAPSHOT-20170702\codegen\bin\idris-codegen-jvm and C:\Temp\idris-jvm-1.0-SNAPSHOT-20170702\codegen\bin\idris-codegen-jvm.bat. As a workaround, I tried removing the bash script from that directory in case it confused rawSystem. It didn't help.

And I can run idris-codegen-jvm.bat from the command line without supplying an absolute path.

For what it's worth, I'm pretty sure that the call to rawSystem will succeed if "idris-codegen-jvm.bat" is passed as an argument instead of "idris-codegen-jvm".

Thanks for your help!

Hi,

I got it working on Windows. Two things:

  1. To make Idris successfully invoke idris-codegen-jvm.bat, the --portable-codegen argument should be passed jvm.bat. The complete command would be like:
    idris --portable-codegen jvm.bat pythag.idr -o target
  2. The batch script didn''t setup the classpath correctly for me. The paths had .. in it which is not replaced when Idris invokes the command so I had to edit the batch file to set that up correctly. In the batch file idris-codegen-jvm.bat, just before line no 75:

set REPO=<IDRIS_JVM_EXTRACTED_DIR>\codegen\lib

Please let me know if you still have issues. I will fix the batch script meanwhile.

Thank you for helping out diagnosing this issue!

Hi,

I have uploaded a new release fixing the Windows launcher and the README is also updated for the new archive. Please give it a try and let me know if there is any issue.

Thank you! It works for me, though I had to take a slightly altered approach from the instructions in README.md. I created a pull request with an update to the instructions to help Windows users.

Thank you very much for your help!

Great, thank you!