[lldb-dev] LLDB finish_swig and Python module installation broken for multi-configuration generators

Ted Woodward via lldb-dev lldb-dev at lists.llvm.org
Thu Oct 10 16:11:20 PDT 2019


Starting in r372835 (Fix installing Python modules on systems using /usr/lib), the finish_swig and installation steps using multi-configuration generators (like Visual Studio or XCode) are broken.

The problem is the symlink and install steps look for liblldb and site-packages the wrong directories.

For the symlink, I get this output:
         Making symlink from ..\..\..\bin\liblldb.dll to i:\obj\lib\site-packages\lldb\_lldb.pyd
...
         WindowsError: [Error 2] The system cannot find the file specified: '..\\..\\..\\bin\\liblldb.dll'

Because the cwd is I:\obj\Lib\site-packages\lldb, not the correct I:\obj\Release\Lib\site-packages\lldb. liblldb.dll is in i:\obj\Release\bin, not i:\obj\bin. Also, the link itself should be in i:\obj\Release\lib, not i:\obj\lib.

The problem is the cmake code went from using LLVM_LIBRARY_OUTPUT_INTDIR to CMAKE_BINARY_DIR. CMAKE_BINARY_DIR is not complete for multi-configuration generators - you need to specify the configuration as well.

To fix it, in lldb/CMakeLists.txt change
    if(LLDB_BUILD_FRAMEWORK)
      set(lldb_python_build_path "${liblldb_build_dir}/LLDB.framework/Resources/Python/lldb")
    else()
      set(lldb_python_build_path "${CMAKE_BINARY_DIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
    endif()

to:
    if(LLDB_BUILD_FRAMEWORK)
      set(lldb_python_build_path "${liblldb_build_dir}/LLDB.framework/Resources/Python/lldb")
    else()
      if(CMAKE_CFG_INTDIR)
       # use CMAKE_BUILD_TYPE here because CMAKE_CFG_INTDIR is ${Configuration}
        # using Visual Studio, which won't work in cmake_install.cmake
        # because it is a VS variable, not a cmake variable
        install(DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${LLDB_PYTHON_RELATIVE_PATH}/
                DESTINATION ${LLDB_PYTHON_RELATIVE_PATH}
                COMPONENT lldb-scripts)
      else()
        install(DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_PYTHON_RELATIVE_PATH}/
                DESTINATION ${LLDB_PYTHON_RELATIVE_PATH}
                COMPONENT lldb-scripts)
      endif()
    endif()


In the install step we have a similar failure. The install in lldb/CMakeLists.txt again uses CMAKE_BINARY_DIR. To fix it, change:
      install(DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_PYTHON_RELATIVE_PATH}/
              DESTINATION ${LLDB_PYTHON_RELATIVE_PATH}
              COMPONENT lldb-scripts)
to:
      if(CMAKE_CFG_INTDIR)
        install(DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/
                DESTINATION ${LLDB_PYTHON_RELATIVE_PATH}
                COMPONENT lldb-scripts)
      else()
        install(DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_PYTHON_RELATIVE_PATH}/
                DESTINATION ${LLDB_PYTHON_RELATIVE_PATH}
                COMPONENT lldb-scripts)
      endif()


Michal, please try this and see if it still works for the issue you fixed in r372835.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20191010/94d6ad67/attachment.html>


More information about the lldb-dev mailing list