Skip to content

BUG: Drop build-machine paths from the installed gdcmConfigure.h - #6877

Merged
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:bug-gdcm-drop-buildpath-macros
Sep 21, 2026
Merged

hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:bug-gdcm-drop-buildpath-macros

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

An installed ITK carried the build machine's source and output directories in the public header include/ITK-6.0/gdcmConfigure.h, two of them holding an unevaluated generator expression. Dropping the three macros leaves an install tree with no reference to the machine that produced it. Fixes #6876.

What the installed header contained
#define GDCM_SOURCE_DIR "/home/<user>/src/ITK/Modules/ThirdParty/GDCM/src/gdcm"
#define GDCM_EXECUTABLE_OUTPUT_PATH "$<1:/home/<user>/build/Wrapping/Generators/Python/itk>"
#define GDCM_LIBRARY_OUTPUT_PATH    "$<1:/home/<user>/build/Wrapping/Generators/Python/itk>"

CMake/WrappingConfigCommon.cmake wraps the output directory in a generator expression so multi-config generators do not append a per-config subdirectory. configure_file does not evaluate generator expressions, so $<1:...> reached the installed header as literal text and the last two macros did not name a real directory on any machine.

Why removing them is safe

GDCM_EXECUTABLE_OUTPUT_PATH and GDCM_LIBRARY_OUTPUT_PATH have no reference anywhere outside the template that defines them.

GDCM_SOURCE_DIR does have consumers, so the reason it can go is different: gdcmTesting.cxx is added to the source list only under if(GDCM_BUILD_TESTING), and the GDCM_SOURCE_DIR use in gdcmGlobal.cxx sits inside #ifdef GDCM_BUILD_TESTING. Modules/ThirdParty/GDCM/src/gdcm/CMakeLists.txt:495 sets GDCM_BUILD_TESTING OFF for a non-standalone GDCM, which is always ITK's case, so neither consumer is ever compiled here.

This patches vendored third-party source, as 4aec5d1 did for this same file.

Verification

Measured on a real install rather than by inspection.

Check Before After
Install files referencing the build tree include/ITK-6.0/gdcmConfigure.h none
GDCM_* path macros in the installed header 3 0
cmake --install <build> --prefix /tmp/itk-verify-prefix
grep -rl "<build>" /tmp/itk-verify-prefix     # no output
  • ctest -R "GDCM|gdcm" — 103/103 passed.
  • gdcmCommon, gdcmDICT, gdcmDSED, gdcmMSFF, ITKIOGDCM rebuilt: 0 warnings, 0 errors.
  • pre-commit run --all-files — exit 0.
Remaining, not addressed here

After this change include/ITK-6.0/vcl_where_root_dir.h is the only file in a clean install that names a path on the build machine, via VCL_SOURCE_ROOT_DIR. It is a separate concern in vendored VXL with a different shape, since its consumer is compiled unconditionally, and it belongs in its own change against the VXL fork.

@github-actions github-actions Bot added type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances area:ThirdParty Issues affecting the ThirdParty module labels Sep 20, 2026
@hjmjohnson
hjmjohnson marked this pull request as ready for review September 20, 2026 21:36
@greptile-apps

greptile-apps Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

Safe to merge.

Summary

The GDCM configuration template keeps the upstream path macro definitions in a clearly marked, inactive ITK block. The generated header therefore does not expose build-machine source or output paths while retaining upstream context for future synchronization.

Reviews (2) · Last reviewed commit: "BUG: Drop build-machine paths from the i..."

Comment thread Modules/ThirdParty/GDCM/src/gdcm/Source/Common/gdcmConfigure.h.in
The installed header recorded the build machine's source and output
directories, and configure_file does not evaluate the generator
expression that CMAKE_RUNTIME_OUTPUT_DIRECTORY carries in a wrapping
build, so two of the macros held literal $<1:...> text.

The macros have no reader in an ITK build: gdcmTesting.cxx compiles only
under GDCM_BUILD_TESTING, the GDCM_SOURCE_DIR use in gdcmGlobal.cxx sits
behind the same guard, and a non-standalone GDCM forces that option off.

A BEGIN ITK / END ITK block keeps the upstream lines in place under
#if 0 so a later update conflicts on recognizable text. Each opening
substitution token is broken, since configure_file expands them inside
a disabled block as readily as anywhere else.
@hjmjohnson
hjmjohnson force-pushed the bug-gdcm-drop-buildpath-macros branch from 33bfda3 to d358549 Compare September 21, 2026 10:35
@hjmjohnson

Copy link
Copy Markdown
Member Author

@greptileai please re-review — the patch now keeps the upstream lines under #if 0 inside a BEGIN ITK / END ITK block rather than replacing them; the prior review covered e8c3886.

@hjmjohnson
hjmjohnson requested a review from dzenanz September 21, 2026 14:01
@hjmjohnson hjmjohnson self-assigned this Sep 21, 2026
@hjmjohnson
hjmjohnson merged commit 580d670 into InsightSoftwareConsortium:main Sep 21, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ThirdParty Issues affecting the ThirdParty module type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installed gdcmConfigure.h leaks build-machine paths and an unevaluated generator expression

2 participants