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

SDL 1.2.10 crashs on exit when using OpenGL and linking to -lGL #159

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

SDL 1.2.10 crashs on exit when using OpenGL and linking to -lGL #159

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: 1.2.10
Reported for operating system, platform: Linux, x86

Comments on the original bug report:

On 2006-05-27 05:59:02 +0000, Matthias Braun wrote:

The following simple testprogramm:

#include <SDL.h>

int main()
{
SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK);
SDL_SetVideoMode(800, 600, 0, SDL_OPENGL);
SDL_Quit();
}

Crashs on exit for me. When I compile&link it like this:

gcc sdl-config --cflags --libs -lGL test.c

Interestingly the error goes away when I NOT link against -lGL or when I switch back to SDL 1.2.9. The crash occurs after the main function has finished. The stacktrace isn't really helpfull unfortunately:

[Switching to Thread -1221962016 (LWP 1705)]
0x00000000 in ?? ()
(gdb) bt

0 0x00000000 in ?? ()

1 0xb7ee935d in XextFindDisplay () from /usr/lib/libSDL-1.2.so.0

2 0xb7e6cf61 in _nv000036gl () from //usr//lib/opengl/nvidia/lib/libGL.so.1

3 0xb7e985e8 in ?? () from //usr//lib/opengl/nvidia/lib/libGL.so.1

4 0x08078188 in ?? ()

5 0x00000001 in ?? ()

6 0xbfa40dac in ?? ()

7 0x08089d40 in ?? ()

8 0x00000000 in ?? ()

I'm using a gentoo linux on x86 with nvidia opengl driver version 1.0.8762. I can provide further infos if needed.

On 2006-06-02 17:00:04 +0000, Patrice Mandin wrote:

I encountered the same problem. For example, Blender 2.41 segfaults when starting (it is linked to SDL). I recompiled SDL 1.2.10 by statically linking X11 to SDL as before, and it did not crash. I also use Nvidia driver (1.0-7174), and the crash does not happen when using Mesa library.

Maybe the X11 library loading/unloading stuff in SDL does not suits Nvidia driver.

On 2006-06-20 01:30:12 +0000, Sam Lantinga wrote:

Ugh, the OpenGL library is resolving the X11 symbols from the SDL library, instead of from the X11 library. When SDL unloads the X11 library, those symbols are no longer available.

On 2006-06-20 01:50:25 +0000, Ryan C. Gordon wrote:

Are we referencing the GL after closing the real X11 library? Shouldn't that crash anyhow?

Maybe we should load the X11 libs and never release them...this shouldn't actually hurt anything, even if there's some strange condition where a subsystem restart would cause us to choose a different video target.

--ryan.

On 2006-06-20 01:51:28 +0000, Ryan C. Gordon wrote:

(Or we could just rip out the dynamic X11 stuff, which is proving to be a big fat pain in lots of unexpected cases.)

--ryan.

On 2006-06-20 02:10:54 +0000, Sam Lantinga wrote:

Or convert it back to pointer syntax, or default it off... it's your call, I don't have any strong preference either way. :)

On 2006-06-22 06:50:24 +0000, Ryan C. Gordon wrote:

Hhmm...maybe we should punt on this and only use dynamic X11 if built with gcc4 (so -fvisibility=hidden removes this specific problem).

There's really no clean way to do the dynamic stuff and have it work everywhere, but it's really compelling for keeping dependencies out of SDL (DPMS extension, ripping out the included Xinerama libs, eventually XInput for multiple mice, etc). I'm inclined to leave old and busted Unixes (OSF?) with build-time dynamic linking, and use the runtime linking on newer systems (Linux, etc) where it's likely that binaries are getting swapped around between systems.

Xlib is such a mess.

--ryan.

On 2006-06-22 22:19:58 +0000, Ryan C. Gordon wrote:

Ok, I went with the gcc4 thing...you'll get normal build-time dynamic linking if you don't have -fvisibility=hidden support, and dlopen() magic if you do, which fixes this specific bug with minimal changes to SDL.

Fixed in svn revision # 2548.

--ryan.

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

1 participant