Hi Bryce. Honestly, this is one of those things that I don't understand very well either. :-> It also depends on the platform, and might also depend on how the software gets built (Xcode vs. cmake vs. qmake).
The SLiMgui for macOS that gets installed by the macOS installer has had the build version of Qt incorporated into the app bundle as a private framework, against which the app then links. This is described in detail at
https://doc.qt.io/qt-5/macos-deployment.html, but honestly the details of how it works are way above my pay grade. :-> In practice, though, it means that with the installer version of SLiMgui on macOS, the app is self-contained and does not depend upon any external Qt installation.
On Linux I believe things are quite different, but as you know I'm not very knowledgeable about Linux. The corresponding Qt doc page for Linux is at
https://doc.qt.io/qt-5/linux-deployment.html, which might prove useful to you. I wrote before (back in 2020! :->) that I didn't know where that "Run-time Qt version 5.14.2 does not match compile-time Qt version 5.13.2" message was coming from, but I don't know why I wrote that; I was apparently confused. :-> That message is generated from line 198 of QtSLiM's main.cpp:
// Check that the run-time Qt version matches the compile-time Qt version
if (strcmp(qVersion(), QT_VERSION_STR) != 0)
{
std::cout << "Run-time Qt version " << qVersion() << " does not match compile-time Qt version " << QT_VERSION_STR << std::endl;
exit(EXIT_FAILURE);
}
It looks like I added that in May of 2020 (
https://github.com/MesserLab/SLiM/commit/c51a681e1468b9f29a4c77e462a24058a9056983). I no longer recall the impetus for adding the check, but in general it seems like a good idea to me. Rebuilding SLiMgui is quite easy, so I don't see any very compelling reason to run SLiMgui against a different version of Qt than it was built against. Yes, it might *usually* work; but if it doesn't work, then you'll probably crash, and even if it *appears* to work it might be malfunctioning in subtle ways, and debugging such issues would be a nightmare when they did arise. Better to just do a version check to make sure that the two match, it seems to me, to avoid that whole can of worms. If we had the resources to do thorough QA testing – build version X, runtime version Y, does it work? – for every possible combination of versions then perhaps we could make the check smarter, but of course we do not have those resources.
To underline why it's potentially important for version numbers to match up, note that in quite a few places in SLiMgui's code there are checks like this:
#if (QT_VERSION < QT_VERSION_CHECK(5, 11, 0))
...
#else
...
#endif
These are checking the *build* version of Qt, and doing different things when building against different versions. This can be because an old API got deprecated, or because new/better API that I would prefer to use got added, or to avoid a bug in an old Qt version by using a workaround, etc. So the built code is built on the assumption of a particular version of Qt. If it were to run against a different version of Qt, all of these spots in the code would then be potential failure points.
Anyhow, I guess this means that SLiMgui on Linux is being dynamically linked, by definition – if it were statically linked then it wouldn't be possible for the runtime Qt version to be different from the build-time Qt version, I suppose. I'm not sure about much of this; I'm actually quite ignorant about the details of how linkers work, especially on Linux! I'm also not sure how exactly this gets controlled by the various makefiles in use (Xcode, cmake, qmake). The CMakeLists.txt for SLiM has this, for non-Windows platforms:
target_link_libraries( ${TARGET_NAME} PUBLIC Qt5::Widgets Qt5::Core Qt5::Gui OpenGL::GL gsl tables eidos_zlib )
I'm not sure whether/how that specifies that the link is dynamic vs. static. It is even less clear to me how the link type gets specified in the QtSLiM.pro file that qmake uses. Sorry I'm so clueless; linking is just not a level of the development process that I have ever been comfortable working at, since on macOS it all gets handled by the Xcode IDE and there is a standard macOS way ("frameworks") that linkage gets handled. As a result, I've just never gotten into these particular weeds :->. Perhaps someone who knows more about this stuff can provide a better answer!
Cheers,
-B.
Benjamin C. Haller
Messer Lab
Cornell University