-
Notifications
You must be signed in to change notification settings - Fork 10
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
static_dynamicCRT
build still has dynamic link dependency for SDL2
#21
Comments
That's intentional, but I was/am planning to eventually fix this. The idea of the static_* configs is for cimgui to be statically linked. As it's not provided by distros (or well configured for our needs in Inochi, and we had issues with dynamically linked libraries on Linux. I believe the default config for SDL on bindbc-sdl is dynamically linked SDL (correct me if I'm wrong), so it's easier for us to match that with our C++ dependencies. We are planning to switch everything but the C/C++ runtime libraries to be statically linked, but I'm not sure how that will change our configs (do we turn this into a triplet that includes the permutations of SDL/Freetype?) |
I see. It seems desirable to be as statically-linked as possible! This is a dub question more than anything else - is my line |
Haha, that's the opposite of my expectation for most Linux programmers. I was under the impression most folks want their deps dynamically linked so their package managers handle them. As for the sub configuration, here's where we start getting into headaches and part of why it's easier to link dynamically against our non-cimgui dependencies. When you specify that you want bindbc-sdl to be static, that will indeed do what you expect, specifically for those bindings. But bindbc-imgui needs to compile cimgui and imgui (the C++ dependencies) itself. That process doesn't know about the subconfiguration you've used for a different D dependency and uses whatever you've configured for bindbc-imgui, which currently doesn't provide any option other than dynamically linking. Making sure the C++ libraries we depend on are the same as the C++ libraries other D libraries depend on are the same is tricky and not super clear how to do for every project. (Which I'm guessing is why most of the other D binding libraries probably default to linking against packaged stuff.) That said, on Linux specifically, if we provided a config for "linking against SDL statically" you'd just need to pass that config and it'd be easy for all involved. We just don't have that right now. The first step was going to be compiling our own SDL and Freetype on Linux and figuring out how to make our AppImage happy with it, and then switch to statically linking. |
That's usually true, but I myself am super tired of the status quo of choosing between package manager hell or some heavy-handed packaging layer like AppImage, Flatpak, etc. Ideally, I'd like to learn how to make executables that I can copy between computers and have work (a tall order for modern Linux). Glibc and OpenGL as I understand probably have to stay dynamic for reasons... Though hopefully everything else should being static should help the situation. |
I hear you. I'll try to figure something out soon. The easiest thing would be something similar to what we did with cimgui in the dub.sdl Would you also want us to build our own copy of SDL? That's what we do on Windows and Mac, but I'm not sure how we could make that work on Linux as an optional thing without adding even more subconfigs. (Beyond what we'd already need to add configs for statically linking to freetype and SDL. |
Wait, maybe I should generate our dub.sdl 🤯 |
SDL2 is probably not a good idea to statically link either since it's meant to be dynamically linked and be able to automatically switch to newer versions of the library on load. Each distro should be seen as a separate operating system and it's your choice as a developer to decide which of those you want to support. Alternatively you should go back to the POSIX roots of shipping software & their dependencies in /opt, with rpath set to load from your /opt directory or just give up and accept AppImage. This is over-complicating bindbc-imgui for honestly quite bad reasons, I feel we should even reduce the amount of configurations we have currently, as some make very little sense in the grand scheme of things. (eg. static-static) Unless we want to turn this in to a mix of a bindbc, sdl and freetype binding. |
According to this, it seems like it's certainly a valid strategy (even if not one they recommend).
In any case, I'm not convinced the reasons are bad, but I do understand that this may increase complexity on your part. Thanks for maintaining these bindings at all - good luck at whatever you guys choose to do. |
I don't, they are simply separate systems. And the issue isn't that things aren't statically linked, but that we treat all software installed by the package manager as system software, instead of separating system and user applications sensibly, giving each application the dependencies they need (like on Windows or macOS) through rpath and /opt, which is a POSIX path specifically meant to house software that isn't system software, but which is very under-utilized. |
Built what was basically the example project with the following
dub.sdl
on Linux Mint 20.3 (x64):dub.sdl
This is the output of
ldd imgui
:ldd output
Am I doing something wrong here? Thanks!
The text was updated successfully, but these errors were encountered: