Lazarus Faq/ja
どうしてコンパイル後のバイナリがこんなに大きいの?
どうしてコンパイル後のバイナリがこんなに大きいの?
以下、ポイント。僕の環境だと、strip が必須だった。「-Xs」オプションは無効?なのか。
① 3つのオプションをチェック[X]オン
Compiler Options
Compilation and Linking
[X] Smart linkable (-CX)
[X] Link smart (-XX)
Debugging
[X] Strip symbols from executable (-Xs)
② strip(デバッグ情報除去)実行
lazarusパス\fpc\2.6.4\bin\i386-win32\strip.exe --strip-all XXXXX.exe
③ upx(圧縮ツール)実行
upxパス\upx.exe XXXXX.exe
要は、コンパイル後、strip と upx を通す。BAT ファイルにでもしておけばいい。Compiler Options
Compilation and Linking
[X] Smart linkable (-CX)
[X] Link smart (-XX)
Debugging
[X] Strip symbols from executable (-Xs)
② strip(デバッグ情報除去)実行
lazarusパス\fpc\2.6.4\bin\i386-win32\strip.exe --strip-all XXXXX.exe
③ upx(圧縮ツール)実行
upxパス\upx.exe XXXXX.exe
実行例
① コンパイル 22.5 MB → ② strip 実行 2.44 MB → ③ upx 実行 827 KB
それでも、大きいが…。Delphi が優秀、という事にしておく。① コンパイル 22.5 MB → ② strip 実行 2.44 MB → ③ upx 実行 827 KB
追記 2015-02-20
matsui さんに教えてもらいました。strip は要らないようです。① 3つのオプションをチェック[X]オン
Compiler Options
Compilation and Linking
[X] Smart linkable (-CX)
[X] Link smart (-XX)
Debugging
[X] Strip symbols from executable (-Xs)
② オプションをチェック[ ]オフ
Compiler Options
Debugging
[ ] Generate debugging info for GDB
③ upx(圧縮ツール)実行
upxパス\upx.exe XXXXX.exe
Compiler Options
Compilation and Linking
[X] Smart linkable (-CX)
[X] Link smart (-XX)
Debugging
[X] Strip symbols from executable (-Xs)
② オプションをチェック[ ]オフ
Compiler Options
Debugging
[ ] Generate debugging info for GDB
③ upx(圧縮ツール)実行
upxパス\upx.exe XXXXX.exe
追記 2016-08-21
64bit 版 Ver 1.6 をインストールしました。構築モードが正しく動作するので、余計なことをせず、"Release" でコンパイル後、upx だけ実行すればいいと思われます。![Lazarus 1.6 構築モード](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOcd9ZrDL58mHcSQFG52jyWK5IDjgnsI8xFYf8Ttdz9QdiIjNuLoel1ULBLfAOwF4VEgzB-sm1BGqo1RSwo6h_P592UnPaIH4j1i_nUNoLqdv2XS1-rkqmcHLmcWA7OqDgsZPeftethvzfQsmiQD-OABsyF0iy4rrp6p_6E4ycjuLoDY1Lk4zRHxP0Gs0/s1600/laz.jpg)
追記 2017-01-27
Delphi と比べて、バイナリサイズが大きいとか書いてますが、比べてるのは、大昔の Delphi 5 (1999年www、軽いので使い続けてる)で、最近の Delphi と比べるのならば、それほど大きなサイズとは言えないかも。
0 件のコメント:
コメントを投稿