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

SDL2 backend: dlopen problems on Linux (not using SONAME with dlopen) #323

Open
eliasdaler opened this issue Aug 5, 2021 · 1 comment
Open

Comments

@eliasdaler
Copy link

eliasdaler commented Aug 5, 2021

Hello
I'm using soloud with SDL2 compiled as a shared library on Linux (Ubuntu 20.04 to be exact)
When linking with SDL2 using its CMake, I get a link with libSDL2-2.0.so.0 which is a symlink to libSDL2-2.0.so.0.14.0

This causes dlopen in sdl2_openDll() function to fail, as it fails to find libSDL2.so or SDL2.so that it searches for. However, the fix is pretty simple (I can provide the PR if I got this right):

static void * sdl2_openDll()
{
	void * res;
	res = dlopen("/Library/Frameworks/SDL2.framework/SDL2", RTLD_LAZY);
	if (!res) res = dlopen("SDL2.so", RTLD_LAZY);
	if (!res) res = dlopen("libSDL2.so", RTLD_LAZY);
	if (!res) res = dlopen("libSDL2-2.0.so.0", RTLD_LAZY);  // <---- need to add this line
    return res;
}

Also please see this post from Ryan C. Gordon (one of the main devs of SDL) saying that "libSDL2-2.0.so.0" is the SONAME that should be used. Also see:

$ objdump -p third_party/sdl/libSDL2-2.0.so | grep SONAME
  SONAME               libSDL2-2.0.so.0
@jarikomppa
Copy link
Owner

PR would be nice, even for small things like this =)

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