Repository navigation
Conversation
A standalone build with the bundled NIfTI failed with Ninja: ninja: error: build.ninja:2352: bad $-escape (literal $ must be written as $$) The ExternalProject installed with `$(MAKE) install DESTDIR=...`, which is Makefile syntax. It now runs `cmake --build <BINARY_DIR> --target install` under `cmake -E env DESTDIR=...`; CMake's install scripts read DESTDIR from the environment. That alone moves Ninja to the next error: ninja: error: '.../libniftiio.a', needed by 'libminc2.so.5.3.0', missing and no known rule to make it Make orders minc2 after the ExternalProject from add_dependencies() alone; Ninja also wants a rule that names the file it links. libniftiio.a and libznz.a are now declared as BUILD_BYPRODUCTS (CMake 3.2; libminc requires 3.10), and their paths are set before ExternalProject_Add to use them. The minc-toolkit superbuild uses its own BuildNIFTI.cmake and is not affected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RCrjXCD1KiTWLtah7wmySX
With LIBMINC_BUILD_SHARED_LIBS, libminc also builds minc2_static from the same sources, including input_nifti.c. Only minc2 depended on the NIFTI ExternalProject, so nothing kept minc2_static from compiling before the NIfTI headers were staged. Ninja does exactly that: input_nifti.c:13:10: fatal error: nifti1.h: No such file or directory minc2_static now depends on NIFTI too, when that target exists. In the minc-toolkit superbuild this repeats its own ADD_DEPENDENCIES(minc2_static). Verified on develop-1.9.18 with the previous commit, standalone, NIfTI on: Ninja (shared and static) and Unix Makefiles (shared and static) each configure, build and pass 59/59 tests. A second Ninja build has no work to do. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RCrjXCD1KiTWLtah7wmySX
gdevenyi
marked this pull request as draft
September 21, 2026 19:24
gdevenyi
marked this pull request as ready for review
September 21, 2026 22:08
This was referenced Sep 21, 2026
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.
Why
A standalone libminc build with the bundled NIfTI (
LIBMINC_USE_NIFTI=ON) fails with the Ninja generator. There are three causes, and each one hides the next:bad $-escape (literal $ must be written as $$): the NIfTI ExternalProject installs with$(MAKE) install, which is Makefile syntax.'.../libniftiio.a', needed by 'libminc2.so.5.3.0', missing and no known rule to make it:minc2links the two NIfTI archives, and Ninja needs a rule that makes each file it links.input_nifti.c: fatal error: nifti1.h: No such file or directory(shared builds only):minc2_staticcompilesinput_nifti.c, but onlyminc2waits for the NIfTI build.What
cmake-modules/BuildNIFTI.cmake: install withcmake -E env DESTDIR=... cmake --build <BINARY_DIR> --target install. Declarelibniftiio.aandlibznz.aasBUILD_BYPRODUCTS(CMake 3.2; libminc requires 3.10).CMakeLists.txt:minc2_staticdepends on theNIFTItarget when that target exists.Verification
On this branch, standalone, NIfTI on: Ninja (shared and static) and Unix Makefiles (shared and static) each configure, build and pass 59/59 tests. A second Ninja build has no work to do. CI has no Ninja job, so CI does not check this.
Notes
BuildNIFTI.cmake, so the PR that merges second needs a small rebase. In NIfTI: track the maintained nifti_clib fork, drop the dead vendored copy #152,minc2_staticlinksNIFTI::niftiio, which gives the same ordering as the second commit here.BuildNIFTI.cmake, and it requires Make. This PR does not affect it.🤖 Generated with Claude Code
https://claude.ai/code/session_01RCrjXCD1KiTWLtah7wmySX