Building DLLs that don't depend on libgcc_s_dw2-1.dll

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Building DLLs that don't depend on libgcc_s_dw2-1.dll

Eli Zaretskii
I'm trying to build a DLL that will not depend on libgcc_s_dw2-1.dll.
(The reason is that I'd like to distribute that DLL, and I don't want
to have to distribute the humongous source tarball of GCC, which
otherwise the GPL requires.)

Now, the solution is to use -static-libgcc on the "gcc -shared"
command line that creates the DLL.  This works when I create a small
test DLL of my own, but does not seem to have effect with the project
(Guile) where I need this.

The difference between the small test case and Guile seems to be that
the latter is built using libtool, and libtool seems to remove the
"-static-libgcc" switch from the command line it passes to GCC when it
creates the DLL.

Is it correct that libtool removes the "-static-libgcc" switch, or did
I miss something?  If this is correct, is there any way around this
problem except by hacking libtool?

Or maybe there's another way of statically linking libgcc into the
DLL, which doesn't involved compiler switches?  E.g., I thought of
adding libgcc.a and libgcc_eh.a to the libraries linked into the DLL
-- would that work reliably?

Thanks in advance for any help.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building DLLs that don't depend on libgcc_s_dw2-1.dll

Werner LEMBERG

> The difference between the small test case and Guile seems to be
> that the latter is built using libtool, and libtool seems to remove
> the "-static-libgcc" switch from the command line it passes to GCC
> when it creates the DLL.

I had similar problems while building a static Windows binary with
MinGW for my ttfautohint program, which also uses libtool: Some
libraries were always linked dynamically.  This is obviously a bug in
libtool, but I had no time to analyze it, or to make a clean bug
report...

My solution was to rename the affected `.dll' files to `.dll.old',
then renaming the `.a' files (or `.dll.a', I currently can't remember)
to `.dll', then static linking, and undoing everything after it.


    Werner

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building DLLs that don't depend on libgcc_s_dw2-1.dll

Eli Zaretskii
> Date: Sat, 16 Aug 2014 14:06:56 +0200 (CEST)
> From: Werner LEMBERG <[hidden email]>
>
> > The difference between the small test case and Guile seems to be
> > that the latter is built using libtool, and libtool seems to remove
> > the "-static-libgcc" switch from the command line it passes to GCC
> > when it creates the DLL.
>
> I had similar problems while building a static Windows binary with
> MinGW for my ttfautohint program, which also uses libtool: Some
> libraries were always linked dynamically.  This is obviously a bug in
> libtool, but I had no time to analyze it, or to make a clean bug
> report...
>
> My solution was to rename the affected `.dll' files to `.dll.old',
> then renaming the `.a' files (or `.dll.a', I currently can't remember)
> to `.dll', then static linking, and undoing everything after it.

Thanks.

It sounds like this is a well-known problem, see these old threads:

  http://lists.gnu.org/archive/html/libtool/2006-02/msg00065.html
  http://lists.gnu.org/archive/html/bug-libtool/2009-02/msg00006.html
  https://cygwin.com/ml/cygwin/2009-02/msg00231.html

The work-around suggested by those discussions seems to be the
"official" way now, according to the libtool FAQ:

  http://www.gnu.org/software/libtool/manual/libtool.html#FAQ

For the record, the work-around is to configure the package with
"CC='gcc -static-libgcc'".  The same work-around can be used for any
switch that libtool strips from the GCC command lines.

FWIW, the work-around worked for me: I now have a libguile-2.0-22.dll
which does not depend on the shared libgcc DLL.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building DLLs that don't depend on libgcc_s_dw2-1.dll

Keith Marshall
On 16/08/14 14:55, Eli Zaretskii wrote:

> The work-around suggested by those discussions seems to be the
> "official" way now, according to the libtool FAQ:
>
>   http://www.gnu.org/software/libtool/manual/libtool.html#FAQ
>
> For the record, the work-around is to configure the package with
> "CC='gcc -static-libgcc'".  The same work-around can be used for any
> switch that libtool strips from the GCC command lines.
>
> FWIW, the work-around worked for me: I now have a libguile-2.0-22.dll
> which does not depend on the shared libgcc DLL.

Worth a brief write up on the MinGW.org wiki, perhaps?

--
Regards,
Keith.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building DLLs that don't depend on libgcc_s_dw2-1.dll

Eli Zaretskii
> Date: Sun, 17 Aug 2014 12:06:03 +0100
> From: Keith Marshall <[hidden email]>
>
> On 16/08/14 14:55, Eli Zaretskii wrote:
> > The work-around suggested by those discussions seems to be the
> > "official" way now, according to the libtool FAQ:
> >
> >   http://www.gnu.org/software/libtool/manual/libtool.html#FAQ
> >
> > For the record, the work-around is to configure the package with
> > "CC='gcc -static-libgcc'".  The same work-around can be used for any
> > switch that libtool strips from the GCC command lines.
> >
> > FWIW, the work-around worked for me: I now have a libguile-2.0-22.dll
> > which does not depend on the shared libgcc DLL.
>
> Worth a brief write up on the MinGW.org wiki, perhaps?

You mean, about the workaround?  Sure, but where would you suggest to
put that?

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building DLLs that don't depend on libgcc_s_dw2-1.dll

Keith Marshall
On 17/08/14 15:20, Eli Zaretskii wrote:
>> Worth a brief write up on the MinGW.org wiki, perhaps?
> You mean, about the workaround?

Yes.

> Sure, but where would you suggest to put that?

On its own page, created to complete a new link off the existing FAQ or
HOWTO page.

--
Regards,
Keith.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building DLLs that don't depend on libgcc_s_dw2-1.dll

Eli Zaretskii
> Date: Sun, 17 Aug 2014 16:45:29 +0100
> From: Keith Marshall <[hidden email]>
>
> On 17/08/14 15:20, Eli Zaretskii wrote:
> >> Worth a brief write up on the MinGW.org wiki, perhaps?
> > You mean, about the workaround?
>
> Yes.
>
> > Sure, but where would you suggest to put that?
>
> On its own page, created to complete a new link off the existing FAQ or
> HOWTO page.

Done.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building DLLs that don't depend on libgcc_s_dw2-1.dll

Keith Marshall
On 17/08/14 17:36, Eli Zaretskii wrote:

>> Date: Sun, 17 Aug 2014 16:45:29 +0100
>> From: Keith Marshall
>>
>> On 17/08/14 15:20, Eli Zaretskii wrote:
>>>> Worth a brief write up on the MinGW.org wiki, perhaps?
>>> You mean, about the workaround?
>>
>> Yes.
>>
>>> Sure, but where would you suggest to put that?
>>
>> On its own page, created to complete a new link off the existing FAQ or
>> HOWTO page.
>
> Done.

Looks good.  Thanks.

--
Regards,
Keith.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe