From 84c6c7fbdc6116b98a6d19b5c52178a2719417d0 Mon Sep 17 00:00:00 2001 From: Axel Garcia Date: Tue, 1 Sep 2026 11:57:42 +0200 Subject: [PATCH] BUG: Avoid re-extracting the ITK build cache for module dependencies When building a module that depends on another ITK module (e.g. RTK depends on ITKCudaCommon), the ITK build cache is downloaded and extracted once in the parent directory. build-module-deps.sh then symlinks the module directory to that cache (ITKPythonPackage -> ../ITKPythonPackage) and used to re-run the full download-and-extract flow inside the module directory. Re-extracting in the module directory was problematic for two reasons: - Redundant: the same cache was just extracted in the parent directory with the same arguments, and the module directory writes through the symlink into that same shared tree. - Recent GNU tar (openat2 jailification, e.g. Ubuntu tar 1.35+dfsg-4ubuntu0.2+) fails with 'Invalid cross-device link' (EXDEV) when extracting members under ITKPythonPackage/ because the symlink escapes the extraction root. The module dependency build also registers the module (e.g. CudaCommon) into the shared ITK build tree (ITK_DIR) it builds against, so the registration must land in the tree the parent build reuses afterwards. Building against a module-local copy instead of the shared tree breaks serial module dependencies. Fix: when the parent already holds the extracted cache, build the module directly against the shared tree with dockcross-manylinux-build-module-wheels.sh, without re-extracting it. When no cache is available (standalone use of build-module-deps.sh), keep the full download-and-extract-and-build path. --- scripts/dockcross-manylinux-build-module-deps.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/dockcross-manylinux-build-module-deps.sh b/scripts/dockcross-manylinux-build-module-deps.sh index dede51d3..0f9342d3 100755 --- a/scripts/dockcross-manylinux-build-module-deps.sh +++ b/scripts/dockcross-manylinux-build-module-deps.sh @@ -66,10 +66,13 @@ for MODULE_INFO in ${ITK_MODULE_PREQ_TOPLEVEL//:/ }; do if [[ -d ../ITKPythonPackage ]]; then ln -s ../ITKPythonPackage ln -s ./ITKPythonPackage/oneTBB-prefix + # Cache has already been downloaded, just build + ./ITKPythonPackage/scripts/dockcross-manylinux-build-module-wheels.sh "$@" + else + # No cache available, download it and build + echo "Building module dependency ${MODULE_NAME}" + ./dockcross-manylinux-download-cache-and-build-module-wheels.sh "$@" fi - - echo "Building module dependency ${MODULE_NAME}" - ./dockcross-manylinux-download-cache-and-build-module-wheels.sh "$@" popd echo "Cleaning up module dependency"