I am currently trying to package my extension with Qt scripted modules and CLI modules.
The packaging process is successfull. Then, when I use the CLI, I have the following linking error:
dyld: Library not loaded: @rpath/lib/Slicer-4.7/libITKFactoryRegistration.dylib
Referenced from: /Users/prisgdd/ShapeVariationAnalyzer-build/_CPack_Packages/ShapeVariationAnalyzer/lib/Slicer-4.7/hidden-cli-modules/./computemean
Reason: image not found
Trace/BPT trap: 5
I have a recently built Slicer on my computer, so Iâm building my extension giving Slicerâs directory. cmake -DSlicer_DIR=/path/to/Slicer-SuperBuild/Slicer-build -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_SYSROOT=<sdkroot> -DCMAKE_OSX_DEPLOYMENT_TARGET=<deploy-target> -DCMAKE_BUILD_TYPE=Release ../ShapeVariationAnalyzer
Then, I add the path to my extensionâs modules (cli and qt scripted) and tried to run the CLI with the button dedicated to do so on my extension but also loading the cli-module in Slicer. Both actions gave the same issue.
I tried to install the extension from the generated extension package file but it says it canât copy the source folder to the destination folder and it aborts the process.
It may be possible that the executables stored in the created extension package only work with an installed Slicer. So, either try running Slicer from the build tree and use binaries of your extension from the build tree; or install Slicer and install your extension from file.
You can read a bit more about CMakeâs RPATH handling here.
I donât use MacOSX, so I cannot give any further help, but @pieper or other Mac users should be able to give more information.
@lassoan may be right about the extension only running from an install try. Did you try making an installed version of your local mac build?
Run make package from the Slicer-superbuild/Slicer-build directory and then (eventually) youâll get an _CPack_Packages with an install tree in it. Let us know if you have the same path error.
possible problems:
need more directories?
need to use InstallRequiredSystemLibraries?
run in install tree instead of build tree?
Which produces this error:
â 260/522: copying â@rpath/lib/Slicer-4.7/liboflog.8.dylibâ
Error copying file â@rpath/lib/Slicer-4.7/liboflog.8.dylibâ to â/usr/local/Slicer.app/Contents/Extensions-0ef0792/ShapeVariationAnalyzer/lib/Slicer-4.7/liboflog.8.dylibâ.
And then:
â 521/522: fixing up â/usr/local/Slicer.app/Contents/Extensions-0ef0792/ShapeVariationAnalyzer/lib/Slicer-4.7/liboflog.8.dylibâ
warning: target â/usr/local/Slicer.app/Contents/Extensions-0ef0792/ShapeVariationAnalyzer/lib/Slicer-4.7/liboflog.8.dylibâ does not existâŚ
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump: â/usr/local/Slicer.app/Contents/Extensions-0ef0792/ShapeVariationAnalyzer/lib/Slicer-4.7/liboflog.8.dylibâ: No such file or directory.
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: internal objdump command failed
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump: â/usr/local/Slicer.app/Contents/Extensions-0ef0792/ShapeVariationAnalyzer/lib/Slicer-4.7/liboflog.8.dylibâ: No such file or directory.
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: internal objdump command failed
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: canât open file: /usr/local/Slicer.app/Contents/Extensions-0ef0792/ShapeVariationAnalyzer/lib/Slicer-4.7/liboflog.8.dylib (No such file or directory)
Good news: After cleaning the repository and the different CMakeLists, it works well!
I donât know what was exactly the problem. We started from the creation of a new extension with the Extension Wizard, to be sure we had the good architecture and set the variables correctly.