[all-commits] [llvm/llvm-project] f6ce39: [lldb] Remove tools copied into LLDB.framework bef...

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Tue Jan 10 11:23:00 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f6ce39cf1d1d80699e13cd1422f60d428e5cf0ec
      https://github.com/llvm/llvm-project/commit/f6ce39cf1d1d80699e13cd1422f60d428e5cf0ec
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2023-01-10 (Tue, 10 Jan 2023)

  Changed paths:
    M lldb/cmake/modules/AddLLDB.cmake
    M lldb/cmake/modules/LLDBConfig.cmake
    M lldb/source/API/CMakeLists.txt

  Log Message:
  -----------
  [lldb] Remove tools copied into LLDB.framework before install

CMake supports building Framework bundles for Apple platforms. We rely
on this functionality to create LLDB.framework. From CMake's
perspective, a framework is associated with a single target. In reality,
this is often not the case. In addition to a main library (liblldb) the
frameworks often contains associated resources that are their own CMake
targets, such as debugserver and lldb-argdumper.

When building and using the framework to run the test suite, those
binaries are expected to be in LLDB.framework. We have a function
(lldb_add_to_buildtree_lldb_framework) that copies those targets into
the framework.

When CMake installs a framework, it copies over the content of the
framework directory and "installs" the associated target. In addition to
copying the target, installing also means updating the RPATH. However,
the RPATH is only updated for the target associated with the framework.
Everything else is naively copied over, including executables or
libraries that have a different build and install RPATH. This means that
those tools need to have their own install rules.

If the framework is installed first, the aforementioned tools are copied
over with build RPATHs from the build tree. And when the tools
themselves are installed, the binaries get overwritten and the RPATHs
updated to the install RPATHs.

The problem is that CMake provides no guarantees when it comes to the
order in which components get installed. If those tools get installed
first, the inverse happens and the binaries get overwritten with the
ones that have build RPATHs.

lldb_add_to_buildtree_lldb_framework has a comment correctly stating
that those copied binaries should be removed before install. This patch
adds a custom target (lldb-framework-cleanup) that will be run before
the install phase and remove those files from LLDB.framework in the
build tree.

Differential revision: https://reviews.llvm.org/D141021




More information about the All-commits mailing list