Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Segmentation fault when creating sf::Context and debugging with GDB  (Read 3119 times)

0 Members and 1 Guest are viewing this topic.

sftd

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hi,

I wanted to try SFML and have the following problem:

When debugging SFML project with GDB on Linux (Ubuntu 14.04) I get the following error:
Program received signal SIGSEGV, Segmentation fault.
do_lookup_x (new_hash=new_hash@entry=226653476, old_hash=old_hash@entry=0x7fffffffd550,
    result=result@entry=0x7fffffffd560, scope=<optimized out>, i=1, i@entry=0, flags=flags@entry=1,
    skip=skip@entry=0x0, undef_map=undef_map@entry=0x7ffff7fd31a0) at dl-lookup.c:98
98      dl-lookup.c: No such file or directory.

Edit:
Is it possible that I am linking some SFML dependencies wrong (not in debug version?).
This error is thrown when creating sf::Context (or sf::Window). When running program without GDB everything is fine.

I am 99.9% percent sure that I have linked correct (debug) libraries.

Is anyone able to help me?

Sorry to bother you.

Error stack:
Thread [1] 23817 [core: 1] (Suspended : Signal : SIGSEGV:Segmentation fault)   
        do_lookup_x() at dl-lookup.c:98 0x7ffff7de3f7e 
        _dl_lookup_symbol_x() at dl-lookup.c:737 0x7ffff7de4991
        _dl_fixup() at dl-runtime.c:111 0x7ffff7de9557 
        _dl_runtime_resolve() at dl-trampoline.S:45 0x7ffff7df0515     
        XauGetBestAuthByAddr() at 0x7ffff2ce9347       
        0x7ffff31031b4 
        0x7ffff31033bd 
        xcb_connect_to_display_with_auth_info() at 0x7ffff3102fe4      
        _XConnectXCB() at 0x7ffff6aad32a       
        XOpenDisplay() at 0x7ffff6a9e88f       
        sf::priv::OpenDisplay() at 0x7ffff7bcffeb      
        sf::priv::GlxContext::GlxContext() at 0x7ffff7bd0bb4   
        sf::priv::GlContext::globalInit() at 0x7ffff7bcab9d    
        sf::GlResource::GlResource() at 0x7ffff7bcb483 
        sf::Window::Window() at 0x7ffff7bce3d1 
        Test::_initialize() at test.cpp:29 0x4028b3    
        Env::Program::initialize() at program.cpp:19 0x402732  
        Env::App::Initialize() at app.cpp:20 0x40261e  
        main() at OpenGL Tests.cpp:11 0x402193 
 

Edit:
Is it possible that I'm linking some SFML dependencies wrong (not in debug version)?

Edit1:
I have taken source from here http://sfml-dev.org/download/sfml/2.1/ and compiled it using this instructions http://sfml-dev.org/tutorials/2.0/compile-with-cmake.php (CMAKE_BUILD_TYPE="Debug").

Minimal code example:

#include <SFML/Window.hpp>

int main()
{
    sf::Window window;

    return 0;
}

I am using Ubuntu 14.04 on MSI GE70 with NVidia GeForce GTX 765M using nvidia-graphics-drivers-331.
« Last Edit: September 15, 2014, 04:37:09 pm by sftd »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Segmentation fault when creating sf::Context and debugging with GDB
« Reply #1 on: September 15, 2014, 04:25:27 pm »
What graphics driver have you installed? Where did you get SFML from?
You should provide a minimal and complete code example which causes the issue.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

sftd

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Segmentation fault when creating sf::Context and debugging with GDB
« Reply #2 on: September 15, 2014, 04:34:30 pm »
I have taken source from here http://sfml-dev.org/download/sfml/2.1/ and compiled it using this instructions http://sfml-dev.org/tutorials/2.0/compile-with-cmake.php (CMAKE_BUILD_TYPE="Debug").

Minimal code example:

#include <SFML/Window.hpp>

int main()
{
    sf::Window window;

    return 0;
}

I am using Ubuntu 14.04 on MSI GE70 with NVidia GeForce GTX 765M using nvidia-graphics-drivers-331.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Segmentation fault when creating sf::Context and debugging with GDB
« Reply #3 on: September 15, 2014, 04:45:24 pm »
Could you try to build the master branch from GitHub?

Do you also build your test code in debug mode?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

sftd

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Segmentation fault when creating sf::Context and debugging with GDB
« Reply #4 on: September 15, 2014, 05:02:39 pm »
Could you try to build the master branch from GitHub?
Same thing when compiled from master on GitHub.

Do you also build your test code in debug mode?
Yes. I have setup a minimalistic CMake Project for that.


If this error isn't anything obvious I will try to check if I haven't done anything stupid and come back to you. For now Thank You for your help. I will post reason for this error if I will be lucky enough to figure it out.


EDIT:
Fault was totally on my side. It is very embarrassing by there was segmentation error in my "minimalist setup"... Once again sorry for bothering you with irrelevant problem.
« Last Edit: September 16, 2014, 09:15:09 am by sftd »