On Wednesday, 3 January 2024 at 17:50:19 UTC, Matheus Catarino wrote:
On Saturday, 30 December 2023 at 20:20:50 UTC, ryuukk_ wrote:
I suspect you have a typo in one of your definition

I debugged some existing bindings, and despite any user-level errors (via code) there's some conflict between ABIs.

In fact, it's mentioned by sokol's author below:

I've been seeing weird platform-specific ABI related issues in language bindings where the struct params were corrupted on their way to the other language (for instance in Zig on Intel Macs).

https://github.com/kassane/sokol-d/issues/5#issuecomment-1875665075



I managed to compile your project, ``sgl_context`` is working for me, it renders and roate




I had to remove this from your build script tho:

``try cmds.append(b.fmt("--mcpu={s}", .{lib.target.getCpuModel().name}));``


Otherwise it crashes

```
ryuukk@ark:~/dev/tmp/sokol-d (main)
$ zig build sgl_context && ./zig-out/bin/sgl_context
'x86_64' is not a recognized processor for this target (ignoring processor) 'x86_64' is not a recognized processor for this target (ignoring processor) /home/ryuukk/dev/tmp/sokol-d/src/examples/sgl_context.d(36,20): `display` is thread local /home/ryuukk/dev/tmp/sokol-d/src/examples/sgl_context.d(37,22): `offscreen` is thread local 'x86_64' is not a recognized processor for this target (ignoring processor) 'x86_64' is not a recognized processor for this target (ignoring processor) 'x86_64' is not a recognized processor for this target (ignoring processor) 'x86_64' is not a recognized processor for this target (ignoring processor) LLVM ERROR: 64-bit code requested on a subtarget that doesn't support it! #0 0x00007f8df5c1f503 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM-16.so+0xe1f503) #1 0x00007f8df5c1c7bf llvm::sys::RunSignalHandlers() (/usr/lib/libLLVM-16.so+0xe1c7bf)
 #2 0x00007f8df5c1c90d (/usr/lib/libLLVM-16.so+0xe1c90d)
 #3 0x00007f8df485c710 (/usr/lib/libc.so.6+0x3e710)
 #4 0x00007f8df48ac83c (/usr/lib/libc.so.6+0x8e83c)
 #5 0x00007f8df485c668 gsignal (/usr/lib/libc.so.6+0x3e668)
 #6 0x00007f8df48444b8 abort (/usr/lib/libc.so.6+0x264b8)
 #7 0x00007f8df594d25f (/usr/lib/libLLVM-16.so+0xb4d25f)
 #8 0x00007f8df5b1f19e (/usr/lib/libLLVM-16.so+0xd1f19e)
 #9 0x00007f8df999688c (/usr/lib/libLLVM-16.so+0x4b9688c)
#10 0x00007f8df99970b9 (/usr/lib/libLLVM-16.so+0x4b970b9)
#11 0x00007f8df999eb48 (/usr/lib/libLLVM-16.so+0x4b9eb48)
#12 0x00007f8df999ee95 (/usr/lib/libLLVM-16.so+0x4b9ee95)
#13 0x00007f8df822d39a (/usr/lib/libLLVM-16.so+0x342d39a)
#14 0x00007f8df78e9556 llvm::TargetIRAnalysis::run(llvm::Function const&, llvm::AnalysisManager<llvm::Function>&) (/usr/lib/libLLVM-16.so+0x2ae9556)
#15 0x00007f8df6a42b48 (/usr/lib/libLLVM-16.so+0x1c42b48)
#16 0x00007f8df5dfbe7e llvm::AnalysisManager<llvm::Function>::getResultImpl(llvm::AnalysisKey*, llvm::Function&) (/usr/lib/libLLVM-16.so+0xffbe7e) #17 0x00007f8df75c9af0 llvm::AssumptionAnalysis::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/usr/lib/libLLVM-16.so+0x27c9af0)
#18 0x00007f8df6a839d2 (/usr/lib/libLLVM-16.so+0x1c839d2)
#19 0x00007f8df5dfbe7e llvm::AnalysisManager<llvm::Function>::getResultImpl(llvm::AnalysisKey*, llvm::Function&) (/usr/lib/libLLVM-16.so+0xffbe7e) #20 0x00007f8df75daecb llvm::BasicAA::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/usr/lib/libLLVM-16.so+0x27daecb)
#21 0x00007f8df9b7086f (/usr/lib/libLLVM-16.so+0x4d7086f)
#22 0x00007f8df5dfbe7e llvm::AnalysisManager<llvm::Function>::getResultImpl(llvm::AnalysisKey*, llvm::Function&) (/usr/lib/libLLVM-16.so+0xffbe7e)
#23 0x00007f8df9bd352c (/usr/lib/libLLVM-16.so+0x4dd352c)
#24 0x00007f8df75b760b llvm::AAManager::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/usr/lib/libLLVM-16.so+0x27b760b)
#25 0x00007f8df7957b39 (/usr/lib/libLLVM-16.so+0x2b57b39)
#26 0x00007f8df5dfbe7e llvm::AnalysisManager<llvm::Function>::getResultImpl(llvm::AnalysisKey*, llvm::Function&) (/usr/lib/libLLVM-16.so+0xffbe7e) #27 0x00007f8df71fc56b llvm::AlwaysInlinerPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/lib/libLLVM-16.so+0x23fc56b)
#28 0x00007f8df9b727f6 (/usr/lib/libLLVM-16.so+0x4d727f6)
#29 0x00007f8df5df8466 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/lib/libLLVM-16.so+0xff8466) #30 0x0000558a65baa7a2 runOptimizationPasses(llvm::Module*) (/usr/bin/ldc2+0x9c37a2) #31 0x0000558a65bac10f ldc_optimize_module(llvm::Module*) (/usr/bin/ldc2+0x9c510f) #32 0x0000558a65c92c2d writeModule(llvm::Module*, char const*) (/usr/bin/ldc2+0xaabc2d) #33 0x0000558a65c8d1f8 ldc::CodeGenerator::writeAndFreeLLModule(char const*) (/usr/bin/ldc2+0xaa61f8) #34 0x0000558a65c56512 codegenModules(Array<Module*>&) (/usr/bin/ldc2+0xa6f512) #35 0x0000558a658a6728 mars_mainBody(Param&, Array<char const*>&, Array<char const*>&) (/usr/bin/ldc2+0x6bf728)
#36 0x0000558a65c547c7 cppmain() (/usr/bin/ldc2+0xa6d7c7)
#37 0x0000558a65dffa9d _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv (/usr/bin/ldc2+0xc18a9d)
#38 0x0000558a65dff8b7 _d_run_main2 (/usr/bin/ldc2+0xc188b7)
#39 0x0000558a65dff70e _d_run_main (/usr/bin/ldc2+0xc1870e)
#40 0x0000558a65691be6 main (/usr/bin/ldc2+0x4aabe6)
#41 0x00007f8df4845cd0 (/usr/lib/libc.so.6+0x27cd0)
#42 0x00007f8df4845d8a __libc_start_main (/usr/lib/libc.so.6+0x27d8a)
#43 0x0000558a656946e5 _start (/usr/bin/ldc2+0x4ad6e5)
Error: Error executing /usr/bin/ldc2: Aborted (core dumped)
ldc2: error: the following command exited with error code 1:
/usr/bin/ldmd2 -wi -preview=dip1000 -d-debug --gc -g --O0 -vgc -vtls -verrors=context --vcolumns -od=/home/ryuukk/dev/tmp/sokol-d/zig-cache/o/b2e3e271a78ddb5e4d1fd8939558a0e1 --oq --Hkeep-all-bodies -I/home/ryuukk/dev/tmp/sokol-d/src/sokol -i /home/ryuukk/dev/tmp/sokol-d/src/sokol/app.d /home/ryuukk/dev/tmp/sokol-d/src/sokol/audio.d /home/ryuukk/dev/tmp/sokol-d/src/sokol/gl.d /home/ryuukk/dev/tmp/sokol-d/src/sokol/gfx.d /home/ryuukk/dev/tmp/sokol-d/src/sokol/glue.d /home/ryuukk/dev/tmp/sokol-d/src/sokol/log.d /home/ryuukk/dev/tmp/sokol-d/src/sokol/shape.d /home/ryuukk/dev/tmp/sokol-d/src/sokol/time.d /home/ryuukk/dev/tmp/sokol-d/src/sokol/debugtext.d /home/ryuukk/dev/tmp/sokol-d/src/examples/sgl_context.d -L-L/home/ryuukk/dev/tmp/sokol-d/zig-out/lib -L-lsokol -L-lasound -L-lGL -L-lX11 -L-lXi -L-lXcursor --Xcc=-DIMPL --Xcc=-DSOKOL_GLCORE33 --Xcc=-DSOKOL_DISABLE_WAYLAND -L--no-as-needed --mcpu=x86_64 --of=/home/ryuukk/dev/tmp/sokol-d/zig-out/bin/sgl_context Build Summary: 3/5 steps succeeded; 1 failed (disable with --summary none)
sgl_context transitive failure
└─ ldc2 failure
error: the following build command failed with exit code 1:
/home/ryuukk/dev/tmp/sokol-d/zig-cache/o/3fee843303e331e650973da56e226ce7/build 
/usr/bin/zig /home/ryuukk/dev/tmp/sokol-d 
/home/ryuukk/dev/tmp/sokol-d/zig-cache /home/ryuukk/.cache/zig sgl_context

```



Reply via email to