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

Windows support #106

Closed
alexbiehl opened this issue Oct 25, 2016 · 51 comments
Closed

Windows support #106

alexbiehl opened this issue Oct 25, 2016 · 51 comments

Comments

@alexbiehl
Copy link
Contributor

I am trying to bootstrap eta on Windows and stack exec eta-build install fails with

Configuring ghc-prim-0.4.0.0...
# epm (for install)
Building ghc-prim-0.4.0.0...
Preprocessing library ghc-prim-0.4.0.0...
eta.exe: could not execute: C:\Users\abiehl\AppData\Roaming\eta/../mingw/bin/gcc.exe
Error when running Shake build system:
* install
user error (Development.Shake.cmd, system command failed
Command: epm build
Current directory: C:\Users\abiehl\git\eta\libraries\ghc-prim
Exit code: 1
Stderr:
eta.exe: could not execute: C:\Users\abiehl\AppData\Roaming\eta/../mingw/bin/gcc.exe
)

Somehow it thinks a gcc is at C:\Users\abiehl\AppData\Roaming\eta/../mingw/bin/gcc.exe which is of course not right! (a good gcc is on path through stack exec).

Trying to manually build ghc-prim with
stack exec -- epm build --eta-options=" -v4 -pgmP C:\Users\abiehl\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\mingw\bin\gcc"

Building ghc-prim-0.4.0.0...
Preprocessing library ghc-prim-0.4.0.0...
The ETA programming language compiler, Version 0.0.1 booted by GHC version 7.10.3
wired-in package ghc-prim not found.
wired-in package integer not found.
wired-in package base not found.
wired-in package rts mapped to rts-0.1.0.0-dd60ce55e5e6e7d613c6ae1fe388a75d
wired-in package template-haskell not found.
wired-in package ghc not found.
wired-in package dph-seq not found.
wired-in package dph-par not found.
E   rts-0.1.0.0-dd60ce55e5e6e7d613c6ae1fe388a75d
Hsc static flags:
wired-in package ghc-prim not found.
wired-in package integer not found.
wired-in package base not found.
wired-in package rts mapped to rts-0.1.0.0-dd60ce55e5e6e7d613c6ae1fe388a75d
wired-in package template-haskell not found.
wired-in package ghc not found.
wired-in package dph-seq not found.
wired-in package dph-par not found.
*** Chasing dependencies:
Chasing modules from: *GHC.CString,*GHC.Classes,*GHC.Magic,*GHC.Tuple,*GHC.Types,*GHC.JArray
Running the pipeline
Running phase Cpp HsSrcFile
Running phase HsPp HsSrcFile
Running the pipeline
Running phase Cpp HsSrcFile
Running phase HsPp HsSrcFile
Running the pipeline
Running phase Cpp HsSrcFile
Running phase HsPp HsSrcFile
Running the pipeline
Running phase Cpp HsSrcFile
Running phase HsPp HsSrcFile
Running the pipeline
Running phase Cpp HsSrcFile
Running phase HsPp HsSrcFile
Running the pipeline
Running phase Cpp HsSrcFile
Created temporary directory: C:\Temp\ghc13676_0
*** C pre-processor:
"C:\Users\abiehl\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\mingw\bin\gcc" "-include" "dist\build\autogen\cabal_macros.h" "-v" "-I" "dist\build" "-I" "dist\build" "-I" "dist\build\autogen" "-I" "dist\build" "-D__GLASGOW_HASKELL__=710" "-D__ETA_VERSION__=000"
"-include" "C:\Users\abiehl\AppData\Roaming\eta\include\ghcversion.h" "-D__GLASGOW_HASKELL_TH__=NO" "-D__SSE__=1" "-D__SSE2__=1" "-x" "assembler-with-cpp" ".\GHC\JArray.hs" "-o" "C:\Temp\ghc13676_0\ghc_1.hscpp"
Using built-in specs.
COLLECT_GCC=C:\Users\abiehl\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\mingw\bin/realgcc.exe
COLLECT_LTO_WRAPPER=C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-5.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --w
ith-gxx-include-dir=/mingw64/include/c++/5.2.0 --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynam
ic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry
--disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev3, Built by MSYS2 project' --with-bugurl=http://sourceforge.net/projects/msys2 --wit
h-gnu-as --with-gnu-ld
Thread model: posix
gcc version 5.2.0 (Rev3, Built by MSYS2 project)
COLLECT_GCC_OPTIONS='-B' 'C:\Users\abiehl\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\mingw\bin' '-B' 'C:\Users\abiehl\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\mingw\bin/../lib' '-B' 'C:\Users\abiehl\AppData\Local\Programs\stack\x86_64-windows\gh
c-7.10.3\mingw\bin/../lib/gcc/x86_64-w64-mingw32/5.2.0' '-B' 'C:\Users\abiehl\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\mingw\bin/../libexec/gcc/x86_64-w64-mingw32/5.2.0' '-include' 'dist\build\autogen\cabal_macros.h' '-v' '-I' 'dist\build' '-I' 'dist\build'
 '-I' 'dist\build\autogen' '-I' 'dist\build' '-D' '__GLASGOW_HASKELL__=710' '-D' '__ETA_VERSION__=000' '-include' 'C:\Users\abiehl\AppData\Roaming\eta\include\ghcversion.h' '-D' '__GLASGOW_HASKELL_TH__=NO' '-D' '__SSE__=1' '-D' '__SSE2__=1' '-o' 'C:\Temp\ghc13676_0\ghc_1
.hscpp' '-mtune=generic' '-march=x86-64'
 C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/cc1.exe -E -lang-asm -quiet -v -I dist\build -I dist\build -I dist\build\autogen -I dist\build -iprefix C:/Users/abiehl/AppData/Local/Programs/stack/x86_
64-windows/ghc-7.10.3/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/ -isystem C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/include -isystem C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows
/ghc-7.10.3/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/include-fixed -D_REENTRANT -D __GLASGOW_HASKELL__=710 -D __ETA_VERSION__=000 -D __GLASGOW_HASKELL_TH__=NO -D __SSE__=1 -D __SSE2__=1 -include dist\build\autogen\cabal_macros.h -include C:\Users\abiehl\AppData\Roam
ing\eta\include\ghcversion.h .\GHC\JArray.hs -mtune=generic -march=x86-64 -fno-directives-only -o C:\Temp\ccGrlwBj.s
ignoring duplicate directory "C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/include"
ignoring duplicate directory "C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/include-fixed"
ignoring duplicate directory "C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/5.2.0/include"
ignoring nonexistent directory "D:/develop/msys64/mingw64/include"
ignoring nonexistent directory "/mingw64/include"
ignoring duplicate directory "C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/5.2.0/include-fixed"
ignoring duplicate directory "C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "D:/develop/msys64/mingw64/x86_64-w64-mingw32/include"
ignoring duplicate directory "dist\build"
ignoring duplicate directory "dist\build"
#include "..." search starts here:
#include <...> search starts here:
 dist\build
 dist\build\autogen
 C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/include
 C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/include-fixed
 C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../include
 C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/include
End of search list.
COLLECT_GCC_OPTIONS='-B' 'C:\Users\abiehl\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\mingw\bin' '-B' 'C:\Users\abiehl\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\mingw\bin/../lib' '-B' 'C:\Users\abiehl\AppData\Local\Programs\stack\x86_64-windows\gh
c-7.10.3\mingw\bin/../lib/gcc/x86_64-w64-mingw32/5.2.0' '-B' 'C:\Users\abiehl\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\mingw\bin/../libexec/gcc/x86_64-w64-mingw32/5.2.0' '-include' 'dist\build\autogen\cabal_macros.h' '-v' '-I' 'dist\build' '-I' 'dist\build'
 '-I' 'dist\build\autogen' '-I' 'dist\build' '-D' '__GLASGOW_HASKELL__=710' '-D' '__ETA_VERSION__=000' '-include' 'C:\Users\abiehl\AppData\Roaming\eta\include\ghcversion.h' '-D' '__GLASGOW_HASKELL_TH__=NO' '-D' '__SSE__=1' '-D' '__SSE2__=1' '-o' 'C:\Temp\ghc13676_0\ghc_1
.hscpp' '-mtune=generic' '-march=x86-64'
 C:/Users/abiehl/AppData/Local/Programs/stack/x86_64-windows/ghc-7.10.3/mingw/bin/as.exe -v -I dist\build -I dist\build -I dist\build\autogen -I dist\build -o C:\Temp\ccopr6Jw.o C:\Temp\ccGrlwBj.s
GNU assembler version 2.25.1 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.25.1
.\GHC\JArray.hs: Assembler messages:

GHC\JArray.hs:1:0:
     Error: junk at end of line, first unrecognized character is `{'

GHC\JArray.hs:2:0:
     Error: no such instruction: `ghcforeignimportprim '

GHC\JArray.hs:3:0:
     Error: junk at end of line, first unrecognized character is `{'

GHC\JArray.hs:4:0:  Error: no such instruction: `module GHC.JArray'

GHC\JArray.hs:5:0:
     Error: junk at end of line, first unrecognized character is `('

GHC\JArray.hs:6:0:  Error: no such instruction: `jshortarray'

GHC\JArray.hs:7:0:  Error: no such instruction: `jchararray'

GHC\JArray.hs:8:0:  Error: no such instruction: `intarray'

GHC\JArray.hs:9:0:  Error: no such instruction: `jlongarray'

GHC\JArray.hs:10:0:  Error: no such instruction: `floatarray'

GHC\JArray.hs:11:0:  Error: no such instruction: `doublearray'

GHC\JArray.hs:12:0:  Error: no such instruction: `objectarray'

GHC\JArray.hs:13:0:  Error: no such instruction: `objectarrayat'

GHC\JArray.hs:14:0:  Error: no such instruction: `objectarrayset'

GHC\JArray.hs:15:0:
     Error: junk at end of line, first unrecognized character is `)'

GHC\JArray.hs:17:0:  Error: no such instruction: `import GHC.Prim'

GHC\JArray.hs:18:0:  Error: no such instruction: `import GHC.Types'

GHC\JArray.hs:20:0:  Error: no such instruction: `type JByteArray'

GHC\JArray.hs:21:0:  Error: no such instruction: `type JShortArray'

GHC\JArray.hs:22:0:  Error: no such instruction: `type JCharArray'

GHC\JArray.hs:23:0:  Error: no such instruction: `type IntArray'

GHC\JArray.hs:24:0:  Error: no such instruction: `type JLongArray'

GHC\JArray.hs:25:0:  Error: no such instruction: `type FloatArray'

GHC\JArray.hs:26:0:  Error: no such instruction: `type DoubleArray'

GHC\JArray.hs:27:0:  Error: no such instruction: `type ObjectArray'
*** Deleting temp files:
Deleting: C:\Temp\ghc13676_0\ghc_1.hscpp
Warning: deleting non-existent C:\Temp\ghc13676_0\ghc_1.hscpp
*** Deleting temp dirs:
Deleting: C:\Temp\ghc13676_0

Well it does find gcc now but it tries to assemble JArray.hs as is which is of course wrong.

How can I install eta and co on Windows?

@rahulmutt
Copy link
Member

rahulmutt commented Oct 25, 2016

Thanks a lot for testing on Windows! As you observed, something not quite right is going on. It looks like it has to do with the c-preprocessing phase which calls upon gcc -E. I think it's time I got around to relying on cpphs for managing preprocessor directives.

@alexbiehl
Copy link
Contributor Author

395fd7a fixes the build for ghc-prim.

Now its failing with:

# epm (for install)
Building integer-0.5.1.0...
Preprocessing library integer-0.5.1.0...

java\Utils.java:4:0:  error: package eta.runtime.stg does not exist
import eta.runtime.stg.StgContext;
                      ^

java\Utils.java:201:0:
     error: cannot find symbol
        public static void decodeDouble(StgContext context, double d) {
                                        ^
      symbol:   class StgContext
      location: class Utils
2 errors
Error when running Shake build system:
* install
user error (Development.Shake.cmd, system command failed
Command: epm build
Current directory: C:\Users\abiehl\git\eta\libraries\integer
Exit code: 1
Stderr:
java\Utils.java:4:0:  error: package eta.runtime.stg does not exist
import eta.runtime.stg.StgContext;
                      ^

java\Utils.java:201:0:
     error: cannot find symbol
        public static void decodeDouble(StgContext context, double d) {
                                        ^
      symbol:   class StgContext
      location: class Utils
2 errors
)

Another thing is this: you seem to detect the version of git and java with epm. On windows my git version is git version 2.8.3.windows.1 which the check seems to dislike:

# epm (for install)
Warning: cannot determine version of C:\Program Files\Git\cmd\git.exe :
"git version 2.8.3.windows.1\n"

And the java check logs:

# epm (for install)
Warning: cannot determine version of
C:\ProgramData\Oracle\Java\javapath\java.exe :
""

There is no java.exe at C:\ProgramData\Oracle\Java\javapath\java.exe I am not sure why it thinks there is?

@rahulmutt
Copy link
Member

epm gets the location of java from the search path by default. Can you go in your terminal and let me know the actual path to your java program? I'm in the process of fixing the other two errors right now.

@rahulmutt
Copy link
Member

@alexbiehl Try now?

@alexbiehl
Copy link
Contributor Author

@rahulmutt It works better now. But I get the same error again

user error (Development.Shake.cmd, system command failed
Command: epm build
Current directory: C:\Users\abiehl\git\eta\libraries\integer
Exit code: 1
Stderr:
eta.exe: could not execute: C:\Users\abiehl\AppData\Roaming\eta/../mingw/bin/gcc.exe
)

I am on mingw and which java yields /c/ProgramData/Oracle/Java/javapath/java which is quite odd.

$ echo $JAVA_HOME
C:\Program Files\Java\jdk1.8.0_65

Maybe you should also check for $JAVA_HOME this is the correct path.

@jneira
Copy link
Collaborator

jneira commented Nov 13, 2016

Hi, i a trying to build eta in windows too, and i get another error doing "stack exec eta-build -- install" :

Error when running Shake build system:
* install
user error (Development.Shake.cmd, system command failed
Command: epm build
Current directory: C:\Users\Javier\dev\lang\haskell\eta\libraries\rts
Exit code: 1
Stderr:
eta.exe: panic! (the 'impossible' happened)
  (ETA version 0.0.1):
        Parsing of archive structure failed:
Cannot locate end of central directory
in "C:\\Users\\Javier\\dev\\lang\\haskell\\eta\\libraries\\rts\\dist\\build\\HSrts-0.1.0.0.jar"

I checked that this jar exists
I am on windows 10, java 1.8.0_101
thanks

@rahulmutt
Copy link
Member

@jneira Thanks for reporting! Appveyor was giving me that exact same problem so it's nice having a repro from someone else as well. Did you happen to encounter the error that @alexbiehl reported as well? Or was your gcc properly configured?

@alexbiehl You didn't encounter a similar error on your end?

@alexbiehl
Copy link
Contributor Author

@rahulmutt no I didn't. But I tried weeks ago. I can try again tomorrow. I will report back here.

@jneira
Copy link
Collaborator

jneira commented Nov 13, 2016

i didnt get the gcc error, but i didnt nothing for it
My stack version is

Version 1.0.4, Git revision cf18703b1392a96a5a4896a560309e501af63260 (3220 commits) i386

@rahulmutt
Copy link
Member

@jneira Can you try extracting HSrts-0.0.1.jar and let me know if it succeeds? I'm trying to figure out whether the .jar file actually is corrupted or the zip library is causing the problem.

@jneira
Copy link
Collaborator

jneira commented Nov 27, 2016

@rahulmutt it seems it's the first case: when i try to open the jar the zip program raises an error (with java itself the message is clear: "Error: invalid or corrupt jar file")

@rahulmutt
Copy link
Member

@alexbiehl I closed #11 so now there should be no dependency on gcc at all. Can you try installing with the tip of master and let me know that you get the same error as @jneira?

@alexbiehl
Copy link
Contributor Author

alexbiehl commented Dec 5, 2016

I now get another error:

# epm (for install)
Building base-4.8.2.0...
Preprocessing library base-4.8.2.0...
[  4 of 210] Compiling GHC.IO[boot]     ( GHC\IO.hs-boot, dist\build\GHC\IO.jar-boot )
eta.exe: could not execute: C:\Users\abiehl\AppData\Roaming\eta/touchy.exe
Error when running Shake build system:
* install
user error (Development.Shake.cmd, system command failed
Command: epm build
Current directory: C:\Users\abiehl\git\eta\libraries\base
Exit code: 1
Stderr:
eta.exe: could not execute: C:\Users\abiehl\AppData\Roaming\eta/touchy.exe
)

What is touchy and where should it come from?

@alexbiehl
Copy link
Contributor Author

alexbiehl commented Dec 5, 2016

Ah, I found that touchy is a program supplied by GHC bin dist. It's used as a touch program on Windows as touch is not available on Windows. I think you need that too for eta to work on Windows.

@alexbiehl
Copy link
Contributor Author

alexbiehl commented Dec 5, 2016

With my touch patch eta-build install is successful! However trying $eta tests/basic/T01.hs results in

internal error: ap_v
    (Eta version 0.0.3)
    Please report this as a Eta bug:  https://github.com/typelead/eta/issues
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Unknown Source)
        at eta.runtime.RtsMessages.barf(RtsMessages.java:22)
        at eta.runtime.stg.StgClosure.apply(StgClosure.java:36)
        at eta.runtime.apply.ApV.stackEnter(ApV.java:12)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:43)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:26)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:26)
        at eta.runtime.stg.Capability.schedule(Capability.java:246)
        at eta.runtime.RtsScheduler.scheduleWaitThread(RtsScheduler.java:57)
        at eta.runtime.Rts.evalIO(Rts.java:98)
        at eta.runtime.Rts.flushStdHandles(Rts.java:215)
        at eta.runtime.Rts.hsExit_(Rts.java:178)
        at eta.runtime.Rts.shutdownHaskellAndExit(Rts.java:158)
        at eta.runtime.Rts.hsMain(Rts.java:60)
        at eta.main.main(Unknown Source)

Edit: it's not $eta tests/basic/T01.hs itself, it is java -jar tests/basic/T01.jar

@rahulmutt
Copy link
Member

Can you specify what flags you used to invoke java? Can you also try compiling the examples in the eta-examples repo and let me know the result?

@alexbiehl
Copy link
Contributor Author

abiehl@Wolfsburg MINGW64 ~/git/eta-examples/1-ffi-generics (master)
$ java -classpath dist/build/java-ffi-generics/java-ffi-generics.jar eta.main
internal error: ap_v
    (Eta version 0.0.3)
    Please report this as a Eta bug:  https://github.com/typelead/eta/issues
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Unknown Source)
        at eta.runtime.RtsMessages.barf(RtsMessages.java:22)
        at eta.runtime.stg.StgClosure.apply(StgClosure.java:36)
        at eta.runtime.apply.ApV.stackEnter(ApV.java:12)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:43)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:26)
        at eta.runtime.stg.Capability.schedule(Capability.java:246)
        at eta.runtime.RtsScheduler.scheduleWaitThread(RtsScheduler.java:57)
        at eta.runtime.Rts.evalLazyIO(Rts.java:92)
        at eta.runtime.Rts.hsMain(Rts.java:37)
        at eta.main.main(Unknown Source)

Surprisingly:
java -classpath dist/build/eta-javafx/eta-javafx.jar eta.main

Works! There is a window with a circle and a button (nothing happens if I click the button).

But when I do CTRL+C

internal error: ap_v
    (Eta version 0.0.3)
    Please report this as a Eta bug:  https://github.com/typelead/eta/issues
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Unknown Source)
        at eta.runtime.RtsMessages.barf(RtsMessages.java:22)
        at eta.runtime.stg.StgClosure.apply(StgClosure.java:36)
        at eta.runtime.apply.ApV.stackEnter(ApV.java:12)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:43)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:26)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:26)
        at eta.runtime.stg.Capability.schedule(Capability.java:246)
        at eta.runtime.RtsScheduler.scheduleWaitThread(RtsScheduler.java:57)
        at eta.runtime.Rts.evalIO(Rts.java:98)
        at eta.runtime.Rts.flushStdHandles(Rts.java:215)
        at eta.runtime.Rts.hsExit_(Rts.java:178)
        at eta.runtime.Rts.shutdownHaskellAndExit(Rts.java:158)
        at eta.runtime.Rts.hsMain(Rts.java:60)
        at eta.main.main(Unknown Source)

pops up!

@rahulmutt
Copy link
Member

@alexbiehl Hmm very interesting. flushStdHandles as you see in the stack trace happens during shutdown and if that doesn't get executed, you won't see your output. Most likely there's a windows-specific thing going on. I'll take a look.

Btw when you click the button on the JavaFX example it should print 100 in the terminal.

You can also try out the 2048 implementation.

@rahulmutt
Copy link
Member

rahulmutt commented Dec 5, 2016

I traced it and it lead me to writeRawBufferPtr in GHC.IO.FD in base. It turns out the low-level functions haven't been implemented yet for Windows - you'll see undefined sprinkled throughout.

@puffnfresh The solution you had was portable since it used just Java calls so do you think removing the #ifdef and making an identical implementation of writeRawBufferPtr for Windows can solve the problem?

@alexbiehl you can try out the change and let me know if it works for you.

@rahulmutt
Copy link
Member

@alexbiehl I've gone ahead and re-used the implementations for *nix-based systems, can you compile the windows-support branch and let me know if that fixes the problem?

@alexbiehl
Copy link
Contributor Author

alexbiehl commented Dec 6, 2016

Hmm. It doesn't it crashes with the same error. :(

Also: When I implemented the touch patch I did so on mac OS: I just noticed that unix-compat doesn't implement it on Windows and instead throws an exception... I filed a pull request here
jacobstanley/unix-compat#25 Hoping they are fast to accept it

@rahulmutt
Copy link
Member

In the mean time, can you use that definition as the implementation of touchObjectFile and send me a PR?

@jacobstanley
Copy link

jacobstanley/unix-compat#25 is merged and available on Hackage as unix-compat-0.4.3.0

@rahulmutt
Copy link
Member

@jystic Thanks for the prompt update!

@alexbiehl
Copy link
Contributor Author

@rahulmutt PR is on its way

@jneira
Copy link
Collaborator

jneira commented Jan 19, 2017

Hi, i've tried to compile again and i got another error:

Failed to install ghc-prim-0.4.0.0
Build log ( C:\Users\Javier\AppData\Roaming\epm\logs\ghc-prim-0.4.0.0.log ):
epm: Error: some packages failed to install:
ghc-prim-0.4.0.0 failed during the building phase. The exception was:
ExitFailure 1
Error when running Shake build system:
* install
user error (Development.Shake.cmd, system command failed
Command: epm install --solver=topdown
Current directory: C:\Users\Javier\dev\lang\haskell\eta\libraries\ghc-prim
Exit code: 1
Stderr:
eta.exe: panic! (the 'impossible' happened)
  (Eta version 0.0.5):
        Parsing of archive structure failed:
Cannot locate end of central directory
in "C:\\Users\\Javier\\dev\\lang\\haskell\\eta\\libraries\\ghc-prim\\dist\\build\\GHC\\Types.jar"

ghc-prim-0.4.0.0.log is empty

@rahulmutt
Copy link
Member

@jneira Thanks! Can you give me the same info I asked in #184?

@jneira
Copy link
Collaborator

jneira commented Jan 21, 2017

In my case zip-bench.exe fails:

[1 of 1] Compiling Main             ( src\Main.hs, .stack-work\dist\95439361\build\zip-bench\zip-bench-tmp\Main.o )
Linking .stack-work\dist\95439361\build\zip-bench\zip-bench.exe ...
zip-bench-0.1.0.0: copy/register
Installing executable(s) in
C:\Users\Javier\dev\lang\haskell\zip-bench\.stack-work\install\d7991dda\bin
Completed 12 action(s).
zip-bench.exe: Parsing of archive structure failed:
Cannot locate end of central directory
in "C:\\Users\\Javier\\dev\\lang\\haskell\\zip-bench\\Tuple.jar"

@rahulmutt
Copy link
Member

It's supposed to fail. Can you show a directory listing with file sizes of libraries/ghc-prim/dist after attempting an installation?

@jneira
Copy link
Collaborator

jneira commented Jan 21, 2017

Sure!

.\eta\libraries\ghc-prim\dist
21/01/2017  02:03            52.526 setup-config
.\eta\libraries\ghc-prim\dist\build\autogen
21/01/2017  02:03             3.642 cabal_macros.h
21/01/2017  02:03             1.450 Paths_ghc_prim.hs
.\eta\libraries\ghc-prim\dist\build\GHC
21/01/2017  02:03             1.318 Types.hi
21/01/2017  02:03                98 Types.jar
.\eta\libraries\ghc-prim\dist\package.conf.inplace
21/01/2017  02:03                40 package.cache

@jneira
Copy link
Collaborator

jneira commented Jan 21, 2017

Types.jar seems to be identical to Tuples.jar of zip-bench, no?
ghc-prim-0.4.0.0.log is empty

@jneira
Copy link
Collaborator

jneira commented Jan 21, 2017

Following the steps in #184 i've done a
epm install --solver=topdown -v3 > ghc-prim-build-log.txt
the log file and the ouput is in https://gist.github.com/jneira/dd45fd73209f517de2eb9cad5c3f5f21

@jneira
Copy link
Collaborator

jneira commented Feb 5, 2017

Meanwhile the zip problem is fixed to get integer lib built i've built the libraries manually, doing each step in eta-build install and repacking each jar to make it usable.
Maybe i was wrong in some of the steps but after build base library i've got the same error than @alexbiehl

C:\Users\Javier\dev\lang\haskell\eta\examples>eta HelloWorld.hs
[1 of 1] Compiling Main             ( HelloWorld.hs, HelloWorld.jar )
Linking RunHelloWorld.jar ...
C:\Users\Javier\dev\lang\haskell\eta\examples>java -jar RunHelloWorld.jar
internal error: ap_v
    (Eta version 0.0.5)
    Please report this as a Eta bug:  https://github.com/typelead/eta/issues
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Unknown Source)
        at eta.runtime.RtsMessages.barf(RtsMessages.java:22)
        at eta.runtime.stg.StgClosure.apply(StgClosure.java:37)
        at eta.runtime.apply.ApV.stackEnter(ApV.java:12)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:43)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:26)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:26)
        at eta.runtime.stg.Capability.schedule(Capability.java:260)
        at eta.runtime.RtsScheduler.scheduleWaitThread(RtsScheduler.java:57)
        at eta.runtime.Rts.evalIO(Rts.java:101)
        at eta.runtime.Rts.flushStdHandles(Rts.java:221)
        at eta.runtime.Rts.hsExit_(Rts.java:184)
        at eta.runtime.Rts.shutdownHaskellAndExit(Rts.java:164)
        at eta.runtime.Rts.hsMain(Rts.java:61)
        at eta.main.main(Unknown Source)

same with java -cp RunHelloWorld.jar eta.main

@rahulmutt
Copy link
Member

@jneira Can you go to utils/trace/trace.sh and run that script and send me the full trace output? You can read the README for instructions. Ping me on Slack if you have problems.

Also, Mark wanted to check to make sure the test suite for the zip library is worked on the machine that's creating faulty jars. Can you clone https://github.com/mrkkrp/zip and execute the tests via stack test and share the output?

Thanks!

@jneira jneira mentioned this issue Feb 5, 2017
@jneira
Copy link
Collaborator

jneira commented Feb 5, 2017

Using this translation:

@echo off
eta -o Out.jar %* && java -javaagent:slf4j-ext-1.7.21.jar=ignore=org/slf4j/:ch/qos/logback/:org/apache/log4j/:cern/colt/:java/:eta/runtime/ -cp slf4j-api-1.7.21.jar;slf4j-simple-1.7.21.jar;javassist-3.20.0-GA.jar;Out.jar -Djava.compiler=NONE eta.main

and running (trace ..\..\examples\RunHelloWorld.jar | Filter.exe) > debug.log 2> error.log

i got this trace file: https://gist.github.com/jneira/dd7399b13a4d89be61657580d941c44b

@jneira
Copy link
Collaborator

jneira commented Feb 6, 2017

I've posted the test suite of https://github.com/mrkkrp/zip in the issue mrkkrp/zip#27 (comment)
Many of tests failed with the error in parsing zip structure

@rahulmutt
Copy link
Member

@jneira Can you run the trace again removing eta/runtime/ from the ignore list? It might make it easier to trace where it's happening.

@jneira
Copy link
Collaborator

jneira commented Feb 7, 2017

@rahulmutt i've updated the gist with the trace including eta/runtime (now it has almost 10000 lines long)

@jneira
Copy link
Collaborator

jneira commented Feb 9, 2017

@rahulmutt i am afraid that after update eta to last upstream commit and install it the execution of RunHelloWorld seems to loop forever.
I've updated the gist with the log up to the loop

@jneira
Copy link
Collaborator

jneira commented Feb 9, 2017

Respect to zip lib problem: i've update my repo to use zip-0.1.6 and the install continue failing due to corrupted jar

@jneira
Copy link
Collaborator

jneira commented Feb 10, 2017

The zip bug is fixed for zip-0.1.7! Now cleaninstall completes succesfully (tested in windows xp and windows 10)

Respect to the execution of HelloWorld.hs (linked as RunHelloWorld.jar by eta) in eta/examples:

  • Actually eta only supports utf-8 character encoding for windows, which is not the default in windows (in my xp for example is page 850=cp-1252=windows-1252)
  • So if you executes the linked jar with java -jar RunHelloWorld.jar the execution doesn't terminate (you have to interrupt it with ctrl-c)
    • we guess that the char encoding is thrown inside the default exception handling itself (print to stderr) and it causes the loop, rethrowing continuously the same exception
    • it seems that the solution (pointed by @rahulmutt ) will be to translate iconv c foreign calls to java ones
    • the workaround in the meanwhile is to execute the linked jar with java -jar -Dfile.encoding=UTF-8 RunHelloWorld.jar (or maybe changing the character encoding of the command line session)

@jneira
Copy link
Collaborator

jneira commented Feb 15, 2017

@rahulmutt hi, i finally get to work Helloworld.hs with cp1215 encoding, adding a iconv first draft implementation in java: https://github.com/jneira/eta/blob/windows-support-iconv/libraries/base/java-utils/HSIConv.java

@jneira
Copy link
Collaborator

jneira commented Feb 15, 2017

i tried to execute this version of Helloworld.hs:

main :: IO () -- Note that this line is optional. Written for clarity.
main = do
  putStrLn "Hello World!"
  putStrLn "Hólà müñdõ!"
  putStrLn "世界,你好"

but it fails with

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 16
        at ghczmprim.ghc.CString$unpackzus1AR9.enter(Unknown Source)
        at ghczmprim.ghc.CString$satzus1ATB.thunkEnter(Unknown Source)
        at eta.runtime.thunk.StgInd.enter(StgInd.java:12)
        at eta.runtime.stg.StgClosure.evaluate(StgClosure.java:23)
        at base.ghc.io.handle.Text$zdwa7.enter(Unknown Source)
        at base.ghc.io.handle.Text$hPutStr2.enter(Unknown Source)
        at base.ghc.io.handle.Text$hPutStrLn1.enter(Unknown Source)
        at base.system.IO$putStrLn1.enter(Unknown Source)
        at base.system.IO$putStrLn.enter(Unknown Source)
        at eta.runtime.apply.Apply$PAPApply.enter(Apply.java:231)
        at eta.runtime.apply.StgPAP.apply(StgPAP.java:46)
        at eta.runtime.apply.ApV.stackEnter(ApV.java:12)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:43)
        at eta.runtime.stg.StgContext.checkForStackFrames(StgContext.java:79)
        at base.ghc.Base$thenIO1.enter(Unknown Source)
        at eta.runtime.apply.Apply$PAPApply.enter(Apply.java:231)
        at eta.runtime.apply.StgPAP.apply(StgPAP.java:46)
        at eta.runtime.apply.ApV.stackEnter(ApV.java:12)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:43)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:26)
        at eta.runtime.stg.StackFrame.enter(StackFrame.java:26)
        at eta.runtime.stg.Capability.schedule(Capability.java:260)
        at eta.runtime.RtsScheduler.scheduleWaitThread(RtsScheduler.java:57)
        at eta.runtime.Rts.evalLazyIO(Rts.java:95)
        at eta.runtime.Rts.hsMain(Rts.java:38)
        at eta.main.main(Unknown Source)

even with only the 2 first lines (without chinese chars)

@rahulmutt
Copy link
Member

There seems to be a some bug with unpacking Unicode strings, see #180. Probably a mismatch between the indexing in Eta [Char] and Java byte[]. I'll take a look.

@rahulmutt
Copy link
Member

I took a look at your implementation HSIConv.java. It's looking pretty good. Is it working correctly in most of the cases (without Unicode characters)?

@jneira
Copy link
Collaborator

jneira commented Feb 16, 2017

@rahulmutt
Hi, the implementation seems to work correctly if the byte string is wellformed and complete and the output buffer has enough room.
I tested the error cases:

  • if the result is EILSEQ (malformed or unmmapable input in java.nio) input, the execution terminates abnormally printing Prelude: undefined and a generic stacktrace
  • if it is E2BIG (output buffer has no enough room), it prints the partial output buffer (f.e. Hello instead Hello World!). I suppose this is the same behavior than in ghc
  • I didnt find a easy way to handle the EINVAL case (incomplete multybyte sequence at the end of input), cause java decoding handle this case as the malformed one (EILSEQ). If this case is important we could investigate a way to do it.

I've changed the impl: jneira@3c636e3

@rahulmutt
Copy link
Member

@jneira Since Windows build is working pretty well now minus the patches and the cases missing in the error handling of iconv, I think we can close this. Can you reproduce whatever is left on the iconv error handling in a new issue?

@jneira
Copy link
Collaborator

jneira commented Feb 24, 2017

Hi, i've submitted a new issue with the actual state of HSIconv error handling.
I have not found, for now, more problems in the installation of eta and the initial development of a project using epm in Windows

@rahulmutt
Copy link
Member

Closing then. Any further issues that are found regarding Windows should be filed as separate issues.

@alexbiehl You can give it a try now.

@jstr045329
Copy link

I get a similar error. One line in the error output that caught my attention is:

 Command: etlas install --allow-boot-library-installs

So I ran that command at the prompt and got:

Resolving dependencies...
etlas: Could not resolve dependencies:
trying: base-4.11.1.0:-integer-gmp
trying: base-4.11.1.0:-integer-simple
unknown package: invalid-cabal-flag-settings (dependency of
base-4.11.1.0:-integer-simple)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, eta, rts, base-4.10.0.0:flag,
base-4.10.1.0:flag, base-4.11.0.0:flag, base-4.11.1.0:flag,
invalid-cabal-flag-settings

Which GMP library makes eta happy?

@rahulmutt
Copy link
Member

@jstr045329 Please file a new issue since this issue has already been closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Build System
Windows Support
Development

No branches or pull requests

5 participants