[Box Backup] Remove dependencies on mgwz.dll, mingwm10.dll and shrink resulting .exe

Chris Wilson boxbackup@boxbackup.org
Mon, 30 Mar 2009 22:14:17 +0200 (CEST)


Hi Achim,

On Mon, 30 Mar 2009, Achim wrote:

> I wanted to share my efforts in streamlining the latest trunk builds (BTW,
> R2482 still fails with "Logging.cpp:425: error: `LOG_LOCAL0' undeclared
> (first use this function)")

Yes, I haven't done anything about that yet, lack of time.

> Chris, could you please let me know about thread-safe exception handling in
> Box Backup in order to eliminate mingwm10.dll as described below?

Not possible.

> * * * Remove dependency on mingwm10.dll * * *
> "-mthreads" is needed for thread-safe exception handling. I am not sure
> whether Box uses threading and exceptions

We absolutely do. The code crashed randomly and behaved very weirdly under 
debugging until I found out that I needed to use -mthreads.

> but for now I assume that we can safly remove this flag on a 
> MinGW32-System:

Not as far as I am aware.

>> From the GCC documentation
> <http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options>
>
> -mthreads
> Support thread-safe exception handling on `Mingw32'. Code that relies on
> thread-safe exception handling must compile and link all code with the
> -mthreads option. When compiling, -mthreads defines -D_MT; when linking, it
> links in a special thread helper library -lmingwthrd which cleans up per
> thread exception handling data.

We do not use gcc 4.3.3, at least I don't. It's not stable in mingw yet. 
3.4.5 most definitely requires -mthreads and mingwm10.dll.

> "Also the documentation for -mthread should be updated to indicate that
> it no longer does anything and is only included for compatibility,
> preferably with a "will be removed in the future" type of wording."
> <http://gcc.gnu.org/ml/gcc-patches/2008-08/msg01243.html>
> <http://gcc.gnu.org/ml/gcc-patches/2008-08/msg01207.html>

Not true of 3.4.5.

> * * * Reduce size of Box Backup executables with UPX * * *
> UPX is a free, portable, extendable, high-performance executable packer for
> several different executable formats. It achieves an excellent compression
> ratio and offers very fast decompression. Your executables suffer no memory
> overhead or other drawbacks for most of the formats supported, because of
> in-place decompression.
> <http://upx.sourceforge.net/>

I don't wish to distribute UPXed binaries. You are welcome to do so if you 
wish. I recommend that you also strip out debugging information, which I 
do not, because it's useful in debugging.

Cheers, Chris.
-- 
_ ___ __     _
  / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |