CLI linking error

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

Any suggestion on how to solve that?

Thank you!

How do you package your extension?
How do you attempt to run the CLI?
Does the CLI work in Slicer if you install the extension from generated extension package file?

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.


Thanks for your help!

This is how we initially tried, but the path error is the same…

Have you been able to successfully install the extension package from file using extension manager in Slicer?

  • When I install the extension from file on a downloaded nightly version, the following error occured:

  • When I use the built Slicer I used to build the extension, Slicer crashes and the extension isn’t installed when I restart it.

I tried with the make install command, and I have a lot of that following warning for different libraries:

warning: cannot resolve item ‘@rpath/lib/Slicer-4.7/liboflog.8.dylib’

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/”.

And then:

– 521/522: fixing up ‘/usr/local/’
warning: target ‘/usr/local/’ does not exist…
/Applications/ ‘/usr/local/’: No such file or directory.
fatal error: /Applications/ internal objdump command failed
/Applications/ ‘/usr/local/’: No such file or directory.
fatal error: /Applications/ internal objdump command failed
error: /Applications/ can’t open file: /usr/local/ (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.

Thanks for your suggestion!

1 Like