Qt Mac Application Failed to Create Self-contained App Bundle (Qt Creator Build)
<p>I'm using <code>Qt Creator 3.6.1</code> with <code>Qt 5.6.0 (Clang 7.0 (Apple), 64 bit)</code>, and I encountered some problems while trying to create an app bundle for deployment.</p>

<p><em>Note: the app name is called <code>bibi</code></em></p>

<ol>
<li><code>Qt Creator</code> successfully generated <code>bibi.app</code> under <code>build-bibi-Desktop_Qt_5_6_0_clang_64bit-Release/</code> folder</li>
<li>This <code>bibi.app</code> failed to link Qt successfully on the other Mac</li>
<li><code>macdeployqt</code> doesn't solve the problem</li>
</ol>

<p>Followings are the details:</p>

<p><strong>Error screenshot when running <code>bibi.app</code> on the other Mac:</strong>
<a href="https://i.stack.imgur.com/uFrAy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uFrAy.jpg" alt=""></a></p>

<p><strong>otool</strong></p>

<pre><code>&gt; otool -L build-bibi-Desktop_Qt_5_6_0_clang_64bit-Release/bibi.app/Contents/MacOS/bibi
build-bibi-Desktop_Qt_5_6_0_clang_64bit-Release/bibi.app/Contents/MacOS/bibi:
    @rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.6.0, current version 5.6.0)
    @rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.6.0, current version 5.6.0)
    @rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.6.0, current version 5.6.0)
    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
</code></pre>

<p><strong>macdeployqt</strong></p>

<pre><code>&gt; which macdeployqt
/Users/&lt;myusername&gt;/Qt/5.6/clang_64/bin/macdeployqt
&gt; macdeployqt bibi.app
&gt; otool -L bibi.app/Contents/MacOS/bibi
bibi.app/Contents/MacOS/bibi:
    @rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.6.0, current version 5.6.0)
    @rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.6.0, current version 5.6.0)
    @rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.6.0, current version 5.6.0)
    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
</code></pre>

<p><strong>tree bibi.app</strong></p>

<pre><code>bibi.app
├── Contents
│   ├── Frameworks
│   │   ├── QtCore.framework
│   │   │   ├── QtCore -&gt; Versions/Current/QtCore
│   │   │   ├── Resources -&gt; Versions/Current/Resources
│   │   │   └── Versions
│   │   │       ├── 5
│   │   │       │   ├── QtCore
│   │   │       │   └── Resources
│   │   │       │       └── Info.plist
│   │   │       └── Current -&gt; 5
│   │   ├── QtDBus.framework
│   │   │   ├── QtDBus -&gt; Versions/Current/QtDBus
│   │   │   ├── Resources -&gt; Versions/Current/Resources
│   │   │   └── Versions
│   │   │       ├── 5
│   │   │       │   ├── QtDBus
│   │   │       │   └── Resources
│   │   │       │       └── Info.plist
│   │   │       └── Current -&gt; 5
│   │   ├── QtGui.framework
│   │   │   ├── QtGui -&gt; Versions/Current/QtGui
│   │   │   ├── Resources -&gt; Versions/Current/Resources
│   │   │   └── Versions
│   │   │       ├── 5
│   │   │       │   ├── QtGui
│   │   │       │   └── Resources
│   │   │       │       └── Info.plist
│   │   │       └── Current -&gt; 5
│   │   ├── QtPrintSupport.framework
│   │   │   ├── QtPrintSupport -&gt; Versions/Current/QtPrintSupport
│   │   │   ├── Resources -&gt; Versions/Current/Resources
│   │   │   └── Versions
│   │   │       ├── 5
│   │   │       │   ├── QtPrintSupport
│   │   │       │   └── Resources
│   │   │       │       └── Info.plist
│   │   │       └── Current -&gt; 5
│   │   └── QtWidgets.framework
│   │       ├── QtWidgets -&gt; Versions/Current/QtWidgets
│   │       ├── Resources -&gt; Versions/Current/Resources
│   │       └── Versions
│   │           ├── 5
│   │           │   ├── QtWidgets
│   │           │   └── Resources
│   │           │       └── Info.plist
│   │           └── Current -&gt; 5
│   ├── Info.plist
│   ├── MacOS
│   │   └── bibi
│   ├── PkgInfo
│   ├── PlugIns
│   │   ├── imageformats
│   │   │   ├── libqdds.dylib
│   │   │   ├── libqgif.dylib
│   │   │   ├── libqicns.dylib
│   │   │   ├── libqico.dylib
│   │   │   ├── libqjpeg.dylib
│   │   │   ├── libqtga.dylib
│   │   │   ├── libqtiff.dylib
│   │   │   ├── libqwbmp.dylib
│   │   │   └── libqwebp.dylib
│   │   ├── platforms
│   │   │   └── libqcocoa.dylib
│   │   └── printsupport
│   │       └── libcocoaprintersupport.dylib
│   └── Resources
│       ├── empty.lproj
│       └── qt.conf
└── Icon\r

38 directories, 32 files
</code></pre>

<p>Thanks.</p>

<h2>Problem Solved</h2>

<p>Thanks scottt, and the problem is solved. Here are the reasons I failed to create self-contained app bundle successfully:</p>

<ul>
<li><code>otool -L</code> didn't resolve @rpath, and I was confused since it always returned me the same output</li>
<li>lack of a way to test if the bundle is already self-containing all the frameworks</li>
</ul>

<p>In short, the problem can be solve by using Scott's <code>otool-rpath</code>, <code>lsof</code>, or setting <code>DYLD_PRINT_LIBRARIES</code> and <code>DYLD_PRINT_TO_FILE</code>. And, I've written a note with details <a href="http://note.heron.me/2016/05/qt-mac-application-failed-to-create.html" rel="nofollow noreferrer">here</a>.</p>