fogleman / Craft

A simple Minecraft clone written in C using modern OpenGL (shaders).
http://www.michaelfogleman.com/craft/
MIT License
10.39k stars 1.39k forks source link

when run ./craft craft.michaelfogleman.com show "segment fault" #207

Open t2dk49580 opened 5 years ago

t2dk49580 commented 5 years ago

when run ./craft craft.michaelfogleman.com show "segment fault"

how can I do?

SuperFola commented 5 years ago

launch it in GDB :

$ gdb craft
gdb> r craft.michaelfogleman.com
... wait for segfault
gdb> bt

bt will display the backtrace and you'll be able to locate the problem to try to fix it

t2dk49580 commented 5 years ago

[Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7fffe7d78700 (LWP 3010)] [New Thread 0x7fffe7577700 (LWP 3011)] [New Thread 0x7fffe6d76700 (LWP 3012)] [New Thread 0x7fffe6575700 (LWP 3013)]

Thread 1 "craft" received signal SIGSEGV, Segmentation fault. __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31 31 ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S no such file or directory

t2dk49580 commented 5 years ago

(gdb) bt

0 __strcmp_sse2_unaligned ()

at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31

1 0x000055555567e592 in openJoystickDevice ()

2 0x000055555567ec27 in _glfwInitJoysticks ()

3 0x0000555555679385 in _glfwPlatformInit ()

4 0x0000555555674419 in glfwInit ()

5 0x0000555555592dfb in main ()

SuperFola commented 5 years ago

Uh, fine, have you a joystick connected ? I might as well advise you to recompile the whole project with the -g option, to have a more complete backtrace ;)

t2dk49580 commented 5 years ago

I have no joystick ok, I can try to recompile with -g option

t2dk49580 commented 5 years ago

(gdb) bt

0 __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:203

1 0x000055555567e622 in openJoystickDevice (path=path@entry=0x7fffffffd740 "/dev/input/js0")

at /home/sai/code/git/Craft/deps/glfw/src/linux_joystick.c:60

2 0x000055555567ecb7 in _glfwInitJoysticks () at /home/sai/code/git/Craft/deps/glfw/src/linux_joystick.c:240

3 0x0000555555679415 in _glfwPlatformInit () at /home/sai/code/git/Craft/deps/glfw/src/x11_init.c:766

4 0x00005555556744b9 in glfwInit () at /home/sai/code/git/Craft/deps/glfw/src/init.c:125

5 0x0000555555592dfb in main (argc=2, argv=0x7fffffffdf68) at /home/sai/code/git/Craft/src/main.c:2593

t2dk49580 commented 5 years ago

os: virtualbox ubuntu18.04 /dev/input/js0 is exist cat /dev/input/js0 have some binary data

SuperFola commented 5 years ago

Hum, i don't know, that's super strange ! GLFW can't initialize its joystick but it's there O_o

t2dk49580 commented 5 years ago

what next I can do....

mpaoloni commented 5 years ago

@t2dk49580 /deps/glfw should probably be updated to 3.2.1 and fixes from fogleman/Craft#201 applied.

I cloned the repo this morning, updated GLFW and SQLite and applied some fixes: https://github.com/mpaoloni/Craft

Try it and see if it works for you.

You can see the changes in the commits section.

t2dk49580 commented 5 years ago

I cloned your repo, it works, but main direction was wrrong, left and right always goto top and bottom...

mpaoloni commented 5 years ago

Not sure what you mean exactly. Works for me. I'm on Ubuntu 18.04.1 LTS, kernel 4.15.

Do you have your IME actived? Or maybe another HID device besides keyboard and mouse?

I updated GLFW to upstream branch, which is close to the next release 3.3. You can find the new repo here: https://github.com/mpaoloni/Craft-glfw-pre3.3

Try it and tell me if it changes anything.

t2dk49580 commented 5 years ago

It works! thanks!

mpaoloni commented 5 years ago

Glad I could help. Once GLFW 3.3 is out I'll update the other repo and delete https://github.com/mpaoloni/Craft-glfw-pre3.3.