Page MenuHomePhabricator

Installer on macOS doesn't work
Closed, ResolvedPublic

Description

  • mitkInstallRules.cmake file is a mess and needs to be rewritten
    • Install Qt plugins (icon engines and so on)
    • Install platform-dependent Qt plugins
    • Figure out how to install WebEngineProcess on all plattforms (WebEngineCore.framework on macOS doesn't contain it anymore when installed, see also T19679: Mac Installer does not start due to missing qt plugins)
    • Install CTK Qt designer plugins
    • Figure out how to get rid of the custom install rules for Matchpoint services
  • Installed Workbench is not able to start because when loading libMitkDICOMRTIO.dylib it says that libMitkDICOMReaderServices.dylib is not loaded. Both files are in their expected location so I guess it is a dependency problem. Have to check how to express dependencies between services...

Event Timeline

kislinsk triaged this task as High priority.Apr 27 2018, 9:46 AM
kislinsk created this task.
This comment was removed by kislinsk.
kislinsk renamed this task from SVG icons not working in installed Workbench on macOS to Installer on macOS doesn't work.May 22 2018, 11:31 AM
kislinsk updated the task description. (Show Details)
kislinsk updated the task description. (Show Details)May 24 2018, 10:57 AM
kislinsk added a comment.EditedMay 24 2018, 11:14 AM

I could fix the libMitkDICOMRTIO.dylib/libMitkDICOMReaderServices.dylib issue above by adding the DICOM reader services explicitly to the private dependencies of DICOM RT IO.

However, there are more issues:

  • The installed MitkWorkbench doesn't start because it cannot find the image of liborg_mitk_gui_qt_ext. My current workaround is to execute the MitkWorkbench as follows: DYLD_LIBRARY_PATH=/.../MitkWorkbench.app/Contents/MacOS/plugins MitkWorkbench --BlueBerry.clean
  • Also, the QtWebEngineProcess needs to be copied manually into the app: cp -r /.../Qt/5.10.1/clang_64/lib/QtWebEngineCore.framework/Helpers /.../MitkWorkbench.app/Contents/Frameworks/QtWebEngineCore.framework/.
  • The theme is not fully applied to the UI, some elements look different compared to the non-installed MitkWorkbench, like the labels in the status bar, or the toolbar seperators and expanding arrows.
  • Web content like the Welcome page still cannot be rendered in the installed MitkWorkbench: Attempting to run unsupported native service: /.../QtWebEngineCore.framework/Versions/5/content_renderer.service.

Wow, seems like most of the issues is resolved by manually copying the MitkWorkbench.provisioning.install file to the installer directory as MitkWorkbench.provisioning. We must check why this file isn't installed anymore (macOS-specific? CMake 3.11?).

Also, the Qt plugins directory "styles" contains a macOS plugin, which I added to the install rules.

The problem was that I didn't reset the _install_DESTINATION variable at the end of mitkInstallRules.cmake and hence following calls to the macro assumed the last set destination as default destination. In this case, the provisioning files was installed into Frameworks/QtWebEngineCore.framework instead of the Contents/MacOS directory.

Issues left:

  • Missing MatchPoint libraries that were manually copied in the old mitkInstallRules.cmake file
  • Web content still not visible

I did an export DYLD_PRINT_LIBRARIES=1 and started both the installed version and the built version of MITK and this is suspicious:

Installed Workbench
dyld: loaded: /Users/kislinsk/MITK-sb-release-Qt-5.10.1/MITK-build/_CPack_Packages/Darwin/DragNDrop/MITK-2016.11.99_rb6a643-mac64/MitkWorkbench.app/Contents/MacOS/./../Frameworks/QtWebEngineWidgets.framework/Versions/5/QtWebEngineWidgets
dyld: loaded: /Users/kislinsk/MITK-sb-release-Qt-5.10.1/MITK-build/_CPack_Packages/Darwin/DragNDrop/MITK-2016.11.99_rb6a643-mac64/MitkWorkbench.app/Contents/MacOS/./../Frameworks/QtWebEngineCore.framework/Versions/5/QtWebEngineCore
Built Workbench
dyld: loaded: /Users/kislinsk/Qt/5.10.1/clang_64/lib/QtWebEngineWidgets.framework/Versions/5/QtWebEngineWidgets
dyld: loaded: /Users/kislinsk/Qt/5.10.1/clang_64/lib/QtWebEngineWidgets.framework/Versions/5/../../../QtQuickWidgets.framework/Versions/5/QtQuickWidgets
dyld: loaded: /Users/kislinsk/Qt/5.10.1/clang_64/lib/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess
dyld: loaded: /Users/kislinsk/Qt/5.10.1/clang_64/lib/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app/Contents/MacOS/../../../../../../../QtWebEngineCore.framework/Versions/5/QtWebEngineCore
dyld: loaded: /Users/kislinsk/Qt/5.10.1/clang_64/lib/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app/Contents/MacOS/../../../../../../../QtQuick.framework/Versions/5/QtQuick
dyld: loaded: /Users/kislinsk/Qt/5.10.1/clang_64/lib/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app/Contents/MacOS/../../../../../../../QtQml.framework/Versions/5/QtQml
dyld: loaded: /Users/kislinsk/Qt/5.10.1/clang_64/lib/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app/Contents/MacOS/../../../../../../../QtNetwork.framework/Versions/5/QtNetwork
dyld: loaded: /Users/kislinsk/Qt/5.10.1/clang_64/lib/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app/Contents/MacOS/../../../../../../../QtCore.framework/Versions/5/QtCore
dyld: loaded: /Users/kislinsk/Qt/5.10.1/clang_64/lib/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app/Contents/MacOS/../../../../../../../QtGui.framework/Versions/5/QtGui
dyld: loaded: /Users/kislinsk/Qt/5.10.1/clang_64/lib/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app/Contents/MacOS/../../../../../../../QtWebChannel.framework/Versions/5/QtWebChannel
dyld: loaded: /Users/kislinsk/Qt/5.10.1/clang_64/lib/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app/Contents/MacOS/../../../../../../../QtPositioning.framework/Versions/5/QtPositioning

Okay, I think I got a step further. I added the USE_SOURCE_PERMISSIONS parameter to the MITK_INSTALL() macro for the QtWebEngineCore.framework/Helpers directory. The QtWebEngineProcess application, located in a subdirectory, is now recognized as executable by fixup_bundle() and fixed up. Still, using the method above there is the following message although the QtWebEngineCore file is at the correct location:

dyld: loaded: /Users/kislinsk/MITK-sb-release-Qt-5.10.1/MITK-build/_CPack_Packages/Darwin/DragNDrop/MITK-2016.11.99_rae4040-mac64/MitkWorkbench.app/Contents/Frameworks/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess
dyld: Library not loaded: @executable_path/../Frameworks/QtWebEngineCore.framework/Versions/5/QtWebEngineCore
  Referenced from: /Users/kislinsk/MITK-sb-release-Qt-5.10.1/MITK-build/_CPack_Packages/Darwin/DragNDrop/MITK-2016.11.99_rae4040-mac64/MitkWorkbench.app/Contents/Frameworks/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess
  Reason: image not found

Uh, maybe the path @executable_path/../Frameworks/QtWebEngineCore.framework/Versions/5/QtWebEngineCore isn't correct because it should (?) be relative to QtWebEngineProcess instead of MitkWorkbench.

Yes, that's definitely an issue. However, even fixing QtWebEngineProcess wouldn't be enough as each and every Qt framework contains these paths relative to @executable_path. We should go for @rpath.

I have written a script that fixes the issue mentioned above and the installed MitkWorkbench does work now!! We have to decide how we handle this situation. Personally I'm pretty sick of all this macOS quirks for now and would vote for modifying the script so that it can be run from our install script at the right place.

fix_qtwebengineprocess.sh
#!/bin/bash

bundle_path=~/MITK-superbuild/MITK-build/_CPack_Packages/Darwin/DragNDrop/MITK-2016.11.99_rb0036c-mac64/MitkWorkbench.app

# Compile list of Qt frameworks in bundle
qt_frameworks=()
for qt_framework_path in ${bundle_path}/Contents/Frameworks/Qt*.framework; do
  if [[ $qt_framework_path =~ ([^\/]+)\.framework ]]; then
    qt_frameworks+=(${BASH_REMATCH[1]})
  fi
done

# For each Qt framework, change the style of dependencies to other
# Qt frameworks from @executable_path to @rpath. The install name tool
# only changes existing dependencies.
for qt_framework in ${qt_frameworks[@]}; do
  in=${bundle_path}/Contents/Frameworks/${qt_framework}.framework/Versions/5/${qt_framework}
  for other_qt_framework in ${qt_frameworks[@]}; do
    from=@executable_path/../Frameworks/${other_qt_framework}.framework/Versions/5/${other_qt_framework}
    to=@rpath/${other_qt_framework}.framework/Versions/5/${other_qt_framework}
    install_name_tool -change $from $to $in
  done
done

# Do the same for QtWebEngineProcess
qtwebengineprocess_path=${bundle_path}/Contents/Frameworks/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess
for qt_framework in ${qt_frameworks[@]}; do
  from=@executable_path/../Frameworks/${qt_framework}.framework/Versions/5/${qt_framework}
  to=@rpath/${qt_framework}.framework/Versions/5/${qt_framework}
  install_name_tool -change $from $to $qtwebengineprocess_path
done

# Add corresponding rpath entries to MitkWorkbench and QtWebEngineProcess
# The install name tool returns an error if an entry is already present.
mitkworkbench_path=${bundle_path}/Contents/MacOS/MitkWorkbench
install_name_tool -add_rpath @executable_path/../Frameworks $mitkworkbench_path 2> /dev/null
install_name_tool -add_rpath @executable_path/../../../../.. $qtwebengineprocess_path 2> /dev/null
kislinsk closed this task as Resolved.Aug 6 2018, 3:51 PM