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

qtbase 6.6.0-beta2 fails to build (linux-clang target) at cmake stage if -DQT_FEATURE_gc_binaries is used

    XMLWordPrintable

Details

    • Linux/Wayland, Linux/X11, Linux/Other display system
    • 53b6c88a2 (dev), dae4bde60 (6.5), 44949ea13 (6.6)

    Description

      Running cmake in qtbase 6.6.0-beta2 results in

      CMake Error at cmake/QtPkgConfigHelpers.cmake:104 (file): 
       Error evaluating generator expression: 
      
         $<CXX_COMPILER_ID:IntelLLVM$<ANGLE-R>$<ANGLE-R>:-Wl$<COMMA>--gc-sections$<ANGLE-R>> 
      
       $<CXX_COMPILER_ID> may only be used with binary targets.  It may not be 
       used with add_custom_command or add_custom_target. 
      Call Stack (most recent call first): 
       cmake/QtModuleHelpers.cmake:915 (qt_internal_generate_pkg_config_file) 
       cmake/QtScopeFinalizerHelpers.cmake:24:EVAL:1 (qt_finalize_module) 
       src/corelib/CMakeLists.txt:DEFERRED 
      
      
      CMake Error at cmake/QtPkgConfigHelpers.cmake:104 (file): 
       Error evaluating generator expression: 
      
         $<CXX_COMPILER_ID:IntelLLVM$<ANGLE-R>$<ANGLE-R>:-Wl$<COMMA>--gc-sections$<ANGLE-R>> 
      
       $<CXX_COMPILER_ID> may only be used with binary targets.  It may not be 
       used with add_custom_command or add_custom_target. 
      Call Stack (most recent call first): 
       cmake/QtModuleHelpers.cmake:915 (qt_internal_generate_pkg_config_file) 
       cmake/QtScopeFinalizerHelpers.cmake:24:EVAL:1 (qt_finalize_module) 
       src/corelib/CMakeLists.txt:DEFERRED 
      
      
      CMake Error at cmake/QtPkgConfigHelpers.cmake:104 (file): 
       Error evaluating generator expression: 
      
         $<CXX_COMPILER_ID:IntelLLVM$<ANGLE-R>$<ANGLE-R>:-Wl$<COMMA>--gc-sections$<ANGLE-R>> 
      
       $<CXX_COMPILER_ID> may only be used with binary targets.  It may not be 
       used with add_custom_command or add_custom_target. 
      Call Stack (most recent call first): 
       cmake/QtModuleHelpers.cmake:915 (qt_internal_generate_pkg_config_file) 
       cmake/QtScopeFinalizerHelpers.cmake:24:EVAL:1 (qt_finalize_module) 
       src/corelib/CMakeLists.txt:DEFERRED
      

      6.6.0-beta1 works fine.

      cmake 3.26.4
      clang 16.0.6

      git bisect shows the culprit to be

      9b6d4f542f32a786c0ddb4ca8ecb1f2c8fb668c1 is the first bad commit
      commit 9b6d4f542f32a786c0ddb4ca8ecb1f2c8fb668c1
      Author: Alexey Edelev <alexey.edelev@qt.io>
      Date: Fri May 12 17:21:22 2023 +0200
      
      Wrap the GNU/Clang compiler-dependent flags with genex conditions
      
      If flags use CMake scopes that propagate them to user libraries, it may
      lead to an issue, if user projects are built using different compiler.
      We need to guard these flags to make sure that they only will apply to
      respective compilers.
      
      Change-Id: I0fd5847447bd8373e8e07f64dae11f27f48c915d
      Reviewed-by: Alexandru Croitor (OOO) <alexandru.croitor@qt.io>
      Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
      (cherry picked from commit a2b6c2f3437bf1779da787e719bea08bc6f28622)
      Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
      
      cmake/QtFlagHandlingHelpers.cmake | 24 +++++++++++++++++++++---
      1 file changed, 21 insertions(+), 3 deletions(-)
      

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-115243
          # Subject Branch Project Status CR V

          Activity

            People

              alexandru.croitor Alexandru Croitor
              bero Bernhard Rosenkränzer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes