Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1699

Failed to find libclang path by cmake

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 6.0
    • PySide
    • None
    • cmake 3.20.6
      Qt 6.2
      PySide6
    • Windows

    Description

      During running 

      python setup.py build

      an cmake error happened when using cmake to locate libclang path.
       

      Finding path to the libclang shared library.
      CMake Error: Unknown argument --build
      CMake Error: Run 'cmake --help' for all supported options.
      Traceback (most recent call last):
        File "G:\git\pyside-setup\setup.py", line 78, in <module>
          setup_runner.run_setup()
        File "G:\git\pyside-setup\build_scripts\setup_runner.py", line 125, in run_setup
          self.run_setuptools_setup()
        File "G:\git\pyside-setup\build_scripts\setup_runner.py", line 181, in run_setuptools_setup
          setup(**kwargs)
        File "G:\git\pyside-setup\testenv\lib\site-packages\setuptools\__init__.py", line 165, in setup
          return distutils.core.setup(**attrs)
        File "E:\Python39\lib\distutils\core.py", line 148, in setup
          dist.run_commands()
        File "E:\Python39\lib\distutils\dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "E:\Python39\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "G:\git\pyside-setup\build_scripts\main.py", line 596, in run
          self.prepare_packages()
        File "G:\git\pyside-setup\build_scripts\main.py", line 969, in prepare_packages
          return prepare_packages_win32(self, vars)
        File "G:\git\pyside-setup\build_scripts\platforms\windows_desktop.py", line 240, in prepare_packages_win32
          copy_qt_artifacts(self, copy_pdbs, vars)
        File "G:\git\pyside-setup\build_scripts\platforms\windows_desktop.py", line 481, in copy_qt_artifacts
          self.prepare_standalone_clang(is_win=True)
        File "G:\git\pyside-setup\build_scripts\main.py", line 1021, in prepare_standalone_clang
          raise RuntimeError("Could not find the location of the libclang "
      RuntimeError: Could not find the location of the libclang library inside the CMake cache file.
      Traceback (most recent call last):
        File "G:\git\pyside-setup\setup.py", line 78, in <module>
          setup_runner.run_setup()
        File "G:\git\pyside-setup\build_scripts\setup_runner.py", line 167, in run_setup
          raise RuntimeError(msg)
      RuntimeError:
      setup.py invocation failed with exit code: 1.
      setup.py invocation was: G:\git\pyside-setup\testenv\Scripts\python.exe setup.py build --internal-build-type=shiboken6-generator --reuse-build
      

      I fixed it with replacing 

      --build

      with 

      -B

       

      build_scripts/main.py:1011
      def prepare_standalone_clang(self, is_win=False):
          """
          Copies the libclang library to the shiboken6-generator
          package so that the shiboken executable works.
          """
          log.info('Finding path to the libclang shared library.')
          cmake_cmd = [
              OPTION["CMAKE"],
              "-L",         # Lists variables
              "-N",         # Just inspects the cache (faster)
              "-B",         # Specifies the build dir
              self.shiboken_build_dir
          ]

       

      Seems like cmake (version 3.20.6) not support this kind of command any more. 

      cmake -L -N --build testenv3_build\\py3.9-qt6.2.0-64bit-release\\shiboken6

      I ran the command manually, same error happened again, so I checked cmake help, tested new option -B, it got the right output.

       

      cmake -L -N -B testenv3_build\\py3.9-qt6.2.0-64bit-release\\shiboken6
      -- Cache values
      BIN_INSTALL_DIR:PATH=bin
      BUILD_TESTS:BOOL=False
      CLANG_LIBRARY:FILEPATH=G:/libclang/bin/libclang.dll
      CMAKE_BUILD_TYPE:STRING=Release
      CMAKE_INSTALL_PREFIX:PATH=G:/git/pyside-setup/testenv3_install/py3.9-qt6.2.0-64bit-release
      Clang_DIR:PATH=G:/libclang/lib/cmake/clang
      DISABLE_DOCSTRINGS:BOOL=OFF
      ENABLE_ICECC:BOOL=OFF
      ENABLE_VERSION_SUFFIX:BOOL=OFF
      FORCE_LIMITED_API:BOOL=ON
      LIBXSLT_EXSLT_INCLUDE_DIR:PATH=LIBXSLT_EXSLT_INCLUDE_DIR-NOTFOUND
      LIBXSLT_LIBRARY:FILEPATH=LIBXSLT_LIBRARY-NOTFOUND
      LIB_INSTALL_DIR:PATH=lib
      LIB_SUFFIX:STRING=
      LLVM_DIR:PATH=G:/libclang/lib/cmake/llvm
      QT_ADDITIONAL_PACKAGES_PREFIX_PATH:STRING=
      Qt6CoreTools_DIR:PATH=E:/Qt/6.2.0/msvc2019_64/lib/cmake/Qt6CoreTools
      Qt6Core_DIR:PATH=E:/Qt/6.2.0/msvc2019_64/lib/cmake/Qt6Core
      Qt6EntryPointPrivate_DIR:PATH=E:/Qt/6.2.0/msvc2019_64/lib/cmake/Qt6EntryPointPrivate
      Qt6Xml_DIR:PATH=E:/Qt/6.2.0/msvc2019_64/lib/cmake/Qt6Xml
      Qt6_DIR:PATH=E:/Qt/6.2.0/msvc2019_64/lib/cmake/Qt6
      SPHINX:FILEPATH=G:/git/pyside-setup/testenv/Scripts/sphinx-build.exe
      USE_PYTHON_VERSION:BOOL=3.6
      

       

      Attachments

        Issue Links

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

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              eason1987 eason1987
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes