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

Author Topic: SFML with Steam SDK crash on linux.  (Read 2237 times)

0 Members and 1 Guest are viewing this topic.

Edimartin

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
SFML with Steam SDK crash on linux.
« on: March 06, 2022, 11:33:25 pm »
Hi. I am developing my first game for steam. It's a 2D game with SFML and OpenGL in Linux.

I am developing in Linux Mint with XFCE:

OS: Linuxmint 20.3 una
Kernel: x86_64 Linux 5.4.0-100-generic
Uptime: 52m
Packages: 3127
Shell: bash
Resolution: 3286x1080
DE: Xfce
WM: Xfwm4
WM Theme: Mint-Y
GTK Theme: Mint-Y [GTK2]
Icon Theme: Mint-Y
Font: Ubuntu 10
Disk: 383G / 598G (68%)
CPU: Intel Core i5-3330 @ 4x 3.2GHz [51.0°C]
GPU: NVE4
RAM: 3675MiB / 15971MiB
 

I have one C++ project using the QTcreator IDE. I compile SFML for my linux and I am using the lates version 2.5.1.
I download the steam SDK from this link https://partner.steamgames.com/downloads/steamworks_sdk.zip and I attach the library in my QTcreator project.

The problem is when I add the steam lib it crash. In debug it crash when I declare the sf::RenderWindow window;

I create another project with just an SFML example:

#include <SFML/Graphics.hpp>

int main()
{
    // create the window
    sf::RenderWindow window(sf::VideoMode(800, 600), "My window");

    // run the program as long as the window is open
    while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }

        // clear the window with black color
        window.clear(sf::Color::Black);

        // draw everything here...
        // window.draw(...);

        // end the current frame
        window.display();
    }

    return 0;
}
 

And I attach the SFML and Steam SDK in my project using this command in project.pro:

LIBS += -lsfml-system -lsfml-window -lsfml-graphics

LIBS += -L$$PWD/lib/linux64/ -lsdkencryptedappticket -lsteam_api
 

It compiles very good, but when I run the project in debug mode, it crash exacly in this line:

sf::RenderWindow window(sf::VideoMode(800, 600), "My window");

Have someone try to make an SFML project with steam SDK in linux?
I try compile and run it in release mode but in crashes aready.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11016
    • View Profile
    • development blog
    • Email
Re: SFML with Steam SDK crash on linux.
« Reply #1 on: March 08, 2022, 01:42:33 pm »
Ironbell once did a write up on how to get things built on Linux with the Steam SDK: https://github.com/SFML/SFML/wiki/Tutorial%3A-Build-SFML-for-Steam-on-Linux

Not sure how up to date it is, as Valve has been pushing the Linux space quite bit, but maybe there are still some things to take away.

Quote
-lsfml-system -lsfml-window -lsfml-graphics
Btw. this is in the wrong order. Thumb of rule, if X depends on Y, X has to come before Y.
sfml-graphics depends on sfml-window and sfml-window depends on sfml-system, so it should be graphics, window, system.

When it crashes, what does the debugger say? What's the call stack?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Edimartin

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: SFML with Steam SDK crash on linux.
« Reply #2 on: March 09, 2022, 12:17:45 am »
Hi.

Thank you Exploiter to the help.

I change the order of the librarys and I write this in the .pro file:

LIBS += -lsfml-graphics -lsfml-window -lsfml-system

unix:!macx: LIBS += -L$$PWD/lib/linux64/ -lsdkencryptedappticket -lsteam_api
 

I have the same problem. The software crash in line:

sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
 

The debugger (or the IDE), when crash, show a popup with the name "Signal Received" with this message:

The inferior stopped because it received a signal from the operating system.

Signal name : SIGSEGV
Signal meaning : Segmentation fault
 

I test in Windows 7 with the MinGW Builds 7.3.0 (64-bit) (the link is in SFML download page)  and it runs OK. I test and if I press shift+tab, the screen shows the steam menu.

Thank you verry much. I will see the tutorial.

If the problem persist. I will comment the problem here.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11016
    • View Profile
    • development blog
    • Email
Re: SFML with Steam SDK crash on linux.
« Reply #3 on: March 09, 2022, 11:35:18 am »
Did you build SFML yourself or are you using the ones provided by your package manager?

When it crashes there should be a call stack / trace somewhere, listing all the functions that have been called up to the point of the crash.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Edimartin

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: SFML with Steam SDK crash on linux.
« Reply #4 on: March 09, 2022, 10:08:08 pm »
Hi exploiter.
I download SFML source code and I compile it with "cmake CMakeList.txt" and "makefile -j 4". I try now compile using the command "make" without the "-j 4" and it runs the same bug.

I make the qtcreator project and I run it with the gdb in qtcreator. When it crash, the IDE shows the tree:

1  ??                                                                                                                                          
2  __pthread_once_slow                                                                                        pthread_once.c 116 0x7ffff753547f
3  llvm::ManagedStaticBase::RegisterManagedStatic(void * ( *)(), void ( *)(void *)) const                                        0x7ffff066530a
4  ??                                                                                                                            0x7ffff04f2e94
5  ??                                                                                                                            0x7ffff7fe0b8a
6  ??                                                                                                                            0x7ffff7fe0c91
7  _dl_catch_exception                                                                                                           0x7ffff7ab6895
8  ??                                                                                                                            0x7ffff7fe542d
9  _dl_catch_exception                                                                                                           0x7ffff7ab6838
10 ??                                                                                                                            0x7ffff7fe45fa
11 ??                                                                                                                            0x7ffff751f34c
12 _dl_catch_exception                                                                                                           0x7ffff7ab6838
13 _dl_catch_error                                                                                                               0x7ffff7ab6903
14 ??                                                                                                                            0x7ffff751fb59
15 dlopen                                                                                                                        0x7ffff751f3da
16 glPrimitiveBoundingBox                                                                                                        0x7ffff7140762
17 glPrimitiveBoundingBox                                                                                                        0x7ffff714085d
18 ??                                                                                                                            0x7ffff7120085
19 ??                                                                                                                            0x7ffff7135dee
20 ??                                                                                                                            0x7ffff71275f9
21 ??                                                                                                                            0x7ffff7122dd4
22 ??                                                                                                                            0x7ffff7123472
23 sfglx_LoadFunctions                                                                                                           0x7ffff7f1d430
24 sf::priv::GlxContext::GlxContext(sf::priv::GlxContext *)                                                                      0x7ffff7f1cdb5
25 sf::priv::GlContext::initResource()                                                                                           0x7ffff7f0b927
26 sf::Window::Window()                                                                                                          0x7ffff7f0deb3
27 sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)                    0x7ffff7f75a9d
28 main                                                                                                       main.cpp       17  0x5555555553d7

 

And the line 17 have this:

sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
 

I hope you guys can fix this in future versions of SFML.
I try make some programs with SDL 2.0, GLFW and ALLEGRO and the three librarys run the window with steam SDK without crash.

 

anything