Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Generating a .so for a dylib linking to static Qt



  • I have a project building a .so library using

    CONFIG += dylib
    

    which builds successfully with the standard Qt kit (5.10 + GCC), generated all the files I expect.

    However, when I switch to the static build of Qt I built, no .so is generated. The .a and .o files are generated as expected, and I can call a manual call with QMAKE_POST_LINK that looks like:

    g++ -shared -o  <libname>.so  .....
    

    Which works successfully, but I expect that this would be done automatically with the dylib config, as it is when linking to the downloaded qt kit.

    Is there some configuration that would cause this? A misunderstanding with how I have added the static qt build kit? Adding a custom g++ call with QMAKE_POST_LINK seems heavy handed.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Based on memories and the CONFIG variable documentation, I'd try to add CONFIG += shared.



  • Thank you, that does resolve the issue! I had tried adding shared to linker flags, but not to the CONFIG.

    Any reason you can think that it would work for one kit but not another?

    Thanks!


  • Lifetime Qt Champion

    You're welcome !

    That's a good question and I don't know currently. But I think it would make sense to build projects in the same mode as Qt has been built if nothing is specified.



  • Well, I suppose that makes sense. Thanks for your help!


Log in to reply