From f905e0e1e9c319fda73d832864b1eae9437dc0cf Mon Sep 17 00:00:00 2001 From: Wenju He Date: Mon, 27 Jul 2026 09:38:33 +0200 Subject: [PATCH 1/3] Propagate CMAKE_SYSROOT/gcc-toolchain into hwloc's autotools CC/CXX PR #1585 forwards CC=${CMAKE_C_COMPILER}/CXX=${CMAKE_CXX_COMPILER} into hwloc's ExternalProject_Add autogen.sh/configure invocation, but those are bare compiler paths with no notion of CMAKE_SYSROOT or CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN. When UMF_LINK_HWLOC_STATICALLY is combined with a sysroot- or toolchain-file-pinned compiler, hwloc still ends up built against the host's headers/libs instead of the sysroot's, which can produce ABI mismatches (e.g. undefined glibc symbols) at final link time. CC/CXX are passed to autotools as space-separated "compiler [flags...]" strings (the same convention as CC="ccache gcc"), so --sysroot and --gcc-toolchain can be appended directly without needing wrapper scripts or touching CMAKE_C_COMPILER/CMAKE_CXX_COMPILER themselves. Co-Authored-By: Claude Sonnet 5 --- CMakeLists.txt | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe6599d6c..7181c3c4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -329,7 +329,25 @@ if(UMF_LINK_HWLOC_STATICALLY) # ./configure invocation below, so hwloc would otherwise be built with # the ambient host compiler instead of the one CMake was configured to # use (e.g. a sysroot- or toolchain-file-pinned compiler), causing an - # ABI mismatch against the rest of the build. + # ABI mismatch against the rest of the build. CC/CXX are passed as + # space-separated "compiler [flags...]" strings (like CC="ccache gcc"), + # so --sysroot/--gcc-toolchain can be appended directly; make word-splits + # them unquoted when invoking the compiler. + set(UMF_HWLOC_CC "${CMAKE_C_COMPILER}") + set(UMF_HWLOC_CXX "${CMAKE_CXX_COMPILER}") + if(CMAKE_SYSROOT) + string(APPEND UMF_HWLOC_CC " --sysroot=${CMAKE_SYSROOT}") + string(APPEND UMF_HWLOC_CXX " --sysroot=${CMAKE_SYSROOT}") + endif() + if(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN) + string(APPEND UMF_HWLOC_CC + " --gcc-toolchain=${CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN}") + endif() + if(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) + string(APPEND UMF_HWLOC_CXX + " --gcc-toolchain=${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}") + endif() + ExternalProject_Add( hwloc_targ PREFIX ${hwloc_targ_PREFIX} @@ -338,11 +356,11 @@ if(UMF_LINK_HWLOC_STATICALLY) UPDATE_DISCONNECTED TRUE PATCH_COMMAND git apply ${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch - CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} - CXX=${CMAKE_CXX_COMPILER} /autogen.sh + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env "CC=${UMF_HWLOC_CC}" + "CXX=${UMF_HWLOC_CXX}" /autogen.sh COMMAND - ${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} - CXX=${CMAKE_CXX_COMPILER} /configure + ${CMAKE_COMMAND} -E env "CC=${UMF_HWLOC_CC}" + "CXX=${UMF_HWLOC_CXX}" /configure --prefix= --enable-static=yes --enable-shared=no --disable-libxml2 --disable-pci --disable-levelzero --disable-opencl --disable-cuda --disable-nvml --disable-libudev From 4b596c8e503c25ab42fa58b4d13ecd698565a1b3 Mon Sep 17 00:00:00 2001 From: Wenju He Date: Mon, 27 Jul 2026 10:00:47 +0200 Subject: [PATCH 2/3] format code --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7181c3c4f..8d4a6118a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -331,8 +331,8 @@ if(UMF_LINK_HWLOC_STATICALLY) # use (e.g. a sysroot- or toolchain-file-pinned compiler), causing an # ABI mismatch against the rest of the build. CC/CXX are passed as # space-separated "compiler [flags...]" strings (like CC="ccache gcc"), - # so --sysroot/--gcc-toolchain can be appended directly; make word-splits - # them unquoted when invoking the compiler. + # so --sysroot/--gcc-toolchain can be appended directly; make + # word-splits them unquoted when invoking the compiler. set(UMF_HWLOC_CC "${CMAKE_C_COMPILER}") set(UMF_HWLOC_CXX "${CMAKE_CXX_COMPILER}") if(CMAKE_SYSROOT) From 37666e8895acfad4b35dc7fee8233050ad0ad9c7 Mon Sep 17 00:00:00 2001 From: Lukasz Stolarczuk Date: Mon, 27 Jul 2026 11:25:15 +0200 Subject: [PATCH 3/3] test nightly --- .github/workflows/nightly.yml | 1 + .github/workflows/pr_push.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0609fef70..641a354f0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -6,6 +6,7 @@ on: workflow_dispatch: schedule: - cron: '0 4 * * *' + pull_request: permissions: contents: read diff --git a/.github/workflows/pr_push.yml b/.github/workflows/pr_push.yml index fffdc7373..633fbe7c9 100644 --- a/.github/workflows/pr_push.yml +++ b/.github/workflows/pr_push.yml @@ -6,7 +6,7 @@ on: push: branches-ignore: - 'dependabot/**' - pull_request: + # pull_request: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}