Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal instruction (core dumped) #72

Open
faveoled opened this issue Jan 11, 2025 · 20 comments
Open

Illegal instruction (core dumped) #72

faveoled opened this issue Jan 11, 2025 · 20 comments

Comments

@faveoled
Copy link

$ ./Deecy
Illegal instruction (core dumped)

Can you compile for generic x86_64 Linux?

@Senryoku
Copy link
Owner

Is this the v0.1.0 release? What CPU are you using?

Here are some more builds, maybe one of them will work for you: https://github.com/Senryoku/Deecy/actions/runs/12726647082 (start with the Deecy-x86_64_v4-linux and go backward if it doesn't work)

@faveoled
Copy link
Author

Is this the v0.1.0 release? What CPU are you using?

Yes. AMD A4-3300M

Here are some more builds, maybe one of them will work for you

Thanks, will try tomorrow

@faveoled
Copy link
Author

Flags:                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdts
                          cp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni monitor cx16 popcnt lahf_lm cmp_legacy svm exta
                          pic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt cpb hw_pstate vmmcall arat npt lbrv svm_lock nrip_save pausefilter

@Senryoku
Copy link
Owner

You should be able to run the x86_64_v2 build, if there's no other issue on the rendering side.
I'm curious what frame rate you'll get though!

@faveoled
Copy link
Author

faveoled commented Jan 12, 2025

All fail with exact same error. I've got some more info via gdb:
x86_64-linux

Program received signal SIGILL, Illegal instruction.
getSystemContentScale (xscale=0x22ccde8 <_glfw+137864>, yscale=0x22ccdec <_glfw+137868>)
    at /home/runner/work/Deecy/Deecy/libs/zig-gamedev/libs/zglfw/libs/glfw/src/x11_init.c:997
warning: 997    /home/runner/work/Deecy/Deecy/libs/zig-gamedev/libs/zglfw/libs/glfw/src/x11_init.c: No such file or directory

x86_64_v2-linux, similar for v3, v4 and native

Program received signal SIGILL, Illegal instruction.
0x0000000001f57f8a in compiler_rt.memset.memset (dest=0x259da20 "", c=0 '\000', len=32)
    at /opt/hostedtoolcache/zig/0.14.0-dev.1911/x64/lib/compiler_rt/memset.zig:21
warning: 21     /opt/hostedtoolcache/zig/0.14.0-dev.1911/x64/lib/compiler_rt/memset.zig: No such file or directory

I'm not entirely sure if this GDB output relates to the problem though.

@Senryoku
Copy link
Owner

Yelp, I'm confused. You might have to try to compile it yourself =/

@faveoled
Copy link
Author

I think the version in the repo needs updating

$ ./zigup 0.14.0-dev.1911+3bf89f55c
install directory '/home/admin/zig'
mkdir '/home/admin/zig'
rm -rf '/home/admin/zig/0.14.0-dev.1911+3bf89f55c.installing'
mkdir '/home/admin/zig/0.14.0-dev.1911+3bf89f55c.installing'
downloading 'https://ziglang.org/builds/zig-linux-x86_64-0.14.0-dev.1911+3bf89f55c.tar.xz' to '/home/admin/zig/0.14.0-dev.1911+3bf89f55c.installing/zig-linux-x86_64-0.14.0-dev.1911+3bf89f55c.tar.xz'
error: download 'https://ziglang.org/builds/zig-linux-x86_64-0.14.0-dev.1911+3bf89f55c.tar.xz' failed: HTTP server replied with unsuccessful response '404 Not Found'
rm -rf '/home/admin/zig/0.14.0-dev.1911+3bf89f55c.installing'

@faveoled
Copy link
Author

Doesn't compile with latest:

$ ~/Downloads/zig-linux-x86_64-0.14.0-dev.2634+b36ea592b/zig build run -Doptimize=ReleaseFast
/home/admin/Downloads/Deecy/libs/zig-gamedev/libs/zgui/build.zig:79:16: error: no field or member function named 'defineCMacro' in 'Build.Step.Compile'
            lib.defineCMacro("IMGUI_API", "__declspec(dllexport)");
            ~~~^~~~~~~~~~~~~
/home/admin/Downloads/zig-linux-x86_64-0.14.0-dev.2634+b36ea592b/lib/std/Build/Step/Compile.zig:1:1: note: struct declared here
const builtin = @import("builtin");
^~~~~
/home/admin/Downloads/Deecy/libs/zig-gamedev/libs/zgui/build.zig:79:16: note: method invocation only supports up to one level of implicit pointer dereferencing
/home/admin/Downloads/Deecy/libs/zig-gamedev/libs/zgui/build.zig:79:16: note: use '.*' to dereference pointer
referenced by:
    runBuild__anon_69439: /home/admin/Downloads/zig-linux-x86_64-0.14.0-dev.2634+b36ea592b/lib/std/Build.zig:2388:33
    dependencyInner__anon_59879: /home/admin/Downloads/zig-linux-x86_64-0.14.0-dev.2634+b36ea592b/lib/std/Build.zig:2369:29
    13 reference(s) hidden; use '-freference-trace=15' to see all references
/home/admin/Downloads/Deecy/libs/zig-gamedev/libs/zglfw/build.zig:46:16: error: no field or member function named 'defineCMacro' in 'Build.Step.Compile'
            lib.defineCMacro("_GLFW_BUILD_DLL", null);
            ~~~^~~~~~~~~~~~~
/home/admin/Downloads/zig-linux-x86_64-0.14.0-dev.2634+b36ea592b/lib/std/Build/Step/Compile.zig:1:1: note: struct declared here
const builtin = @import("builtin");
^~~~~
/home/admin/Downloads/Deecy/libs/zig-gamedev/libs/zglfw/build.zig:46:16: note: method invocation only supports up to one level of implicit pointer dereferencing
/home/admin/Downloads/Deecy/libs/zig-gamedev/libs/zglfw/build.zig:46:16: note: use '.*' to dereference pointer

@Senryoku
Copy link
Owner

You can download 0.14.0-dev.1911+3bf89f55c here: https://machengine.org/docs/nominated-zig/

@faveoled
Copy link
Author

faveoled commented Jan 12, 2025

Not sure what's this:

$ ~/Downloads/zig-linux-x86_64-0.14.0-dev.1911+3bf89f55c/zig build run 
run
└─ run Deecy
   └─ install
      └─ install Deecy
         └─ zig build-exe Deecy Debug native 2 errors
error: ld.lld: 
error: ld.lld: /home/admin/Downloads/Deecy/libs/zig-gamedev/libs/system-sdk/linux/lib/x86_64-linux-gnu/libX11.so:1: unknown directive: version
    note: version https://git-lfs.github.com/spec/v1
    note: ^

@Senryoku
Copy link
Owner

I think it means you don't have git-lfs installed

@faveoled
Copy link
Author

Installed it but got the same error

@faveoled
Copy link
Author

faveoled commented Jan 13, 2025

I recloned the sources and got further:

$ ~/Downloads/zig-linux-x86_64-0.14.0-dev.1911+3bf89f55c/zig build run 
run
└─ run Deecy
   └─ install
      └─ install Deecy
         └─ zig build-exe Deecy Debug native failure
error: warning(link): unexpected LLD stderr:
ld.lld: warning: /home/admin/Downloads/Deecy/.zig-cache/o/1b39d181b8135fd21a5a44861ba0d828/libzdawn.a: archive member '/home/admin/.cache/zig/p/12204a3519efd49ea2d7cf63b544492a3a771d37eda320f86380813376801e4cfa73/libdawn.a' is neither ET_REL nor LLVM bitcode


Illegal instruction at address 0x1de9d52
???:?:?: 0x1de9d52 in ??? (???)
???:?:?: 0x1de9d8c in ??? (???)
???:?:?: 0x1de55cd in ??? (???)
???:?:?: 0x1de556b in ??? (???)
???:?:?: 0x1dbfdfb in ??? (???)
libs/zig-gamedev/libs/zgpu/src/dawn.cpp:12:53: 0x1dbfa54 in dniCreate (/home/admin/Downloads/Deecy/libs/zig-gamedev/libs/zgpu/src/dawn.cpp)
    return reinterpret_cast<DawnNativeInstance>(new dawn::native::Instance());
                                                    ^
/home/admin/Downloads/Deecy/libs/zig-gamedev/libs/zgpu/src/zgpu.zig:122:42: 0x1605393 in create (Deecy)
        const native_instance = dniCreate();
                                         ^
/home/admin/Downloads/Deecy/src/deecy.zig:248:52: 0x1624530 in create (Deecy)
        self.gctx = try zgpu.GraphicsContext.create(allocator, .{
                                                   ^
/home/admin/Downloads/Deecy/src/main.zig:162:29: 0x1936a7f in main (Deecy)
    var d = try Deecy.create(allocator);
                            ^
/home/admin/Downloads/zig-linux-x86_64-0.14.0-dev.1911+3bf89f55c/lib/std/start.zig:621:37: 0x19571ee in main (Deecy)
            const result = root.main() catch |err| {
                                    ^
../sysdeps/nptl/libc_start_call_main.h:58:16: 0x7a55e942a1c9 in __libc_start_call_main (../sysdeps/x86/libc-start.c)
../csu/libc-start.c:360:3: 0x7a55e942a28a in __libc_start_main_impl (../sysdeps/x86/libc-start.c)
???:?:?: 0x16019a4 in ??? (???)
???:?:?: 0x0 in ??? (???)
info(deecy): Joysticks initialized in 0ms
run
└─ run Deecy failure
error: the following command terminated unexpectedly:
/home/admin/Downloads/Deecy/zig-out/bin/Deecy 

The app icon appears but then closes

@Senryoku
Copy link
Owner

Thanks for taking the time of compiling it.
I'm afraid the Radeon HD 6480G does not support Vulkan, which is used as the default backend by Dawn on Linux. I'm guessing that what's causing this error, although I'm not 100% sure.

It might be possible to instruct Dawn to use OpenGL instead, but I don't know how, and it probably comes with some caveats too.

@faveoled
Copy link
Author

Vulkan runs via llvmpipe on this computer. I think it's something related to sse instructions, probably some bug in Zig build infrastructure

@Senryoku
Copy link
Owner

I see, so many layers ^^"
You should be able to inspect the instruction causing the crash with gdb?

@faveoled
Copy link
Author

I got this but it doesn't show me any assembly:

Thread 1 "Deecy" received signal SIGILL, Illegal instruction.
0x0000000001de9d52 in dawn::native::TogglesState::TogglesState(dawn::native::ToggleStage) ()
(gdb) backtrace
#0  0x0000000001de9d52 in dawn::native::TogglesState::TogglesState(dawn::native::ToggleStage) ()
#1  0x0000000001de9d8d in dawn::native::TogglesState::CreateFromTogglesDescriptor(dawn::native::DawnTogglesDescriptor const*, dawn::native::ToggleStage) ()
#2  0x0000000001de55ce in dawn::native::InstanceBase::Create(dawn::native::InstanceDescriptor const*) ()
#3  0x0000000001de556c in dawn::native::APICreateInstance(dawn::native::InstanceDescriptor const*) ()
#4  0x0000000001dbfdfc in dawn::native::Instance::Instance(WGPUInstanceDescriptor const*) ()
#5  0x0000000001dbfa55 in dniCreate () at /home/admin/Downloads/Deecy/libs/zig-gamedev/libs/zgpu/src/dawn.cpp:12
#6  0x0000000001605394 in zgpu.GraphicsContext.create (allocator=..., window_provider=..., options=...)
    at /home/admin/Downloads/Deecy/libs/zig-gamedev/libs/zgpu/src/zgpu.zig:122
#7  0x0000000001624531 in deecy.create (allocator=...) at deecy.zig:248
#8  0x0000000001936a80 in main.main () at main.zig:162
#9  0x00000000019571ef in start.callMain () at /home/admin/Downloads/zig-linux-x86_64-0.14.0-dev.1911+3bf89f55c/lib/std/start.zig:621
#10 start.callMainWithArgs () at /home/admin/Downloads/zig-linux-x86_64-0.14.0-dev.1911+3bf89f55c/lib/std/start.zig:581
#11 start.main (c_argc=1, c_argv=0x7fffffffd948, c_envp=0x7fffffffd958)
    at /home/admin/Downloads/zig-linux-x86_64-0.14.0-dev.1911+3bf89f55c/lib/std/start.zig:596

@faveoled
Copy link
Author

I think I've found it:
image

@Senryoku
Copy link
Owner

Mmh... Yeah, that's an AVX instruction. I'm guessing it's from the pre-compiled Dawn libraries and not code generated by zig.
You might have to also compile Dawn yourself... Unless you can find a suitable pre-compiled version. You can change the source of the binary here:

Deecy/build.zig.zon

Lines 17 to 20 in 305ce7e

.dawn_x86_64_linux_gnu = .{
.url = "https://github.com/michal-z/webgpu_dawn-x86_64-linux-gnu/archive/7d70db023bf254546024629cbec5ee6113e12a42.tar.gz",
.hash = "12204a3519efd49ea2d7cf63b544492a3a771d37eda320f86380813376801e4cfa73",
},

@faveoled
Copy link
Author

x86_64-linux

This build fails with:

│  >0x1c4be70 <getSystemContentScale+32>    vmovss -0xb2083c(%rip),%xmm0        # 0x112b63c                                                                     
│   0x1c4be78 <getSystemContentScale+40>    vmovss %xmm0,-0x34(%rbp)                                                                                            
│   0x1c4be7d <getSystemContentScale+45>    vmovss -0xb20849(%rip),%xmm0        # 0x112b63c                                                                     
│   0x1c4be85 <getSystemContentScale+53>    vmovss %xmm0,-0x38(%rbp)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants