I would like to build SDL3 statically

Hi there,

Ok; I’ve touched on briefly about the reason for SDL_dynapi.c however it’s causing me a lot of hardship.

To be brief, I simply want to build my application to statically link SDL3. I do not want it dynamic. Experience has proven to me that external library changes may impact my work. I would like to manage my updates manually myself as static in my own time. Furthermore, I also do not wish to provide an external library in addition to my work. I simply want to statically link SDL3 as a library.

This has proven impossible and while I can switch to SDL2, it concerns me that I wont be able to update… soooo… I’m not sure here.

I followed the instructions in dynapi ok but now I am getting warnings about tray. I really don’t want to go down the route of patching up and feel this is too much (been through it in the past). I appreciate the comments in the dynapi.h file and I would expect that once I follow those instructions, things work.

Alas; I keep getting warnings. I’m working on a new product and I am considering SDL3 due to past positive experience with SDL2. This is proving rather difficult. I would like to know how I can build my application statically with SDL3 without giving me any dlopen() warnings. YES, I also defined SDL_STATIC or the likes in my application.

Any help would be greatly appreciated.

Regards!

Duncan

I can’t update to SDL3 (for different reasons) and my understanding is that SDL2 will be supported ‘indefinitely’. I sincerely hope so, anyway.

Hi there,

Thank you for taking the time to go through my message. This is just my opinion; and I could be wrong (I hope I am). In your position, I would start slowly supporting SDL3 due to the concern that new hardware that might not work with SDL2. You never know what might present itself and best be ready at the time of need. What I heard was that SDL2 might not be updated in future to support new hardware but I hope I am wrong and if I am, I might reconsider!

Thanks again for putting some thought! I’d love to hear from anyone who knows how to deal with the static linking issue I’m having with SDL3!

Thanks

Duncan

I don’t believe it is possible for me to do that. My application relies on the glLogicOp() function, which is supported in desktop OpenGL and in OpenGLES 1.1, but not in OpenGLES 2.0 or later. Therefore I use the OpenGLES 1.1 backend (fully supported in SDL2) when built for Android or iOS.

But as I understand it support for the OpenGLES 1.1 backend has been removed in SDL3, only OpenGLES 2.0 or later is supported. Hence my application cannot run in SDL3, unless somebody knows of a workaround.

Hi Russell (is that right?)

I’m sorry, I cannot help you there although I asking around, I got that one can simulate glLogicOp. I’m not an expert though in this area.

I would appreciate if someone knows about building SDL 3 statically.

Thanks!

Duncan

Are you asking for help on how to build SDL3 from source, to generate the library (*.lib) and dll file?

Or are you asking for help on how to build a project that has SDL3 statically linked to it?

Or maybe both?

Hi Daniel,

Thanks for your reply. The question is about linking statically so yes, first generate both .lib and .a on both 32 and 64 bit linux and windows targets, and then link them to my project without the warning.

I decided to go with another option vs SDL as a result of this as I feel this is not in the right direction.

Thank you for your followup question and assistance though!

Regards,

Duncan

I can only help with *.lib file on Windows platform, using Visual Studio.

Building SDL from source should be as simple as downloading the source code, generate the Visual Studio project via CMake and then run- and build the generated Visual Studio project, which will generate the *.lib and *.dll files (both debug- and release versions) for you.

Alternatively you can download the pre-built *.lib and *.dll files from the SDL github, for both x86 (32-bit) and x64 (64-bit) platforms.

Would it be ok to use the pre-built files or do you prefer to build them yourself?