[libcxx-commits] [PATCH] D146822: [libc++][CI] Prepares building C++ modules.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 24 09:41:42 PDT 2023


Mordante created this revision.
Herald added a subscriber: arichardson.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

D144994 <https://reviews.llvm.org/D144994> adds modules to libc++. In order to test them some newer and
additional tools are required.

CMake 3.26
This is in combination with Clang 16 or newer makes it possible to
conveniently build modules with CMake. Unfortunately CMake 3.26 in our
setup has an issue with unused linker flags. This causes libunwind not
to compile at all. D145596 <https://reviews.llvm.org/D145596> contains a quick-fix which is in the module
patch. The patch D142957 <https://reviews.llvm.org/D142957> and followups will contain a proper fix.
Therefore install CMake 3.26 in a separate location, allowing to test
the module patch in the CI.

Ninja 1.11
Building modules requires dynamic rules, which requires this version.
This is a CMake 3.26 requirement to use modules. Note that without using
modules CMake still accepts older Ninja versions.

clang-scan-deps (in the tools package)
This tool is used by CMake to get the module dependencies. Note
strictly this currently will only be used for Clang 16 and Clang 17.
Clang 15 and Clang 14 are not needed. They are installed to keep
updating to Clang 18 and later easier.
(In the future we might not test modular build with all Clang versions,
however at the moment the feature is still in development in both Clang
and libc++ so it would be good to detect regressions.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146822

Files:
  libcxx/utils/ci/Dockerfile


Index: libcxx/utils/ci/Dockerfile
===================================================================
--- libcxx/utils/ci/Dockerfile
+++ libcxx/utils/ci/Dockerfile
@@ -36,7 +36,13 @@
 RUN apt-get update && apt-get install -y bash curl
 
 # Install various tools used by the build or the test suite
-RUN apt-get update && apt-get install -y ninja-build python3 python3-sphinx python3-distutils python3-psutil git gdb
+#RUN apt-get update && apt-get install -y ninja-build python3 python3-sphinx python3-distutils python3-psutil git gdb
+# TODO add ninja-build once 1.11 is available in Ubuntu, also remove the manual installation.
+RUN apt-get update && apt-get install -y python3 python3-sphinx python3-distutils python3-psutil git gdb
+RUN apt-get update && apt-get install -y wget && \
+  wget -qO /usr/local/bin/ninja.gz https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip && \
+  gunzip /usr/local/bin/ninja.gz && \
+  chmod a+x /usr/local/bin/ninja
 
 # Install dependencies required to run the LLDB data formatter tests
 RUN apt-get update && apt-get install -y python3 python3-dev libpython3-dev uuid-dev libncurses5-dev swig3.0 libxml2-dev libedit-dev
@@ -66,6 +72,12 @@
 RUN bash /tmp/llvm.sh $(($LLVM_HEAD_VERSION - 1)) # latest release
 RUN bash /tmp/llvm.sh $LLVM_HEAD_VERSION          # current ToT
 
+# Install clang-scan-deps, which is required to build modules; always all supported versions.
+RUN apt-get update && apt-get install -y clang-tools-$(($LLVM_HEAD_VERSION - 3)) \
+                                         clang-tools-$(($LLVM_HEAD_VERSION - 2)) \
+                                         clang-tools-$(($LLVM_HEAD_VERSION - 1)) \
+                                         clang-tools-$LLVM_HEAD_VERSION
+
 # Install clang-format; always use the lastest stable branch.
 RUN apt-get update && apt-get install -y clang-format-$(($LLVM_HEAD_VERSION - 2)) clang-format-$(($LLVM_HEAD_VERSION - 1))
 
@@ -89,6 +101,12 @@
 RUN bash /tmp/install-cmake.sh --prefix=/usr --exclude-subdir --skip-license
 RUN rm /tmp/install-cmake.sh
 
+# Install a newer CMake for modules
+# TODO Remove the duplicated installation when all runtimes can be build with CMake 3.26.
+RUN wget https://github.com/Kitware/CMake/releases/download/v3.26.1/cmake-3.26.1-linux-x86_64.sh -O /tmp/install-cmake.sh
+RUN bash /tmp/install-cmake.sh --prefix=/opt --exclude-subdir --skip-license
+RUN rm /tmp/install-cmake.sh
+
 # Change the user to a non-root user, since some of the libc++ tests
 # (e.g. filesystem) require running as non-root. Also setup passwordless sudo.
 RUN apt-get update && apt-get install -y sudo


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146822.508138.patch
Type: text/x-patch
Size: 2639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230324/730a0175/attachment.bin>


More information about the libcxx-commits mailing list