New extensions can not work on Slicer 5.4.0 on MacOS

To follow up on this issue as well as the one discussed in Fiducial Registration Wizard Module not loading - #5 by Jayme_Goodrum, the root cause of the problem has been identified and fixed.

The patch locally integrated in the build machine source tree was not the one effectively tested and contributed through PR-7181 in main, and PR-7182 in 5.4 maintenance branch.

This has now been addressed :white_check_mark:

Valid stable extensions are expected to be uploaded in the next 12 hours :rocket:

Thanks for your patience :pray:

Details

It was an hard-coded version expected to work only for the Preview source tree and not the Stable source tree.

diff --git a/CMake/SlicerExtensionCPack.cmake b/CMake/SlicerExtensionCPack.cmake
index 842abbb6ff..b65b312d5a 100644
--- a/CMake/SlicerExtensionCPack.cmake
+++ b/CMake/SlicerExtensionCPack.cmake
@@ -193,6 +193,7 @@ if(APPLE)
   set(EXTENSION_BINARY_DIR ${EXTENSION_SUPERBUILD_BINARY_DIR}/${EXTENSION_BUILD_SUBDIRECTORY})
   set(EXTENSION_SUPERBUILD_DIR ${EXTENSION_SUPERBUILD_BINARY_DIR})
   get_filename_component(Slicer_SUPERBUILD_DIR ${Slicer_DIR}/.. ABSOLUTE)
+  set(Slicer_SUPERBUILD_DIR "/Users/svc-dashboard/D/P/A")
 
   #------------------------------------------------------------------------------
   # <ExtensionName>_FIXUP_BUNDLE_LIBRARY_DIRECTORIES

instead the following patch was added:

diff --git a/CMake/SlicerExtensionCPack.cmake b/CMake/SlicerExtensionCPack.cmake
index 842abbb6ff..6adec7bcac 100644
--- a/CMake/SlicerExtensionCPack.cmake
+++ b/CMake/SlicerExtensionCPack.cmake
@@ -194,6 +194,14 @@ if(APPLE)
   set(EXTENSION_SUPERBUILD_DIR ${EXTENSION_SUPERBUILD_BINARY_DIR})
   get_filename_component(Slicer_SUPERBUILD_DIR ${Slicer_DIR}/.. ABSOLUTE)
 
+  # If any, resolve synthetic firmlink  (e.g from "/D/P/A" to "/Users/svc-dashboard/D/P/A")
+  #
+  # Since the output of "otool -L" reports paths with synthetic firmlinks resolved
+  # (see GetPrerequisitesWithRPath), we are using REAL_PATH below to also resolve
+  # Slicer_SUPERBUILD_DIR and ensure that the test in "SlicerExtensionCPackBundleFixup.cmake.in"
+  # checking if "${key}_ITEM" is a library built in Slicer itself work as expected.
+  file(REAL_PATH ${Slicer_SUPERBUILD_DIR} Slicer_SUPERBUILD_DIR)
+
   #------------------------------------------------------------------------------
   # <ExtensionName>_FIXUP_BUNDLE_LIBRARY_DIRECTORIES
   #------------------------------------------------------------------------------

2 Likes