chung-leong / zigar

Enable the use of Zig code in JavaScript project
https://chung-leong.github.io/zigar/
MIT License
182 stars 3 forks source link

C functions not working on 64-bit Windows #410

Closed chung-leong closed 4 months ago

chung-leong commented 4 months ago
  2) Integration tests (node-zigar, Debug)
       Function calling
         should call C functions:
     Error: Zig compilation failed

install
+- WriteFile
   +- zig build-lib call-c-functions Debug x86_64-windows 1 errors
C:\Users\CHUNGL~1\AppData\Local\Temp\zigar-build\call-c-functions-674913cd\.zig-cache\o\0a2ce8f8def7b69003973f66bf270a2f\cimport.zig:1882:35: error: comptime call of extern function
error: the following command failed with 1 compilation errors:
C:\Users\Chung Leong\.zvm\0.13.0\zig.exe build-lib -ODebug -target x86_64-windows -mcpu baseline --dep module -Mroot=C:\Users\Chung Leong\zigar\zigar-compiler\zig\stub-c.zig -I C:\Users\Chung Leong\zigar\zigar-compiler\test\integration\function-calling -Mmodule=C:\Users\Chung Leong\zigar\zigar-compiler\test\integration\function-calling\call-c-functions.zig -lc --cache-dir C:\Users\CHUNGL~1\AppData\Local\Temp\zigar-build\call-c-functions-674913cd\.zig-cache --global-cache-dir C:\Users\Chung Leong\AppData\Local\zig --name call-c-functions -dynamic --listen=-
Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
+- WriteFile transitive failure
   +- zig build-lib call-c-functions Debug x86_64-windows 1 errors
   +- zig build-lib call-c-functions Debug x86_64-windows (reused)
error: the following build command failed with exit code 1:
C:\Users\CHUNGL~1\AppData\Local\Temp\zigar-build\call-c-functions-674913cd\.zig-cache\o\553b3bfbe31a892db45ec7a7057abd85\build.exe C:\Users\Chung Leong\.zvm\0.13.0\zig.exe C:\Users\CHUNGL~1\AppData\Local\Temp\zigar-build\call-c-functions-674913cd C:\Users\CHUNGL~1\AppData\Local\Temp\zigar-build\call-c-functions-674913cd\.zig-cache C:\Users\Chung Leong\AppData\Local\zig --seed 0x3dc29207 -Zfd818492e1ed0def -Doptimize=Debug -Dtarget=x86_64-windows

      at runCompiler (file:///C:/Users/Chung%20Leong/zigar/zigar-compiler/dist/index.js:5504:11)
      at async compile (file:///C:/Users/Chung%20Leong/zigar/zigar-compiler/dist/index.js:5465:7)
      at async load (file:///C:/Users/Chung%20Leong/zigar/node-zigar/dist/index.js:71:26)
      at async nextLoad (node:internal/modules/esm/hooks:750:22)
      at async Hooks.load (node:internal/modules/esm/hooks:383:20)
      at async MessagePort.handleMessage (node:internal/modules/esm/worker:199:18)

  3) Integration tests (node-zigar, Debug)
       Function calling
         should correctly pass unsigned int to variadic function:
     Error: Zig compilation failed

install
+- WriteFile
   +- zig build-lib call-variadic-functions-with-unsigned-int Debug x86_64-windows 1 errors
C:\Users\Chung Leong\.zvm\0.13.0\lib\std\builtin.zig:624:21: error: disabled due to miscompilations
error: the following command failed with 1 compilation errors:
C:\Users\Chung Leong\.zvm\0.13.0\zig.exe build-lib -ODebug -target x86_64-windows -mcpu baseline --dep module -Mroot=C:\Users\Chung Leong\zigar\zigar-compiler\zig\stub-c.zig -I C:\Users\Chung Leong\zigar\zigar-compiler\test\integration\function-calling -Mmodule=C:\Users\Chung Leong\zigar\zigar-compiler\test\integration\function-calling\call-variadic-functions-with-unsigned-int.zig -lc --cache-dir C:\Users\CHUNGL~1\AppData\Local\Temp\zigar-build\call-variadic-fu-c3f42379\.zig-cache --global-cache-dir C:\Users\Chung Leong\AppData\Local\zig --name call-variadic-functions-with-unsigned-int -dynamic --listen=-
Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
+- WriteFile transitive failure
   +- zig build-lib call-variadic-functions-with-unsigned-int Debug x86_64-windows 1 errors
   +- zig build-lib call-variadic-functions-with-unsigned-int Debug x86_64-windows (reused)
error: the following build command failed with exit code 1:
C:\Users\CHUNGL~1\AppData\Local\Temp\zigar-build\call-variadic-fu-c3f42379\.zig-cache\o\56c2dfe192c434714ce41f4880b00613\build.exe C:\Users\Chung Leong\.zvm\0.13.0\zig.exe C:\Users\CHUNGL~1\AppData\Local\Temp\zigar-build\call-variadic-fu-c3f42379 C:\Users\CHUNGL~1\AppData\Local\Temp\zigar-build\call-variadic-fu-c3f42379\.zig-cache C:\Users\Chung Leong\AppData\Local\zig --seed 0xaaafbb87 -Z4bcf2ae35b490ec3 -Doptimize=Debug -Dtarget=x86_64-windows

      at runCompiler (file:///C:/Users/Chung%20Leong/zigar/zigar-compiler/dist/index.js:5504:11)
      at async compile (file:///C:/Users/Chung%20Leong/zigar/zigar-compiler/dist/index.js:5465:7)
      at async load (file:///C:/Users/Chung%20Leong/zigar/node-zigar/dist/index.js:71:26)
      at async nextLoad (node:internal/modules/esm/hooks:750:22)
      at async Hooks.load (node:internal/modules/esm/hooks:383:20)
      at async handleMessage (node:internal/modules/esm/worker:199:18)

  4) Integration tests (node-zigar, Debug)
       Function calling
         should call printf correctly:

      AssertionError: expected [ Array(1) ] to deeply equal [ Array(1) ]
      + expected - actual

       [
      -  "Hello world, 0.00 0.00 0.00 5.67 0.00!!"
      +  "Hello world, 1.23 2.34 3.45 4.56 5.67!!"
       ]

      at Context.<anonymous> (file:///C:/Users/Chung%20Leong/zigar/zigar-compiler/test/integration/function-calling/tests.js:736:25)