4 ms·
To this newcomer to Qt, distributing standalone apps seems like a disaster. Binaries built for macOS link against Qt libraries in /usr/local; on Windows, you ne
by rgovostes 7y ago
To this newcomer to Qt, distributing standalone apps seems like a disaster. Binaries built for macOS link against Qt libraries in /usr/local; on Windows, you need to copy a dozen .dll files until your executable launches, or otherwise rebuild all of Qt (!) to support static linking.
- maccard 7y agoQT is distributed under LGPl so by statically linking you must also distribute your program as LGPL. My understanding is that allowing a user to link their own version of QT (ie shared/dynamic libraries are acceptable) fulfils the criteria to avoid licensing your project under LGPL. >on Windows, you need to copy a dozen .dll files until your executable launches Presumably you're new to Windows development? as long as you place the libraries in the same folder as the executable, add the QT install directory to your path, or add the install direvtoey to your debigging Environment variable, you're laughing - it's as straightforward as DLLs on Windows come.
- kbumsik 7y ago> QT is distributed under LGPl so by statically linking you must also distribute your program as LGPL AFAIK, static linking doesn't necessary make the whole project LGPL. You just need to provide users relink LGPL part of the library.
- maccard 7y agoWould that mean that distributing object files and letting the user link their own QT would work? I'm not totally sure on the nuanced here unforrunately
- jhasse 7y agoYes
- kbumsik 7y agoExactly. For example if you make a project with Qt5.11 then the user should be able to rebuild the project with Qt5.12.
- jcelerier 7y agoyes, according to the GPL authors : https://www.gnu.org/licenses/gpl-faq.en.html#LGPLStaticVsDynamic https://www.gnu.org/licenses/gpl-faq.en.html#LGPLStaticVsDyn...
- maccard 7y agoCool, thanks! I've learned something today!
- NikkiA 7y agoAnd bear in mind that 'object file' here could consist of simply a single 'ar' format file containing all the other static code that needs one simple link command.
- rgovostes 7y ago> as long as you place the libraries in the same folder as the executable The problem is that I don't know which libraries I need. For a very small project I just kept launching the .exe and reading error messages until I had gathered all the DLLs. It's not a sound way to do it, in case a library is loaded dynamically.
- longnguyen 7y agoFor Qt dlls, use windeployqt. For third-party libs you will still need to copy manually though
- geezerjay 7y ago> For Qt dlls, use windeployqt. This, and there are also applications which state which DLLs are missing from a deployment.
- maccard 7y agoHow would you have figured out which libraries you need if you were linking it statically? I'm not going to apologise for Windows DLL behaviour (side note, you can use `dumpbin /dependents` or `DependencyWalker` to track them down) as it's awful, but this is categorically nothing to do with QT.
- deleted 7y ago[deleted]