Subject: Re: bug#19813: 24.4; emacs crashes on exit

From: Test User <[email-masked]>
Date: Mon, 9 Feb 2015 11:29:04 -0500

On Mon, Feb 9, 2015 at 10:41 AM, Eli Zaretskii <[email-masked]> wrote:

> > Date: Mon, 9 Feb 2015 04:03:24 -0500
> > From: Test User <[email-masked]>
> >
> >     The problem is not with libgcc_s_dw2-1.dll, the problem is with some
> >     other DLL that loads it, typically zlib1.dll or some image library.
> >
> > I built emacs with -shared-libgcc in LDFLAGS and the problem went away.
>
> That is one solution, but it is not the best one, IMO.  E.g., you
> cannot move this binary to another machine without also copying
> libgcc_s_dw2-1.dll with it.

True. I mentioned in an earlier message that I had another copy of shared
libgcc
because I needed to take a program that I had written to another PC. I don't
see myself trying to take emacs with me, but your point is taken.

> The best solution is to replace the DLL(s) you have that depend on
> libgcc_s_dw2-1.dll with DLLs that offer the same functionality, but do
> not depend on libgcc_s_dw2-1.dll.  See below for a specific
> recommendation.
>

<snip>

>
> In general, no MinGW DLLs distributed as binaries should depend on
> libgcc_s_dw2-1.dll, for several reasons:
>

<good reasons snipped>

Does this simply mean that I should always build my libraries and programs
with -static-libgcc? Would that be in conflict with the issues discussed in
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Link-Options.html#Link-Options?
(See -shared-libgcc). Or maybe I need to read the code to know when I should
build with -static-libgcc and when I should accept the default?

>
> You can find DLLs that are never dependent on libgcc_s_dw2-1.dll here:
>
>   http://sourceforge.net/projects/ezwinports/files/?source=navbar
>
> That collection includes librsvg, zlib, and all the other libraries
> required by Emacs.  (Btw, the librsvg build there is much smaller than
> the one you use, because it excludes every feature not useful on
> Windows, like Fontconfig, Freetype, and Harfbuzz.)
>

It is impossible for me to know when a feature is "useful on Windows"
or not, so whenever I build software that was not born on Windows, I always
try to make it use as many of its optional dependencies as possible.
Now that I know, in this case maybe I can --disable-harfbuzz ,etc., or
build Harfbuzz with -static-libgcc.