dynamic libgcc vs static libgcc

2009-02-20
2013-06-06
  • Alexey Pushkin
    Alexey Pushkin
    2009-02-20

    Hi,

    why does mingw64 links in libgcc*.dll by default, not the static libgcc*.a ?

     
    • Kai Tietz
      Kai Tietz
      2009-02-20

      This is reasoned by the new behaviour introduced on gcc 4.4 version.

       
      • Alexey Pushkin
        Alexey Pushkin
        2009-02-20

        Yeah, but what is the reason ?
        I'm using -static-libgcc and it works for me, am I missing something ?

        BTW gcc4-based Fedora's mingw-w32 cross compiler links in *static* libgcc by default...

         
        • NightStrike
          NightStrike
          2009-02-20

          The reason is that the mingw.org team wanted shared by default.  The only reason they didn't do it earlier is that shared libgcc didn't work at all.  Aaron fixed that, and now they want that to be the default.  As to why they want...  I have no idea.

           
    • NightStrike
      NightStrike
      2009-02-20

      I believe your question is related to your posts on the fedora-mingw mailing list earlier today.  Basically, as I understand it, you feel that the rationale for trying to make everything use shared libs instead of static libs on linux doesn't apply to Windows.

      I tend to agree.

      The option to dynamically link should of course always be there, but static linking I agree should be the default.

      I don't know how complicated this is to change, or where to even start.  Ideally, it's handled via configure options to gcc when you build it.

       
      • Alexey Pushkin
        Alexey Pushkin
        2009-02-20

        With libgcc, switching to a static version is as simple as adding -static-libgcc switch.
        And this is what I'm actually doing and it works for me.
        However I never understood what the consequences are.
        Am I missing something about multithreading ?

         
        • NightStrike
          NightStrike
          2009-02-20

          I meant changing the default for a toolchain.  By default, -shared-libgcc is implied.  That is new for 4.4.  It'd be nice to build a toolchain with a configure switch that changes the default to -static-libgcc.  I don't know if that's possible.

          You really won't notice a difference between shared/static unless the app you are developing has multiple executables.