Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Statically linked third-party app leads to segmentation fault



  • I have successfully build a third-party app using Qt 5.9.7 (as well as 5.12.10) in a docker container under CentOS 7.

    When I build it using dynamically linked Qt libraries it runs fine but when I add the -static flag to the initial building of qmake in order to have the Qt libraries statically linked to the third-party application it crashes - in the docker container - with a segmentation fault.

    Note that there are no other differences between the two scenarios and both run in walled-off docker containers, they /should/ have the same libraries etc in the same places...

    Does anyone have any suggestions where I should start looking?



  • I should have added that ldd [application] shows that the Qt libraries are /not/ among the list of dynamically linked libraries and I therefore "assume" they are statically linked.


  • Lifetime Qt Champion

    Hi,

    Did you try to start it using a debugger ?



  • No, I have not linked any debugging information and not done that. To try to speed this process up, may I respectfully ask that you suggest a few possible reasons for the crash bearing in mind that in both scenarios I run the app in a docker container?

    Surely I cannot be the first person with this experience?


  • Moderators

    This post is deleted!

  • Lifetime Qt Champion

    @yryu4526 said in Statically linked third-party app leads to segmentation fault:

    Surely I cannot be the first person with this experience?

    Using an application with a statically built Qt inside Docker ? You are likely not that many.

    As for suggestions, it could be the platform plugin acting up. Not knowing that third party application does not help either. Hence a crash report would help pinpoint the issue. You can also try using strace to see if there's any difference there.



  • Well, the objective is not to run it in docker once I have compiled it. However, since it uses a different version of Qt than the default version on the computer and I am worried about messing things up, can you point me to instructions on how to compile the application if not statically linked and where to put the various Qt libraries outside docker so that they do not conflict with what is already on the system?

    Thanks.


  • Lifetime Qt Champion

    If you would like to use Qt pre-built binaries, then the installer will put them in non conflicting areas by default. Either your home directory or /opt.

    Just beware that at this moment, there are some issues to download them. See this thread.


Log in to reply