Skip to content

Build hwloc via ExternalProject_Add instead of raw add_custom_command - #1585

Merged
lukaszstolarczuk merged 2 commits into
oneapi-src:mainfrom
wenju-he:hwloc-external-project-add
Jul 8, 2026
Merged

Build hwloc via ExternalProject_Add instead of raw add_custom_command#1585
lukaszstolarczuk merged 2 commits into
oneapi-src:mainfrom
wenju-he:hwloc-external-project-add

Conversation

@wenju-he

@wenju-he wenju-he commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

The static-hwloc autotools build (FetchContent + hand-written add_custom_command chain for autogen.sh/configure/make/make install) never forwarded CC/CXX to hwloc's ./configure, so it silently picked up the ambient host compiler instead of the one CMake was configured to use (e.g. icpx under a sysroot- or toolchain-file-pinned build), risking an ABI mismatch against the rest of the build.

Switch to ExternalProject_Add, which fetches/patches/configures/builds/ installs hwloc as a single well-defined external project step and lets us explicitly pass CC/CXX through to configure. The Coverity security patch, previously applied via a post-FetchContent execute_process(), now runs through ExternalProject's PATCH_COMMAND for the non-Windows path.

Description

Checklist

  • [x ] Code compiles without errors locally on Linux
  • [x ] ninja test pass locally on Linux
  • CI workflows execute properly

The static-hwloc autotools build (FetchContent + hand-written
add_custom_command chain for autogen.sh/configure/make/make install) never
forwarded CC/CXX to hwloc's ./configure, so it silently picked up the
ambient host compiler instead of the one CMake was configured to use
(e.g. icpx under a sysroot- or toolchain-file-pinned build), risking an
ABI mismatch against the rest of the build.

Switch to ExternalProject_Add, which fetches/patches/configures/builds/
installs hwloc as a single well-defined external project step and lets
us explicitly pass CC/CXX through to configure. The Coverity security
patch, previously applied via a post-FetchContent execute_process(), now
runs through ExternalProject's PATCH_COMMAND for the non-Windows path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@wenju-he
wenju-he marked this pull request as ready for review July 8, 2026 07:03
@wenju-he
wenju-he requested a review from a team as a code owner July 8, 2026 07:03

@lukaszstolarczuk lukaszstolarczuk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lukaszstolarczuk
lukaszstolarczuk merged commit a190c7c into oneapi-src:main Jul 8, 2026
75 checks passed
@wenju-he
wenju-he deleted the hwloc-external-project-add branch July 8, 2026 21:47
lukaszstolarczuk pushed a commit that referenced this pull request Jul 27, 2026
…1597)

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 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants