andrewrk / zig-window

window client library
117 stars 13 forks source link

Upgrade to Zig 0.9.0 #13

Open hazeycode opened 2 years ago

hazeycode commented 2 years ago

Upgrade code to Zig 0.9.0. I didn't know how to define some things that broke in vulkan.zig, see comments beginning "NOTE(hazeycode):"

This will build an exe but it seg faults for me on Manjaro, x86 with AMD drivers

(lldb) run
Process 489434 launched: '/home/chris/Desktop/zig-window/zig-out/bin/static-window' (x86_64)
Process 489434 stopped
* thread #1, name = 'static-window', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
    frame #0: 0x0000000000000000
error: memory read failed for 0x0

presumably because I've got a completely garbage executable

❯ ld.lld ./zig-out/bin/static-window
ld.lld: error: ./zig-out/bin/static-window: unknown file type
❯ readelf -l ./zig-out/bin/static-window

Elf file type is EXEC (Executable file)
Entry point 0x22aaa0
There are 9 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000200040 0x0000000000200040
                 0x00000000000001f8 0x00000000000001f8  R      0x8
  LOAD           0x0000000000000000 0x0000000000200000 0x0000000000200000
                 0x0000000000027e4c 0x0000000000027e4c  R      0x1000
  LOAD           0x0000000000027e50 0x0000000000228e50 0x0000000000228e50
                 0x00000000000b8110 0x00000000000b8110  R E    0x1000
  LOAD           0x00000000000dff60 0x00000000002e1f60 0x00000000002e1f60
                 0x0000000000024420 0x0000000000024420  RW     0x1000
  LOAD           0x0000000000104380 0x0000000000307380 0x0000000000307380
                 0x0000000000000240 0x0000000000003f98  RW     0x1000
  TLS            0x00000000000dff60 0x00000000002e0f60 0x00000000002e0f60
                 0x0000000000000000 0x0000000000000020  R      0x8
  DYNAMIC        0x00000000001041f8 0x00000000003061f8 0x00000000003061f8
                 0x0000000000000150 0x0000000000000150  RW     0x8
  GNU_RELRO      0x00000000000dff60 0x00000000002e1f60 0x00000000002e1f60
                 0x0000000000024420 0x00000000000250a0  R      0x1
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000001000000  RW     0x0

Looks like the patchelf --remove-needed didn't work. Not exactly sure where to go from here but dropping this here in case it's useful for anyone else - maybe your mileage will vary!

p.s I can run vkcube

hazeycode commented 2 years ago

I guess I need to update some stuff inline with linker changes? Any pointers in the right direction there would be really useful for me to figure out what needs to be done