Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-98279

-lasan recorded in Qt6Core.prl when building Qt with address sanitizer

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.1, 6.3
    • Build System: CMake
    • None

    Description

      When configuring Qt with -sanitize address, we use ECMEnableSanitizers.cmake to add sanitizer support.
      It runs

      link_libraries(asan)
      

      which adds an -lasan flag to all built Qt libs.

      Accidentally, that adds those flags to the prl files too.

      lib/libQt6Core.prl
      5:QMAKE_PRL_LIBS = -lasan -lpthread
      6:QMAKE_PRL_LIBS_FOR_CMAKE = -lasan;-lpthread
      

      Those -lasan link flags get added to apps when they are built with qmake and link against Qt6Core.
      But qmake has it's own sanitizer.prf that handles sanitizer flags that need to be added.

      As such, we should NOT record those -lasan flags in the .prl files of modules. It could lead to issues with linking the wrong library. And usually fsanitize-address takes care of linking the proper libs.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtbuildsystem Qt Build System Team
              alexandru.croitor Alexandru Croitor
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes