MinGWとサイドバイサイドマニフェスト
11月 17, 2024 by Qt Group 日本オフィス | Comments
Qt Creator 14では、Python 2のプリティプリンタ(コード整形)のサポートが削除されました。これにより、Qt 5.15.xの32ビットおよび64ビットユーザーは、MinGW 8.1とGDB 8.1を使用するQt 5.15.x MinGW Kitを使用してアプリケーションをデバッグできなくなりました。
以下のタイムラインでは、Python 2.7 のサポートが2019年末に終了していることがわかります。

しかし、Qt のリリースを見ると、Qt 5.15.x は2025年までサポートされていることがわかります!
簡単な解決策は、MinGW 11.2.0 パッケージからGDB 11.2.0へ更新することです。このパッケージでは、GDB のプリティプリンタに Python 3 が使用されています。
しかし、問題があります。GDBにはDLLファイル形式のC++ランタイムの依存関係があり、これらはツールチェーンの他のツール(例えばgccコンパイラ)でも共有されていますが、これらはMinGWバージョン8.1と11.2の間で互換性がありません。
問題のファイルは以下の通りです。
- libgcc_s_seh-1.dll
- libstdc++-6.dll
- libwinpthread-1.dll
Visual C++ ユーザーは、アプリケーション XML マニフェストファイルをご存知かもしれません。
アプリケーションマニフェスト(サイドバイサイドアプリケーションマニフェストまたはフュージョンマニフェストとも呼ばれる)は、アプリケーションが実行時にバインドすべき共有およびプライベートなサイドバイサイドアセンブリを記述および識別するXMLファイルです。これらは、アプリケーションのテストに使用されたものと同じアセンブリバージョンである必要があります。アプリケーションマニフェストは、アプリケーション専用ファイルのメタデータも記述する場合があります。
MinGW GCCでビルドされたアプリケーションには、通常このようなマニフェストファイルはありません。
このXMLファイルは、mt.exeツールを使用してリソースとして実行ファイルに含める必要があります(LLVMではllvm-mt.exe
という代替ツールが提供されています)。
このようなXMLマニフェストはどのようなものになるのでしょうか?
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="gdb.mingw.sxs" version="11.2.0.0" processorArchitecture="amd64"></assemblyIdentity> </dependentAssembly> </dependency> </assembly>
x86の場合は次のようになります。
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="gdb.mingw.sxs" version="11.2.0.0" processorArchitecture="x86"></assemblyIdentity> </dependentAssembly> </dependency> </assembly>
次に、gdborig.exe
およびgdbserver.exe
実行ファイルにファイルを追加します。
$ mt.exe -nologo -manifest "appmanifest.xml" -outputresource:"gdborig.exe;#1"
次のステップは、gdb.mingw.sxs
ディレクトリを作成し、以下のファイルをコピーすることです。
- gdb.mingw.sxs.manifest
- libgcc_s_seh-1.dll
- libstdc++-6.dll
- libwinpthread-1.dll
その後、gdb.mingw.sxs.manifest
はx86_64の場合、以下のようになります。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <noInheritable/> <assemblyIdentity type="win32" name="gdb.mingw.sxs" version="11.2.0.0" processorArchitecture="amd64"/> <file name="libgcc_s_seh-1.dll" hash="96eeefab4af1670cc59e9a77b5f93c65a85ac181" hashalg="SHA1"/> <file name="libstdc++-6.dll" hash="92c59fa3fddf375ee27601975c10b44882d9ecd0" hashalg="SHA1"/> <file name="libwinpthread-1.dll" hash="96387d1c8e3bfbcaeb05fda32c031468417afb7b" hashalg="SHA1"/> </assembly>
x86の場合は次のようになります。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <noInheritable/> <assemblyIdentity type="win32" name="gdb.mingw.sxs" version="11.2.0.0" processorArchitecture="x86"/> <file name="libgcc_s_dw2-1.dll" hash="08d3beb878ccdc4c516d51e98e66fd10be1ea239" hashalg="SHA1"/> <file name="libstdc++-6.dll" hash="92f9c0504b554c17092d52e72bde7d48723c1589" hashalg="SHA1"/> <file name="libwinpthread-1.dll" hash="13b8af525e224f7f69cf1bbe879aa284344d5e0e" hashalg="SHA1"/> </assembly>
これらすべてが揃うと、gdb.exe
11.2.0がMinGW 8.1ツールチェーンのディレクトリで起動します!🎉
完全に動作するgdb.exe
にするには、Pythonの依存関係もパッケージ化する必要があります。GDBパッケージはQTBUG-128398から入手できますが、Qt SDKを使用すればより簡単に取得できます!
Blog Topics:
Comments
Subscribe to our newsletter
Subscribe Newsletter
Try Qt 6.9 Now!
Download the latest release here: www.qt.io/download.
Qt 6.9 is now available, with new features and improvements for application developers and device creators.
We're Hiring
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.