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

Qt5CoreMacros.cmake generates moc file paths that are illegal on Windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.12.7
    • Build System
    • None
    • Windows 10 Pro 64 Bit
      CMake 3.16.4
      Qt 5.12.7 msvc2017 64 Bit
      VTK 8.2
    • Windows

    Description

      Hello everyone,

      when trying to build VTK 8.2 with support for Qt 5.12.7, I ran into issues when configuring the project (Win10, msvc2017, 64 bit, CMake 3.16.4):

      "Configure" ended up with errors like e.g.

       

      CMake Error at C:/Libs/Qt/5.12.7/msvc2017_64/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:131 (file):
       file failed to open for writing (Invalid argument):
      D:/Temp/vtk/build-nmake/GUISupport/Qt/moc_D:/Temp/vtk/build-nmake/GUISupport/Qt/QVTKInteractorAdapter.cpp_parameters
      Call Stack (most recent call first):
       C:/Libs/Qt/5.12.7/msvc2017_64/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:181 (qt5_create_moc_command)
       GUISupport/Qt/CMakeLists.txt:80 (qt5_wrap_cpp)
      

      Looking at the path of the "moc_" file, it seems obvious that this cannot work. Bringing back Qt version 5.12.6 and repeating the procedure works fine.

      I ran a diff (using fc) between the corresponding Qt5CoreMacros.cmake files and here's the output:

      Comparing files 5.12.6\MSVC2017_64\LIB\CMAKE\QT5CORE\Qt5CoreMacros.cmake and 5.12.7\MSVC2017_64\LIB\CMAKE\QT5CORE\QT5COREMACROS.CMAKE
      ***** 5.12.6\MSVC2017_64\LIB\CMAKE\QT5CORE\Qt5CoreMacros.cmake
       get_filename_component(outpath ${_outfile} PATH)
       get_filename_component(_outfile ${_outfile} NAME_WE)
       file(MAKE_DIRECTORY ${outpath})
      ***** 5.12.7\MSVC2017_64\LIB\CMAKE\QT5CORE\QT5COREMACROS.CMAKE
       get_filename_component(outpath ${_outfile} PATH)
       string(REGEX REPLACE "\\.[^.]*$" "" _outfile ${_outfile})
       file(MAKE_DIRECTORY ${outpath})
      *****

      I suppose this change in the QT5_MAKE_OUTPUT_FILE macro the reason for this behaviour.

      Under Linux, configuring the project yields paths like

      /tmp/VTK-8.2.0/build/Views/Qt/moc_/tmp/VTK-8.2.0/build/Views/Qt/vtkQtAnnotationView.cpp_parameters
      /tmp/VTK-8.2.0/build/Views/Qt/moc_/tmp/VTK-8.2.0/build/Views/Qt/vtkQtListView.cpp_parameters
      /tmp/VTK-8.2.0/build/Views/Qt/moc_/tmp/VTK-8.2.0/build/Views/Qt/vtkQtRecordView.cpp_parameters
      /tmp/VTK-8.2.0/build/Views/Qt/moc_/tmp/VTK-8.2.0/build/Views/Qt/vtkQtTableView.cpp_parameters
      /tmp/VTK-8.2.0/build/Views/Qt/moc_/tmp/VTK-8.2.0/build/Views/Qt/vtkQtTreeView.cpp_parameters
      /tmp/VTK-8.2.0/build/Views/Qt/moc_/tmp/VTK-8.2.0/build/Views/Qt/vtkQtView.cpp_parameters

      which are somewhat odd, but they are "legal", so you can proceed.

      The corresponding paths with Qt 5.12.6 are more familiar :

       

      /tmp/VTK-8.2.0/build_Qt5.12.6/Views/Qt/moc_vtkQtAnnotationView.cpp_parameters
      /tmp/VTK-8.2.0/build_Qt5.12.6/Views/Qt/moc_vtkQtListView.cpp_parameters
      /tmp/VTK-8.2.0/build_Qt5.12.6/Views/Qt/moc_vtkQtRecordView.cpp_parameters
      /tmp/VTK-8.2.0/build_Qt5.12.6/Views/Qt/moc_vtkQtTableView.cpp_parameters
      /tmp/VTK-8.2.0/build_Qt5.12.6/Views/Qt/moc_vtkQtTreeView.cpp_parameters
      /tmp/VTK-8.2.0/build_Qt5.12.6/Views/Qt/moc_vtkQtView.cpp_parameters 
      

      A possible work-around would be to revert line 62 in Qt5CoreMacros.cmake to its previous state. Or would you recommend something else?

      Thanks in advance and best regards

       Ralf

       

       

       

       

      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
              ralfk Ralf Kirsch
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes