Skip to content

CMake: restore PLAT so EXAMPLE/ and TESTING/ link the built library - #35

Merged
xiaoyeli merged 1 commit into
masterfrom
claude/nifty-noether-m4f0vh
Oct 5, 2026
Merged

xiaoyeli merged 1 commit into
masterfrom
claude/nifty-noether-m4f0vh

Conversation

@xiaoyeli

@xiaoyeli xiaoyeli commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Problem

The default CMake build fails (e.g. this CI run):

[  2%] Linking C executable pclinsol
/usr/bin/ld: cannot find -lsuperlu_mt: No such file or directory
make[2]: *** [EXAMPLE/CMakeFiles/pclinsol.dir/build.make:101: EXAMPLE/pclinsol] Error 1

Commit b121cf0 ("Add option THREAD_API …") replaced the PLAT cache variable with THREAD_API, and SRC/ now builds superlu_mt_PTHREAD and/or superlu_mt_OPENMP. But EXAMPLE/CMakeLists.txt and TESTING/MATGEN/CMakeLists.txt still do target_link_libraries(... superlu_mt${PLAT}). With PLAT unset this resolves to superlu_mt, which is not a target. CMake therefore passes a raw -lsuperlu_mt to the linker and adds no build dependency on the library, so linking fails.

Fix

The top-level CMakeLists.txt now sets PLAT from THREAD_API: _OPENMP for OPENMP, and _PTHREAD for PTHREAD or BOTH. The examples and tests then link the real library target again. No other files change.

Testing

Locally (GCC, reference BLAS), with the CI flags -Wall -Wextra -Wpedantic:

THREAD_API build ctest
PTHREAD (default, what CI runs) OK 48/48 pass
BOTH OK 48/48 pass
OPENMP OK 48/48 pass on most runs; see note

Note: with THREAD_API=OPENMP, pztest_4_10_2_100000000_LA failed once in about 6 full runs (z_div: division by zero, info 10). It looks like a nondeterministic issue in the OpenMP code path itself, not in this build fix. Before this change that configuration did not link at all. CI does not exercise it.

🤖 Generated with Claude Code

https://claude.ai/code/session_017GsYX7J15S6uvtUoRMWYwi


Generated by Claude Code

Commit b121cf0 replaced the PLAT cache variable with THREAD_API, but
EXAMPLE/CMakeLists.txt and TESTING/MATGEN/CMakeLists.txt still link
against superlu_mt${PLAT}. With PLAT unset this became "superlu_mt",
which is not a target, so CMake passed a raw -lsuperlu_mt to the linker
and added no build dependency on the library, breaking the default build:

  /usr/bin/ld: cannot find -lsuperlu_mt: No such file or directory

Derive PLAT from THREAD_API (_OPENMP for OPENMP, otherwise _PTHREAD) so
examples and tests link the actual superlu_mt_PTHREAD/_OPENMP target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GsYX7J15S6uvtUoRMWYwi
@xiaoyeli
xiaoyeli merged commit 1acad87 into master Oct 5, 2026
2 checks passed
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.

2 participants