Repository navigation
Fix OPENMP CMake build: generate Branch/func.c instead of assuming it exists - #684
Merged
jeffhammond merged 3 commits intoOct 10, 2026
Merged
Conversation
… exists CMake configure failed with "Cannot find source file: Branch/func.c" and "No SOURCES given to target: openmp_branch" because func.c is not checked into the repo -- it's generated at build time by ./func_gen, same as SERIAL/Branch. The OPENMP CMakeLists.txt incorrectly assumed it was checked in. Mirror the working SERIAL/CMakeLists.txt pattern: add a custom command that runs func_gen into the build directory and compile the generated file directly. Fixes ParRes#680 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Closed
…executable names Once the previous commit let CMake get past configure/compile on macOS (verified with Homebrew GCC 16, since AppleClang has no OpenMP support), linking failed: "ld: open() failed, errno=21 (Is a directory)" for both stencil and branch. The Stencil/Branch generated-sources directories live directly under the build root as "Stencil"/"Branch", which collides case-insensitively with the "stencil"/"branch" executable OUTPUT_NAME on macOS's default case-insensitive APFS. Renamed the generated dirs to "Stencil_gen"/"Branch_gen". Verified: cmake -S . -B build -DCMAKE_C_COMPILER=$(brew --prefix gcc)/bin/gcc-16 && cmake --build build && ctest 14/15 kernels build and pass; the sole failure (openmp_refcount, missing _omp_init_lock_with_hint in this libgomp) is pre-existing and unrelated. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ENMP, MPIRMA, MPISHM, SHMEM
The Stencil/Branch/AMR generated-sources-directory collision fixed for
OPENMP in the previous commit is the same copy-pasted pattern in every
other CMake-ported language directory: each one's generated dir sat
directly under the build root named "Stencil" (or "Branch"/"AMR" for
SERIAL and MPI1), colliding case-insensitively on macOS's default APFS
with the "stencil"/"branch"/"amr" executable OUTPUT_NAME, which fails the
link step with "ld: open() failed, errno=21 (Is a directory)". Renamed
all of them to "Stencil_gen"/"Branch_gen"/"AMR_gen", matching the OPENMP
fix. C1z, Cxx11, and FORTRAN don't use this generated-.incl-file pattern,
so they're unaffected.
Verified on macOS (AppleClang for SERIAL/MPI1/MPIRMA/MPISHM, Homebrew GCC
16 for MPIOPENMP since AppleClang has no OpenMP support):
- SERIAL: full build + `ctest` -- 14/14 kernels pass, including
stencil, amr, and branch.
- MPI1: stencil/amr/branch targets compile and link cleanly (execution
via mpiexec and direct MPI_Init both fail in this sandbox on local
socket/NIC operations -- a sandbox network restriction, not a build
defect; the CMake fix itself is confirmed by successful linking).
- MPIRMA, MPISHM, MPIOPENMP: stencil target compiles and links cleanly.
- SHMEM: fix applied identically; not build-verified here since no
OpenSHMEM implementation (e.g. Sandia OpenSHMEM) is installed in this
environment.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CMake configure failed with "Cannot find source file: Branch/func.c" and "No SOURCES given to target: openmp_branch" because func.c is not checked into the repo -- it's generated at build time by ./func_gen, same as SERIAL/Branch. The OPENMP CMakeLists.txt incorrectly assumed it was checked in. Mirror the working SERIAL/CMakeLists.txt pattern: add a custom command that runs func_gen into the build directory and compile the generated file directly.
Fixes #680