Page MenuHomePhabricator

[lldb/CMake] Fix `install` for multi-configuration generators.
ClosedPublic

Authored by JDevlieghere on Mar 25 2020, 11:53 PM.

Details

Summary

For multi-generator builds like MSVC and Xcode, the install source and destination of the lldb-python-scripts target contains configuration dependent paths and therefore need to be substituted.

Diff Detail

Event Timeline

JDevlieghere created this revision.Mar 25 2020, 11:53 PM
NathanielMcVicar added a comment.EditedMar 26 2020, 9:45 AM

This patch resolved the issue for our VS build. Thanks! Unfortunately, I don't have any way to test it for Xcode. Should I still accept the revision?

edit: I missed that you tested it in Xcode. Thanks again!

NathanielMcVicar accepted this revision.Mar 26 2020, 9:49 AM
This revision is now accepted and ready to land.Mar 26 2020, 9:49 AM

This patch resolved the issue for our VS build. Thanks! Unfortunately, I don't have any way to test it for Xcode. Should I still accept the revision?

I've tested it for Xcode, so feel free to accept it :-)

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 26 2020, 10:18 AM
brooks added a subscriber: brooks.Mar 27 2020, 3:14 PM

This is broken in a FreeBSD install.

CMake Error at tools/lldb/cmake_install.cmake:44 (file):
  file INSTALL cannot find                                                        "/usr/local/poudriere/ports/brooks/devel/llvm-devel/work/Releasebuild/Release/lib/python3Release7/site-packages/lldb/..":          
  No such file or directory.                                                    Call Stack (most recent call first):
  tools/cmake_install.cmake:45 (include)     
  cmake_install.cmake:67 (include)

Note the python3Release7.

This originates from this generated snippet in tools/lldb/cmake_install.cmake:

if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xlldb-python-scriptsx" OR NOT CMAKE_INSTALL_COMPONENT)
  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/python3${CMAKE_INSTALL_CONFIG_NAME}7/site-packages" TYPE DIRECTORY FILES "/usr/local/poudriere/ports/brooks/devel/llvm-devel/work/${CMAKE_INSTALL_CONFIG_NAME}build/${CMAKE_INSTALL_CONFIG_NAME}/lib/python3${CMAKE_INSTALL_CONFIG_NAME}7/site-packages/lldb/../")
endif()

Please revert.

This is broken in a FreeBSD install.

CMake Error at tools/lldb/cmake_install.cmake:44 (file):
  file INSTALL cannot find                                                        "/usr/local/poudriere/ports/brooks/devel/llvm-devel/work/Releasebuild/Release/lib/python3Release7/site-packages/lldb/..":          
  No such file or directory.                                                    Call Stack (most recent call first):
  tools/cmake_install.cmake:45 (include)     
  cmake_install.cmake:67 (include)

Note the python3Release7.

This originates from this generated snippet in tools/lldb/cmake_install.cmake:

if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xlldb-python-scriptsx" OR NOT CMAKE_INSTALL_COMPONENT)
  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/python3${CMAKE_INSTALL_CONFIG_NAME}7/site-packages" TYPE DIRECTORY FILES "/usr/local/poudriere/ports/brooks/devel/llvm-devel/work/${CMAKE_INSTALL_CONFIG_NAME}build/${CMAKE_INSTALL_CONFIG_NAME}/lib/python3${CMAKE_INSTALL_CONFIG_NAME}7/site-packages/lldb/../")
endif()

Please revert.

Hey Brooks, do you have a public buildbot so I can try to fix it? What generator are you using?

brooks added a subscriber: emaste.Mar 27 2020, 3:42 PM

The generator is Ninja. @emaste may know of a buildbot. Note that this is an install failure so I'm not sure if buildbots will catch it.

NathanielMcVicar added a comment.EditedMar 27 2020, 3:53 PM

Hey Brooks, do you have a public buildbot so I can try to fix it? What generator are you using?

We are also experiencing a similar install failure on Ubuntu. Unfortunately we don't have a lldb buildbot for this platform either. I should have spoken up sooner!

-- Installing: /vstsdrive/_work/7/a/LLVMToolchain/include/lldb/Host/Config.h
CMake Error at tools/lldb/cmake_install.cmake:49 (file):
  file INSTALL cannot find
  "/vstsdrive/_work/7/b/llvm/Release/lib/python2Release7/dist-packages/lldb/..".
Call Stack (most recent call first):
  tools/cmake_install.cmake:50 (include)
  cmake_install.cmake:72 (include)

edit: The line number differences are due to local branch. Unfortunately we don't even get this far on master currently.

Doing a bit of naive digging suggests to me that putting this section inside an

if (NOT CMAKE_CFG_INTDIR STREQUAL  ".")

might do the trick.

Doing a bit of naive digging suggests to me that putting this section inside an

if (NOT CMAKE_CFG_INTDIR STREQUAL  ".")

might do the trick.

I can reproduce this with the Ninja standalone build. Brooks' suggestion indeed fixes it. Thanks!

Fixed by 823dbb4c748feaae6f20637efd0de159dd156c69.