c++macosqtqtwebenginemacdeployqt

How to make macdeployqt change the library names inside QtWebEngineProcess.app when it copies over QtWebEngineCore framework


Edit: using Qt 5.9.1, installed with Homebrew

Following a comment in this other question, we are trying to use macdeployqt to prepare the distribution of the OSX bundle of a Qt based application.

This tool is correctly copying over all Qt dependencies (and even some non Qt libraries) inside the bundle. It also changes the dependent library names inside both the application itself and the copied libraries.

It also successfully copies the QtWebEngineProcess.app contained in the Helpers folder of QtWebEngineCore.framework.

 Problem

A problem is that it is not changing the dependent library names inside QtWebEngineProcess, so the bundle is not relocatable (as QtWebEngineProcess refers to its dependent library by absolute paths that are only valid on the development machine). Trying to run the app on a "client" machine, one would thus get the error:

dyld: Library not loaded: /usr/local/Cellar/qt/5.9.1/lib/QtWebEngineCore.framework/Versions/5/QtWebEngineCore Referenced from: Business.app/Contents/Frameworks/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess

We tried to manually fix this application, by editing QtWebEngineProcess to replace the absolute part of the path to the Qt libraries by @loader_path/../../../../../../../../Frameworks/.

This only moves the problem forward: now QtWebEngineProcess seems to correctly load its dependent libraries, but the dependent libraries themselves cannot load their dependent libraries anymore, since their install name is starting with @executable_path, and QtWebEngineProcess executable lives in a different folder from Business executable. Hence the error:

dyld: Library not loaded: @executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick
Referenced from: Business.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/5/QtWebEngineCore


Is macdeployqt broken when it comes to an application using Qt's web engine?

Is there a way to have it work without manually re-changing all Qt install names in the bundle?


Solution

  • Following one of Dmitry's comment on the original question, I finally took the time to test with an official distribution of Qt 5.9.1 for OS X, and it turns out he was right. The macdeployqtdistributed with the official binaries of Qt is handling QtWebEngineProcess.app just fine.

    The version of this utility distributed with homebrew installation's of Qt is bogus, at least in 5.9.1