JoshuaBrookover / bigg

bgfx, imgui, glfw, glm
The Unlicense
224 stars 35 forks source link

Segmentation Fault with Ubuntu 18.04.1 #6

Closed whabilly closed 5 years ago

whabilly commented 5 years ago

I built the project under Ubuntu 18.04.1 and both the ‘cubes’ and ‘imgui_demo’ produce a Segmentation Fault. I have however no problem building and running the bgfx examples embedded in the bgfx folder. Note that I also successfully built the bigg project and ran the demos on macOS without any issue.

I have been able to narrow down the issues to the call to bgfx::createTexture2D in imguiInit (“Create Font” section), and the ‘Valgrind’ tool indicates an issue with bx::alloc which is quite weird:

==5527== Invalid read of size 8 ==5527== at 0x179457: bx::alloc(bx::AllocatorI, unsigned long, unsigned long, char const, unsigned int) (in /home/whab/Documents/bigg/build/examples/cubes/cubes) ==5527== by 0x1714F8: bgfx::alloc(unsigned int) (in /home/whab/Documents/bigg/build/examples/cubes/cubes) ==5527== by 0x171535: bgfx::copy(void const*, unsigned int) (in /home/whab/Documents/bigg/build/examples/cubes/cubes) ==5527== by 0x167F6E: imguiInit() (in /home/whab/Documents/bigg/build/examples/cubes/cubes) ==5527== by 0x169340: bigg::Application::run(int, char*, bgfx::RendererType::Enum, unsigned short, unsigned short, bgfx::CallbackI, bx::AllocatorI*) (in /home/whab/Documents/bigg/build/examples/cubes/cubes) ==5527== by 0x1652ED: main (in /home/whab/Documents/bigg/build/examples/cubes/cubes) ==5527== Address 0x0 is not stack'd, malloc'd or (recently) free'd

Any idea?

JoshuaBrookover commented 5 years ago

I don't have a linux machine to test with, so I've never built for linux. I know that bgfx is not initialized correctly on linux because we don't actually pass it a window handle. You might need to take the bigg.cpp changes from here:

https://github.com/acpopescu/bigg/commit/795b732ccd33bfbdaf5787cf087b51b61c754ed1

If someone could verify these changes and submit a PR it would be greatly appreciated.