Packaging instructions for macOS


I’ve successfully built Slicer from source on macOS 11.1 but I am having trouble packaging the app. I’ve tried building with Qt installed from a web-installer and from homebrew.

When I try to package Slicer build with Qt from the web-installer the log shows lots of @rpath errors like

warning: target '@rpath/QtGui.framework/Versions/5/QtGui' is not absolute...
warning: target '@rpath/QtGui.framework/Versions/5/QtGui' does not exist...
error: /Applications/DevelopmentTools/ can't open file: @rpath/QtGui.framework/Versions/5/QtGui (No such file or directory)

and the packaged app doesn’t run on the machine it was built.

When I do the same with the Qt that’s installed from homebrew there are no errors and the app launches on the machine it was built on but when I try to launch the app on a different machine the app crashes with an error saying a library was not loaded/found

Dyld Error Message:\
  dyld: Using shared cache: 467A83CB-BA86-3F07-B652-B9256C74080A\
Library not loaded: /usr/local/opt/lz4/lib/liblz4.1.dylib\
  Referenced from: /Applications/\
  Reason: image not found\

The rpath issue was discussed in a number of posts here, like this one and this one and most important this one

From the forum posts it appears that the only way to create a Slicer (or a Slicelet) for distribution to end-users is to build Qt from source. Is it the only option? Might there be another solution that involves an extra step between building Slicer and running make package in the Slicer-build folder?

Any advice is appreciated.

Your understanding is correct, it is not practically feasible to create standalone installation packages if you use homebrew. You need to build Qt from source. This is described in the build instructions, but apparently te instructions are not clear enough. Please send a pull request with suggestions for wording changes, which will make things more clear for future developers.

Thanks for clarifying this, @lassoan
I hoped there might be an easier solution like setting some DYLD path or using install_name_tool before packaging.

Also, can you explain the following line from the instructions:

If using Qt from the system , do not forget to add the following CMake variable to your configuration command line: -DSlicer_USE_SYSTEM_QT:BOOL=ON

Does using Qt from the system relate to the use case when Qt was built from source?

If you want to create installation packages then you need to build Qt yourself and set Slicer_USE_SYSTEM_QT:BOOL=OFF.

1 Like

Thank you very much :+1: