How to build Qt 5 statically

后端 未结 1 983
不思量自难忘°
不思量自难忘° 2020-12-31 08:31

I worked with Qt Creator 2.6.2 based on Qt 5.0.1 in a linux environnement. The application works fine on the computer where I made the compilation but when I execute it on

相关标签:
1条回答
  • 2020-12-31 09:00

    The Qt shared libraries don't exist on the other computer you tested it on. So you need to either:

    1. Copy the shared libraries to your other machine. Or...
    2. Create a static Qt build to link with your application.

    It's not sufficient to just add CONFIG += static to your .pro file, you also need Qt static libraries. So to do #2 you'll need to get the Qt source code and build it yourself.

    Also, Qt is licensed under the LGPL so you'll need to be aware of that when static linking. There are some who believe that the LGPL does not allow static linking (unless you LGPL your own code) and others who believe that it does (so long as you're willing to release the object code for your app). But that's a whole other discussion.

    0 讨论(0)
提交回复
热议问题