From b822ef164ac7affc4abb9dff4eb7c4f97749f673 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 15 Oct 2026 06:42:03 +0000 Subject: [PATCH 1/2] Add riscv64 build for clangd Builds clangd (jmpfar/clangd-wheel), the LSP server bundled from a from-source LLVM+clang+clang-tools-extra compile, modeled on build-clang-tidy.yml (same scikit-build-core + cibuildwheel + manylinux_riscv64 lineage: clangd-wheel is a fork of clang-tidy-wheel). Preemptively installs lld and caps CMAKE_BUILD_PARALLEL_LEVEL, since build-circt.yml already hit this runner's RAM ceiling linking an unrestricted-LLVM-target binary and clangd-wheel's own CMakeLists.txt leaves LLVM_TARGETS_TO_BUILD at upstream's default (all targets) too. --- .github/workflows/build-clangd.yml | 120 +++++++++++++++++++++++++++++ docs/packages/clangd.yaml | 5 ++ 2 files changed, 125 insertions(+) create mode 100644 .github/workflows/build-clangd.yml create mode 100644 docs/packages/clangd.yaml diff --git a/.github/workflows/build-clangd.yml b/.github/workflows/build-clangd.yml new file mode 100644 index 000000000000..713e7776e9ba --- /dev/null +++ b/.github/workflows/build-clangd.yml @@ -0,0 +1,120 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on: https://github.com/jmpfar/clangd-wheel/blob/main/.github/workflows/build.yml +name: Build clangd wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/clangd.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-clangd.yml' + - 'docs/packages/clangd.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-clangd.yml' + - 'docs/packages/clangd.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: clangd + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + name: Build clangd ${{ matrix.version }} py2.py3-none-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 1440 # full LLVM+clang+clang-tools-extra compile from source + + env: + CLANGD_VERSION: ${{ matrix.version }} + + steps: + # jmpfar/clangd-wheel tags as v...; + # scikit-build-core's own version regex (pyproject.toml) drops a trailing + # ".0" revision, so a pending 3-component version maps back to ".0". + - name: Resolve clangd-wheel tag for ${{ env.CLANGD_VERSION }} + id: tag + run: | + version="${CLANGD_VERSION}" + if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "tag=v${version}.0" >> "$GITHUB_OUTPUT" + else + echo "tag=v${version}" >> "$GITHUB_OUTPUT" + fi + + - name: Checkout clangd-wheel ${{ steps.tag.outputs.tag }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: jmpfar/clangd-wheel + ref: ${{ steps.tag.outputs.tag }} + persist-credentials: false + + - name: Build wheel + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + # wheel.py-api = "py2.py3", so one build serves every interpreter. + only: cp312-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # Rocky 10 AppStream ships lld matching the image's clang; the ExternalProject_Add + # LLVM sub-build inherits the environment, so LDFLAGS steers its final static + # clangd link onto lld instead of ld.bfd. build-circt.yml hit this runner's 15GB + # RAM ceiling on an unrestricted-target LLVM/MLIR link; clangd's CMakeLists.txt + # likewise leaves LLVM_TARGETS_TO_BUILD at upstream's default (all targets). + CIBW_BEFORE_ALL: dnf -y install lld + # Repeats pyproject.toml's own `environment` table: CIBW_ENVIRONMENT replaces + # rather than merges with it (gotcha 107). + CIBW_ENVIRONMENT: >- + CMAKE_GENERATOR=Ninja + CMAKE_BUILD_PARALLEL_LEVEL=3 + LDFLAGS=-fuse-ld=lld + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: clangd-${{ env.CLANGD_VERSION }}-py2.py3-none-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish clangd ${{ matrix.version }} + needs: [setup, build_wheels] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: clangd-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/clangd.yaml b/docs/packages/clangd.yaml new file mode 100644 index 000000000000..2c3ac06280d3 --- /dev/null +++ b/docs/packages/clangd.yaml @@ -0,0 +1,5 @@ +package-name: clangd +source-code: https://github.com/jmpfar/clangd-wheel +license: Apache-2.0 WITH LLVM-exception +versions: +- version: 22.1.1 From ede3084665c9f79f3950ed2ef7d1a1b5ccf00a16 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 15 Oct 2026 19:31:06 +0000 Subject: [PATCH 2/2] clangd: rename cmake.verbose to build.verbose for scikit-build-core 1.x The first build of 22.1.1 failed in get_requires_for_build_wheel with "Use build.verbose instead of cmake.verbose for scikit-build-core >= 0.10". clangd-wheel leaves scikit-build-core unpinned and still sets the deprecated cmake.verbose; 0.12.x (what upstream last released 22.1.1 with, in March) only warned about it, but 1.x errors out when minimum-version is unset, so build isolation now resolves 1.1.1 and the build stops before CMake runs. This is not riscv64-specific: any fresh build of the tag hits it. Carry a one-line pyproject.toml patch and apply it before cibuildwheel, checking python-wheels out alongside the upstream tree as the other patched workflows do. --- .github/workflows/build-clangd.yml | 11 ++++++ ...-instead-of-the-removed-cmake.verbos.patch | 38 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 patches/clangd/22.1.1/0001-Use-build.verbose-instead-of-the-removed-cmake.verbos.patch diff --git a/.github/workflows/build-clangd.yml b/.github/workflows/build-clangd.yml index 713e7776e9ba..c2c79d858408 100644 --- a/.github/workflows/build-clangd.yml +++ b/.github/workflows/build-clangd.yml @@ -16,11 +16,13 @@ on: paths: - '.github/workflows/build-clangd.yml' - 'docs/packages/clangd.yaml' + - 'patches/clangd/**' push: branches: [main] paths: - '.github/workflows/build-clangd.yml' - 'docs/packages/clangd.yaml' + - 'patches/clangd/**' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -74,6 +76,15 @@ jobs: ref: ${{ steps.tag.outputs.tag }} persist-credentials: false + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + persist-credentials: false + + - name: Patch clangd-wheel source + run: git apply python-wheels/patches/clangd/${{ env.CLANGD_VERSION }}/*.patch + - name: Build wheel uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 with: diff --git a/patches/clangd/22.1.1/0001-Use-build.verbose-instead-of-the-removed-cmake.verbos.patch b/patches/clangd/22.1.1/0001-Use-build.verbose-instead-of-the-removed-cmake.verbos.patch new file mode 100644 index 000000000000..a8c6dd564119 --- /dev/null +++ b/patches/clangd/22.1.1/0001-Use-build.verbose-instead-of-the-removed-cmake.verbos.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Thu, 15 Oct 2026 12:00:00 +0000 +Subject: [PATCH] Use build.verbose instead of the removed cmake.verbose + +scikit-build-core renamed `cmake.verbose` to `build.verbose` in 0.10 and +kept the old key as a deprecation warning through 0.12.x. Starting with +1.0, an unset `minimum-version` turns that warning into a hard error in +get_requires_for_build_wheel: + + ERROR: Use build.verbose instead of cmake.verbose for scikit-build-core >= 0.10 + +`[build-system] requires` leaves scikit-build-core unpinned, so any fresh +build of this tag now resolves 1.x and fails before CMake runs, on every +platform. `build.verbose` exists since 0.10, so the rename keeps working +with the 0.12.x releases upstream last built with. + +Upstream-Status: To upstream [affects every platform's fresh build with scikit-build-core >= 1.0; upstream main still carries cmake.verbose] +--- + pyproject.toml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 765f9f8..9915dac 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -59,7 +59,7 @@ wheel.packages = ["src/clangd"] + wheel.py-api = "py2.py3" + cmake.version = ">=3.16.0" + ninja.version = ">=1.10.0" +-cmake.verbose = true ++build.verbose = true + logging.level = "DEBUG" + + [tool.pytest.ini_options] +-- +2.43.0 +