[Development] 答复: Qt static compiler error

Ray Donnelly mingw.android at gmail.com
Tue Oct 27 16:12:03 CET 2015


On Tue, Oct 27, 2015 at 3:09 PM, Ray Donnelly <mingw.android at gmail.com> wrote:
> On Tue, Oct 27, 2015 at 2:48 PM, Matthew Woehlke via Development
> <development at qt-project.org> wrote:
>> (Apologies for reposting information, but my other message is stuck
>> somewhere in the moderation queue...)
>>
>> On 2015-10-26 22:58, Thiago Macieira via Development wrote:
>>> On Tuesday 27 October 2015 09:05:34 kl222 via Development wrote:
>>>> Thiago Macieira:
>>>>
>>>> 1. I think this is a bug. When using cmake project file, it has the
>>>> responsibility to deal with it automatic dependency, rather than by the user
>>>> to deal with.
>>>
>>> That might be. So please report it so this isn't forgotten.
>>
>> Please compare https://bugreports.qt.io/browse/QTBUG-38913 before
>> reporting a bug.
>>
>>>> 2. No bug for qt. How to use .prl and .pc in cmake or pro file?
>>>
>>> In the .pro file, the .prl file is used automatically. You don't have to do
>>> anything. You won't see this problem with qmake.
>>>
>>> Your problem is exclusive to cmake because the information is missing from our
>>> generated files. Matthew says there's a place to save them, but he doesn't
>>> know how Qt's buildsystem generates such files.
>>>
>>> That's done in mkspecs/features/create_cmake.prf in qtbase using
>>> mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in as a template. If anyone
>>> can figure out how to save LIBS and LIBS_PRIVATE in the cmake file, that
>>> should fix the problem.
>>
>> https://codereview.qt-project.org/#/c/33193/4 ?
>>
>> Looking a bit more closely, it looks like that may be stale beyond being
>> able to apply.
>>
>> Looking at create_cmake.prf, I still don't understand what's going on
>> :-). It looks like what needs to happen, though, is somewhere about
>> where CMAKE_QT5_MODULE_DEPS is filled, another variable needs to be
>> filled with the private dependencies. Then in Qt5BasicConfig.cmake.in
>> where this is used, there needs to be an additional PP conditional to
>> choose between just the public deps or both the public and private deps,
>> depending if Qt is static. (There is already such PP conditionals for
>> using the correct add_library(), so there is no issue with such an
>> addition.)
>>
>> Very rough patch for the CMake side attached. (This won't fix the
>> problem, it's just to demonstrate what I'm trying to say above.) If
>> someone knows how to modify create_cmake.prf to stuff the appropriate
>> private dependencies into CMAKE_QT5_MODULE_STATIC_DEPS, I think this
>> should work.
>
> The MSYS2 project carries multiple patches to fix / implement Qt5
> static CMake support, at least one of them based on previous (since
> reverted) work by Stephen Kelly. I've not got enough time to deal with
> upstreaming them unfortunately. You can find them here:
>
> https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-qt5-static
> (most of the patches from 0033- onwards).
>
> .. or you could use our qt5-static packages if you wish.

I forgot to mention, we also have a patch for CMake to add an
'AUTOSTATICPLUGINS' feature so that the needed plugins get statically
linked too:

https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-cmake/qt5-static-plugin-support.patch

>
> --
> Best regards,
>
> Ray.
>
>>
>> --
>> Matthew
>>
>> _______________________________________________
>> Development mailing list
>> Development at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/development
>>



More information about the Development mailing list