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

Segmentation fault when running on MacOS 12.2.1 (Apple Silicon) #5

Open
munsie opened this issue Mar 2, 2022 · 2 comments
Open

Segmentation fault when running on MacOS 12.2.1 (Apple Silicon) #5

munsie opened this issue Mar 2, 2022 · 2 comments

Comments

@munsie
Copy link

munsie commented Mar 2, 2022

Running MetalNes from the command line on MacOS 12.2.1 on Apple Silicon (M1 Max) causes a segmentation fault:

$ ./build/MetalNes
Segmentation fault: 11

Running it under lldb shows it crashing here:

Process 433 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x00000001000e2b40 MetalNes`ImGuiSupport_Init(context=nullptr, assetDir="./", userDir=<unavailable>) at imgui_support.cpp:429:29 [opt]
   426 	    //IM_ASSERT(font != NULL);
   427
   428
-> 429 	    auto _shader = context->LoadShaderFromFile("data/shaders/imgui.fx");
   430 	    _renderer = new ImGuiRendererContext(context, _shader);
   431 	    ImGuiRenderInit( _renderer );
   432
Target 0: (MetalNes) stopped.
(lldb) p context
(render::ContextPtr) $0 = nullptr {
  __ptr_ = nullptr
}

@m0rb
Copy link

m0rb commented Mar 2, 2022

Similar SEGV on Fedora 35 x86_64

Thread 1 "MetalNes" received signal SIGSEGV, Segmentation fault.
0x000000000056ee4f in ImGuiSupport_Init (context=std::shared_ptr<render::Context> (empty) = {...}, assetDir="./", userDir=".metalnes/") at /home/morb/build/metalnes/source/imgui_support.cpp:429
429         auto _shader = context->LoadShaderFromFile("data/shaders/imgui.fx");

@munsie
Copy link
Author

munsie commented Mar 2, 2022

While doing some more digging on the MacOS side here, I found that there was a Xcode project file created at some point (probably when running CMake, but not 100% sure on that). Running from Xcode allow the project to build successfully and not segmentation fault when running.

Also I noticed that the CMakeLists.txt file has the Linux main.cpp file being used on MacOS instead of the main.mm. That probably explains why the segmentation fault happens on both Linux and MacOS when running the command line version. I'm going to leave this issue open since it appears there is still a problem on Linux.

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