andrewrk / zig-window

window client library
117 stars 13 forks source link

segfault on Adélie Linux #6

Closed maxcrees closed 3 years ago

maxcrees commented 3 years ago

The static-window4 binary you shared on the musl IRC channel results in this on Adélie:

% ./static-window4
debug: detecting whether we are running in the dynamic linker
debug: we're not. detecting the dynamic linker path
debug: prepare to execve reload
debug: dyld_path=/lib/ld-musl-x86_64.so.1
debug: detecting whether we are running in the dynamic linker
debug: got dlopen. init vulkan
Segmentation fault at address 0x0
???:?:?: 0x7f13c869b6a7 in ??? (???)
???:?:?: 0x7f13c7f56771 in ??? (???)
???:?:?: 0x7f13c7f533b8 in ??? (???)
???:?:?: 0x7f13c7e52887 in ??? (???)
src/vulkan-loader/loader.c:6564:22: 0x2b01cb in terminator_CreateInstance (/home/andy/dev/zig-window/src/vulkan-loader/loader.c)
???:?:?: 0x2aef4f in ??? (???)
???:?:?: 0x2d9344 in ??? (???)
???:?:?: 0x26477b in ??? (???)
???:?:?: 0x25b909 in ??? (???)
???:?:?: 0x235de8 in ??? (???)
???:?:?: 0x235b71 in ??? (???)
zsh: abort      ./static-window4

This is on musl 1.2.0 and under Xorg

andrewrk commented 3 years ago

Thanks for the report! So far we have no musl-based distros reporting success. I hope to figure out why today

andrewrk commented 3 years ago

more complete back trace on musl-based voidlinux:

(gdb) bt
#0  0x00007ffff7fb2a52 in strlen (s=s@entry=0x0) at src/string/strlen.c:17
#1  0x00007ffff7fb2ce2 in strrchr (s=0x0, c=47) at src/string/strrchr.c:5
#2  0x00007ffff78c70b2 in ?? () from /usr/lib/libvulkan_intel.so
#3  0x00007ffff78c3151 in ?? () from /usr/lib/libvulkan_intel.so
#4  0x00007ffff765b641 in ?? () from /usr/lib/libvulkan_intel.so
#5  0x00000000002b35bc in terminator_CreateInstance (pCreateInfo=<optimized out>, pAllocator=0x0, 
    pInstance=<optimized out>) at src/vulkan-loader/loader.c:6564
#6  0x00007ffff037c0d1 in ?? () from /lib/libVkLayer_MESA_device_select.so
#7  0x00000000002b2340 in loader_create_instance_chain (pCreateInfo=<optimized out>, 
    pCreateInfo@entry=0x7fffffffdcb0, pAllocator=pAllocator@entry=0x0, inst=inst@entry=0x7ffff7fff020, 
    created_instance=created_instance@entry=0x7fffffffdd00) at src/vulkan-loader/loader.c:6071
#8  0x00000000002dc755 in vkCreateInstance (pCreateInfo=<optimized out>, pAllocator=<optimized out>, 
    pInstance=0x3052f0 <instance>) at src/vulkan-loader/trampoline.c:516
#9  0x000000000026678c in createInstance (allocator=0x304ee0 <general_purpose_allocator>)
    at static-window.zig:690
#10 0x000000000025d47f in main () at static-window.zig:91
(gdb) up
#1  0x00007ffff7fb2ce2 in strrchr (s=0x0, c=47) at src/string/strrchr.c:5
warning: Source file is more recent than executable.
5       return __memrchr(s, c, strlen(s) + 1);
(gdb) 
#2  0x00007ffff78c70b2 in ?? () from /usr/lib/libvulkan_intel.so
(gdb) 
#3  0x00007ffff78c3151 in ?? () from /usr/lib/libvulkan_intel.so
(gdb) 
#4  0x00007ffff765b641 in ?? () from /usr/lib/libvulkan_intel.so
(gdb) 
#5  0x00000000002b35bc in terminator_CreateInstance (pCreateInfo=<optimized out>, pAllocator=0x0, 
    pInstance=<optimized out>) at src/vulkan-loader/loader.c:6564
6564            icd_result = ptr_instance->icd_tramp_list.scanned_list[i].CreateInstance(&icd_create_info, pAllocator, &(icd_term->instance));
(gdb) 
#6  0x00007ffff037c0d1 in ?? () from /lib/libVkLayer_MESA_device_select.so
(gdb) 
#7  0x00000000002b2340 in loader_create_instance_chain (pCreateInfo=<optimized out>, 
    pCreateInfo@entry=0x7fffffffdcb0, pAllocator=pAllocator@entry=0x0, inst=inst@entry=0x7ffff7fff020, 
    created_instance=created_instance@entry=0x7fffffffdd00) at src/vulkan-loader/loader.c:6071
6071            res = fpCreateInstance(&loader_create_info, pAllocator, created_instance);
(gdb) 
#8  0x00000000002dc755 in vkCreateInstance (pCreateInfo=<optimized out>, pAllocator=<optimized out>, 
    pInstance=0x3052f0 <instance>) at src/vulkan-loader/trampoline.c:516
516     res = loader_create_instance_chain(&ici, pAllocator, ptr_instance, &created_instance);
(gdb) 
#9  0x000000000026678c in createInstance (allocator=0x304ee0 <general_purpose_allocator>)
    at static-window.zig:690
690     try checkSuccess(c.vkCreateInstance(&createInfo, null, &instance));
(gdb) 
#10 0x000000000025d47f in main () at static-window.zig:91
91      try createInstance(gpa);
(gdb) 
andrewrk commented 3 years ago

Fixed in af86d4bc507b893b4fc2a2f9cc2b07b51314c815

Here's a binary you can try https://andrewkelley.me/temp/static-window8

maxcrees commented 3 years ago

The new binary is working - I think. It shows a static image of a rainbow triangle but uses seemingly a lot of CPU (for my fan to spin up). Is there supposed to be animation?

57462ba9-75a4-4984-bd62-b26edab367f2