Open ityonemo opened 3 years ago
How do I go about doing this? Any pointers or sample code would be appreciated
hi! This blocks on https://github.com/ityonemo/zigler/issues/17
make sure that zigler works on windows by cloning the repo and switching to 0.7.0 branch, then run mix test. There will probably be a whole bunch of errors that if you would like to report that would be amazing.
the code for testing libraries is in test/integration/strategies/library_test.exs
probably would be best to copy/paste into library_test_windows.exs ; the end goal is to just adjust the paths to the libraries and have it work as-is.
obtaining blas for windows: https://mingwpy.github.io/blas_lapack.html
Sorry, didn't get time for this until now. So I did this:
make sure that zigler works on windows by cloning the repo and switching to 0.7.0 branch, then run mix test. There will probably be a whole bunch of errors that if you would like to report that would be amazing.
and am just getting:
(RuntimeError) non-unix systems not currently supported.
Stacktrace:
│ expanding macro: Zigler.__using__/1
│ test/support/zigtest/transitive.ex:5: ZiglerTest.ZigTest.Transitive (module)
│ (elixir 1.11.1) expanding macro: Kernel.use/1
│ test/support/zigtest/transitive.ex:5: ZiglerTest.ZigTest.Transitive (module)
Which is to be expected. Plus deprecation and other warnings in the deps due to the elixir version (1.11) I'm using I assume.
So far so good.
After removing the check, I noticed you'd updated byrenaming some files. I decided to proceed a bit more before syncing:
== Compilation error in file test/support/zigtest/documentation.ex ==
** (RuntimeError) it seems like you are compiling from an unsupported architecture:
win32
So added "win32" => "i386"
to the @arches
, and it seems good.
Potential problems I noticed:
:win64
in :os.type()
unzip
is not a windows built-in, superuser has a few alternatives like tar
and powershell. I think tar
is good enough for recent versions of windows 10 (since Dec 21, 2017)zig.exe
I'll update, and maybe send a pull request.
Had some issues with the download timing out, so I just decided to download manually. After extracting, here's the errors I get when I run mix test
:
13:10:08.105 [debug] compiling nif for module ZiglerTest.ZigTest.FailingTest in path C:\Users\XXX\AppData\Local\Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.FailingTest
13:10:08.107 [debug] compiling nif for module ZiglerTest.ZigTest.PassingTests in path C:\Users\XXX\AppData\Local\Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.PassingTests
13:10:08.115 [debug] wrote build.zig to C:\Users\XXX\AppData\Local\Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.FailingTest/build.zig
13:10:08.118 [debug] wrote build.zig to C:\Users\XXX\AppData\Local\Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.PassingTests/build.zig
13:10:11.409 [debug] copied c:/Users/XXX/Documents/GitHub/elixir/zigler/test/support/zigtest/imported.zig to c:/Users/XXX/AppData/Local/Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.Transitive/imported.zig
13:10:11.414 [debug] copied c:/Users/XXX/Documents/GitHub/elixir/zigler/test/support/zigtest/namespaced.zig to c:/Users/XXX/AppData/Local/Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.Transitive/namespaced.zig
13:10:11.417 [debug] copied c:/Users/XXX/Documents/GitHub/elixir/zigler/test/support/zigtest/nonpublic.zig to c:/Users/XXX/AppData/Local/Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.Transitive/nonpublic.zig
13:10:11.417 [debug] compiling nif for module ZiglerTest.ZigTest.Transitive in path C:\Users\XXX\AppData\Local\Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.Transitive
13:10:11.430 [debug] wrote build.zig to C:\Users\XXX\AppData\Local\Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.Transitive/build.zig
== Compilation error in file test/support/zigtest/passing_tests.ex ==
** (CompileError) this zig compiler warning hasn't been incorporated into the parser.
Please file a report at:
https://github.com/ityonemo/zigler/issues
lib/zig/parser/error.ex:54: Zig.Parser.Error.parse/2
lib/zig/command.ex:35: Zig.Command.compile/2
lib/zig/compiler.ex:101: Zig.Compiler.compilation/2
expanding macro: Zig.Compiler.__before_compile__/1
test/support/zigtest/passing_tests.ex:1: ZiglerTest.ZigTest.PassingTests (module)
Not sure what the issue is here, I don't see any zig warnings in the console?
Okay figured it out. It's the old windows \path issue. Sorry, I'm still a bit new to all this tech.
I just ran a single test: mix test .\test\support\zigtest\failing_test.ex
and got this error:
== Compilation error in file test/support/zigtest/failing_test.ex ==
** (CompileError) c:/Users/XXX/AppData/Local/Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.FailingTest/build.zig:55834574860: invalid character: 'U'
"C:\Users\XXX\AppData\Local\Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.FailingTest/Elixir.ZiglerTest.ZigTest.FailingTest.zig",
^
[..]
test/support/zigtest/failing_test.ex:1: ZiglerTest.ZigTest.FailingTest (module)
I think this may also be causing the wrong paths to be displayed in the other tests?
Exploring a bit, this is what the relevant build.zig file show:
const lib = b.addSharedLibrary(
"Elixir.ZiglerTest.ZigTest.FailingTest",
"C:\Users\XXX\AppData\Local\Temp/.zigler_compiler/test/Elixir.ZiglerTest.ZigTest.FailingTest/Elixir.ZiglerTest.ZigTest.FailingTest.zig",
I'm inferring it corresponds to lib/zig/builder.ex:
const lib = b.addSharedLibrary(
"<%= @module_spec.module %>",
"<%= @code_file %>",
@code_file
is in compiler.ex:
code_file = Path.join(assembly_dir, "#{module.module}.zig")
assembly_dir
:
def assembly_dir(env, module) do
Path.join(System.tmp_dir!(), ".zigler_compiler/#{env}/#{module}")
end
So just need to escape assembly_dir
or replace with forward slashes?
Okay, I'm getting a completely different error, so I'm just going to finish for now and opened #221:
LLVM ERROR: Bad $ operand number in inline asm string: ' movl %fs:0x18, $3140686348344623104'
sorry I haven't gotten around to checking this out till now (I had a guest over for a bit, which is a rare thing in the pandemic). THANK YOU for all of your work getting this up to speed. How about we accept the PR of what you have for now, getting it to the point where you're compiling so I can review it and get you on the contributors list, and maybe I can get my hands on a windows VM and just do a dry run to try and start figuring out this asm error.
@seomwan I bumped the 0.7.0 branch to zig 0.7.1, can you check to see if that trivially fixes the windows issue? I'll do a deeper dive later if it's still broken.
Just tested with 0.7.1 i386. Bug is still there. I'll write more details in the issue.
if someone could test loading a dll and calling it in windows, that would be greatly appreciated. I have no way of testing this currently.