From e92dc4cf8cdc0f364f589facc3b3118c4f9cb4ce Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Fri, 29 Nov 2024 19:41:21 +0000 Subject: [PATCH 1/8] Update cling in ci to version 1.1 using root llvm 16 --- .github/workflows/ci.yml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 293bfd42b..3e0b9acce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,12 +53,12 @@ jobs: cppyy: On llvm_enable_projects: "clang" llvm_targets_to_build: "host;NVPTX" - - name: ubu22-x86-gcc9-clang13-cling + - name: ubu22-x86-gcc9-clang16-cling os: ubuntu-22.04 - compiler: gcc-9 - clang-runtime: '13' + compiler: gcc-12 + clang-runtime: '16' cling: On - cling-version: '1.0' + cling-version: '1.1' cppyy: On llvm_enable_projects: "clang" llvm_targets_to_build: "host;NVPTX" @@ -118,12 +118,12 @@ jobs: cppyy: On llvm_enable_projects: "clang" llvm_targets_to_build: "host;NVPTX" - - name: osx14-arm-clang-clang13-cling + - name: osx14-arm-clang-clang16-cling os: macos-14 compiler: clang - clang-runtime: '13' + clang-runtime: '16' cling: On - cling-version: '1.0' + cling-version: '1.1' cppyy: On llvm_enable_projects: "clang" llvm_targets_to_build: "host;NVPTX" @@ -159,12 +159,12 @@ jobs: cppyy: On llvm_enable_projects: "clang" llvm_targets_to_build: "host;NVPTX" - - name: osx13-x86-clang-clang13-cling + - name: osx13-x86-clang-clang16-cling os: macos-13 compiler: clang - clang-runtime: '13' + clang-runtime: '16' cling: On - cling-version: '1.0' + cling-version: '1.1' cppyy: On llvm_enable_projects: "clang" llvm_targets_to_build: "host;NVPTX" @@ -552,12 +552,12 @@ jobs: clang-runtime: '16' cling: Off cppyy: Off - - name: ubu22-x86-gcc9-clang13-cling-cppyy + - name: ubu22-x86-gcc9-clang16-cling-cppyy os: ubuntu-22.04 - compiler: gcc-9 - clang-runtime: '13' + compiler: gcc-12 + clang-runtime: '16' cling: On - cling-version: '1.0' + cling-version: '1.1' cppyy: On #FIXME: Windows CppInterOp tests expected to fail #until https://github.com/compiler-research/CppInterOp/issues/188 is solved @@ -609,12 +609,12 @@ jobs: clang-runtime: '16' cling: Off cppyy: Off - - name: osx14-arm-clang-clang13-cling-cppyy + - name: osx14-arm-clang-clang16-cling-cppyy os: macos-14 compiler: clang - clang-runtime: '13' + clang-runtime: '16' cling: On - cling-version: '1.0' + cling-version: '1.1' cppyy: On - name: osx13-x86-clang-clang-repl-19-cppyy os: macos-13 @@ -640,12 +640,12 @@ jobs: clang-runtime: '16' cling: Off cppyy: Off - - name: osx13-x86-clang-clang13-cling-cppyy + - name: osx13-x86-clang-clang16-cling-cppyy os: macos-13 compiler: clang - clang-runtime: '13' + clang-runtime: '16' cling: On - cling-version: '1.0' + cling-version: '1.1' cppyy: On steps: From bb10c03a00b357b84807ec2a6ffaa201f0e35324 Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Fri, 29 Nov 2024 20:28:18 +0000 Subject: [PATCH 2/8] Only build gtest_main for cling llvm=13 ci --- .github/workflows/ci.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e0b9acce..37009fb80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -392,8 +392,10 @@ jobs: ../llvm cmake --build . --target clang --parallel ${{ env.ncpus }} cmake --build . --target cling --parallel ${{ env.ncpus }} - # Now build gtest.a and gtest_main for CppInterOp to run its tests. - cmake --build . --target gtest_main --parallel ${{ env.ncpus }} + if [[ "${{ matrix.clang-runtime}}" == "13" ]]; then + # Now build gtest.a and gtest_main for CppInterOp to run its tests. + cmake --build . --target gtest_main --parallel ${{ env.ncpus }} + fi else # Apply patches llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]') @@ -466,8 +468,12 @@ jobs: ..\llvm cmake --build . --config Release --target clang --parallel ${{ env.ncpus }} cmake --build . --config Release --target cling --parallel ${{ env.ncpus }} - # Now build gtest.a and gtest_main for CppInterOp to run its tests. - cmake --build . --config Release --target gtest_main --parallel ${{ env.ncpus }} + if ( "${{ matrix.clang-runtime }}" -imatch "13" ) + { + # cling version 1.0 with llvm 13 doesn't work on Windows, but this is here in + # case someone finds a way to fix this + cmake --build . --config Release --target gtest_main --parallel ${{ env.ncpus }} + } } else { From 05f25441cb24e70a8bcba9211e10d0ab224f23fe Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Fri, 29 Nov 2024 22:01:35 +0000 Subject: [PATCH 3/8] Disable CUDA tests for Cling --- unittests/CppInterOp/CUDATest.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/unittests/CppInterOp/CUDATest.cpp b/unittests/CppInterOp/CUDATest.cpp index ea171b46e..aafb7505f 100644 --- a/unittests/CppInterOp/CUDATest.cpp +++ b/unittests/CppInterOp/CUDATest.cpp @@ -9,7 +9,10 @@ using namespace TestUtils; static bool HasCudaSDK() { auto supportsCudaSDK = []() { -#if CLANG_VERSION_MAJOR < 16 +#ifdef USE_CLING +// FIXME: Enable this for cling. + return false; +#elif CLANG_VERSION_MAJOR < 16 // FIXME: Enable this for cling. return false; #endif // CLANG_VERSION_MAJOR < 16 @@ -23,7 +26,10 @@ static bool HasCudaSDK() { static bool HasCudaRuntime() { auto supportsCuda = []() { -#if CLANG_VERSION_MAJOR < 16 +#ifdef USE_CLING +// FIXME: Enable this for cling. + return false; +#elif CLANG_VERSION_MAJOR < 16 // FIXME: Enable this for cling. return false; #endif //CLANG_VERSION_MAJOR < 16 @@ -43,6 +49,8 @@ static bool HasCudaRuntime() { #if CLANG_VERSION_MAJOR < 16 TEST(DISABLED_CUDATest, Sanity) { +#elif USE_CLING +TEST(DISABLED_CUDATest, Sanity) { #else TEST(CUDATest, Sanity) { #endif // CLANG_VERSION_MAJOR < 16 From 0d9e21d793610c36d39516501a3a3a0364514ccd Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Sat, 30 Nov 2024 23:12:31 +0000 Subject: [PATCH 4/8] Apply patch needed to fix error handling for cling version 1.1 --- .github/workflows/ci.yml | 24 +++++++++++++++------ patches/llvm/cling16-1-Error-Handling.patch | 17 +++++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 patches/llvm/cling16-1-Error-Handling.patch diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37009fb80..1422f344a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -366,6 +366,13 @@ jobs: git clone https://github.com/root-project/cling.git cd ./cling git checkout tags/v${{ matrix.cling-version }} + # Apply patches + llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]') + if [[ "${llvm_vers}" == "16" ]]; then + # cling version 1.1 with llvm 16 requires a patch to fix error handling when parsing invaild code + git apply -v ../patches/llvm/cling${{ matrix.clang-runtime }}-*.patch + echo "Apply cling${{ matrix.clang-runtime }}-*.patch patches:" + fi cd .. git clone --depth=1 -b cling-llvm${{ matrix.clang-runtime }} https://github.com/root-project/llvm-project.git else # repl @@ -435,6 +442,11 @@ jobs: git clone https://github.com/root-project/cling.git cd ./cling git checkout tags/v${{ matrix.cling-version }} + if ( "${{ matrix.clang-runtime }}" -imatch "16" ) + { + # cling version 1.1 with llvm 16 requires a patch to fix error handling when parsing invaild code + git apply -v clang16-1-Error-Handling.patch + } cd .. git clone --depth=1 -b cling-llvm${{ matrix.clang-runtime }} https://github.com/root-project/llvm-project.git $env:PWD_DIR= $PWD.Path @@ -558,13 +570,13 @@ jobs: clang-runtime: '16' cling: Off cppyy: Off - - name: ubu22-x86-gcc9-clang16-cling-cppyy + - name: ubu22-x86-gcc9-clang16-cling os: ubuntu-22.04 compiler: gcc-12 clang-runtime: '16' cling: On cling-version: '1.1' - cppyy: On + cppyy: Off #FIXME: Windows CppInterOp tests expected to fail #until https://github.com/compiler-research/CppInterOp/issues/188 is solved - name: win2022-msvc-clang-repl-19 @@ -615,13 +627,13 @@ jobs: clang-runtime: '16' cling: Off cppyy: Off - - name: osx14-arm-clang-clang16-cling-cppyy + - name: osx14-arm-clang-clang16-cling os: macos-14 compiler: clang clang-runtime: '16' cling: On cling-version: '1.1' - cppyy: On + cppyy: Off - name: osx13-x86-clang-clang-repl-19-cppyy os: macos-13 compiler: clang @@ -646,13 +658,13 @@ jobs: clang-runtime: '16' cling: Off cppyy: Off - - name: osx13-x86-clang-clang16-cling-cppyy + - name: osx13-x86-clang-clang16-cling os: macos-13 compiler: clang clang-runtime: '16' cling: On cling-version: '1.1' - cppyy: On + cppyy: Off steps: - uses: actions/checkout@v4 diff --git a/patches/llvm/cling16-1-Error-Handling.patch b/patches/llvm/cling16-1-Error-Handling.patch new file mode 100644 index 000000000..ea6a3aeb8 --- /dev/null +++ b/patches/llvm/cling16-1-Error-Handling.patch @@ -0,0 +1,17 @@ +diff --git a/lib/Interpreter/IncrementalParser.cpp b/lib/Interpreter/IncrementalParser.cpp +index 89cd78d..2aea40d 100644 +--- a/lib/Interpreter/IncrementalParser.cpp ++++ b/lib/Interpreter/IncrementalParser.cpp +@@ -911,8 +911,11 @@ namespace cling { + PP.EnterSourceFile(FID, /*DirLookup*/nullptr, NewLoc); + m_Consumer->getTransaction()->setBufferFID(FID); + +- if (!ParseOrWrapTopLevelDecl()) ++ llvm::Expected res = ParseOrWrapTopLevelDecl(); ++ if (!res) { ++ llvm::consumeError(std::move(res.takeError())); + return kFailed; ++ } + + if (PP.getLangOpts().DelayedTemplateParsing) { + // Microsoft-specific: \ No newline at end of file From dbc5d38133b0a24d7ab638390ec4fa890355e3e9 Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Sat, 30 Nov 2024 23:13:55 +0000 Subject: [PATCH 5/8] Update cling16-1-Error-Handling.patch to add blank line --- patches/llvm/cling16-1-Error-Handling.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/llvm/cling16-1-Error-Handling.patch b/patches/llvm/cling16-1-Error-Handling.patch index ea6a3aeb8..0eb60ed51 100644 --- a/patches/llvm/cling16-1-Error-Handling.patch +++ b/patches/llvm/cling16-1-Error-Handling.patch @@ -14,4 +14,4 @@ index 89cd78d..2aea40d 100644 + } if (PP.getLangOpts().DelayedTemplateParsing) { - // Microsoft-specific: \ No newline at end of file + // Microsoft-specific: From 1055a9c4f371d05d484696b64783e4d7600fe001 Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Sun, 1 Dec 2024 21:59:22 +0000 Subject: [PATCH 6/8] Update job names --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1422f344a..d6f2cb9ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: cppyy: On llvm_enable_projects: "clang" llvm_targets_to_build: "host;NVPTX" - - name: ubu22-x86-gcc9-clang16-cling + - name: ubu22-x86-gcc12-clang16-cling os: ubuntu-22.04 compiler: gcc-12 clang-runtime: '16' @@ -570,7 +570,7 @@ jobs: clang-runtime: '16' cling: Off cppyy: Off - - name: ubu22-x86-gcc9-clang16-cling + - name: ubu22-x86-gcc12-clang16-cling os: ubuntu-22.04 compiler: gcc-12 clang-runtime: '16' From 985fea82afa20efa525b44dd2282e3a96d388dbd Mon Sep 17 00:00:00 2001 From: Vipul Cariappa Date: Mon, 2 Dec 2024 09:18:04 +0530 Subject: [PATCH 7/8] Increase CI debug timeout to 2hrs --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6f2cb9ca..af26c3c39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1149,7 +1149,7 @@ jobs: if: ${{ failure() && runner.debug }} uses: mxschmitt/action-tmate@v3 # When debugging increase to a suitable value! - timeout-minutes: 30 + timeout-minutes: 120 emscripten_wasm_CppInterOp_and_xeus_cpp: needs: [build_cache] From 45d86558c8892cac60ecc11bd4f92a9c4a618509 Mon Sep 17 00:00:00 2001 From: Vipul Cariappa Date: Mon, 2 Dec 2024 16:07:50 +0530 Subject: [PATCH 8/8] build in debug --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af26c3c39..bc899e0d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -241,7 +241,7 @@ jobs: - name: Setup default Build Type on *nux if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }} run: | - echo "BUILD_TYPE=Release" >> $GITHUB_ENV + echo "BUILD_TYPE=Debug" >> $GITHUB_ENV echo "CODE_COVERAGE=0" >> $GITHUB_ENV os="${{ matrix.os }}" if [[ "${os}" == "macos"* ]]; then @@ -387,7 +387,7 @@ jobs: -DLLVM_EXTERNAL_PROJECTS=cling \ -DLLVM_EXTERNAL_CLING_SOURCE_DIR=../../cling \ -DLLVM_TARGETS_TO_BUILD="${{ matrix.llvm_targets_to_build }}" \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DCLANG_ENABLE_STATIC_ANALYZER=OFF \ -DCLANG_ENABLE_ARCMT=OFF \ @@ -728,7 +728,7 @@ jobs: - name: Setup default Build Type on *nux if: runner.os != 'windows' run: | - echo "BUILD_TYPE=Release" >> $GITHUB_ENV + echo "BUILD_TYPE=Debug" >> $GITHUB_ENV echo "CODE_COVERAGE=0" >> $GITHUB_ENV os="${{ matrix.os }}" if [[ "${os}" == "macos"* ]]; then @@ -1212,7 +1212,7 @@ jobs: - name: Setup default Build Type on *nux if: runner.os != 'windows' run: | - echo "BUILD_TYPE=Release" >> $GITHUB_ENV + echo "BUILD_TYPE=Debug" >> $GITHUB_ENV echo "CODE_COVERAGE=0" >> $GITHUB_ENV os="${{ matrix.os }}" if [[ "${os}" == "macos"* ]]; then