Re: Replacing dynamic library with static one



On 2006-02-28, Henry Townsend <henry.townsend@xxxxxxxx> wrote:
binit wrote:
Hi !!

I need to remove the dependency on libgcc_s.so.6 and libstd++.so , due
to some requirements. I need to replace these with their corresponding
*.a files.

I tried to explicitly mention -L <path>/libstd++.a , and -L
<path>/libgcc_s.a , and removed the -lgcc option but this didnt work.

Run gcc with -static-libgcc. There may be a similar flag for libstdc++;
take a look in the manual.

Be aware that due to a quirk of the LGPL[*], linking your code with
-static-libgcc may make your binaries in violation of the GPL if you
distribute them.

I believe libgcc has a special license exception for exactly this
reason. It would apply equally to dynamic linking, for what it's worth

[*] As I interpret it, and IANAL. But having read the licenses, my
understanding is that you can only use gcc for proprietary code if
you're willing to link dynamically with libgcc.

IANAL, but, your interpretation is "incorrect" in so far as any can be
incorrect. FSF interprets it such that dynamic linking has the same
effect you think static linking does, and some others interpret it such
that static linking has the same effect dynamic linking does, but the
point remains there's no real difference recognized by any party. Of
course, none of this has been tested in court, so EIIWALISWNK [guess
what that stands for?]
.



Relevant Pages

  • Re: Replacing dynamic library with static one
    ... FSF interprets it such that dynamic linking has the same ... effect you think static linking does, and some others interpret it such ... The FSF's position is obviously incorrect and fails the giggle test. ...
    (comp.unix.programmer)
  • Re: Replacing dynamic library with static one
    ... FSF interprets it such that dynamic linking has the same ... effect you think static linking does, and some others interpret it such ... The FSF's position is obviously incorrect and fails the giggle ...
    (comp.unix.programmer)
  • Re: Firefox 2.0 for AIX available
    ... The C compiler is usually not a problem. ... it be compiled with static linking? ... Runtime dynamic linking makes thing a lot easier, as the symbols must not be resolved at binding the objects. ... When a static build of Firefox is linked, the binder of AIX 4.3.3 allocates about 110 to 120 MByte of RAM. ...
    (comp.sys.ibm.ps2.hardware)
  • Re: cannot link -static with threads
    ... for static linking would be that the executable impose minimal ... it is not known at compile time how ... So dynamic linking is, essentially, the only way to make it work. ... libraries on some platforms. ...
    (comp.programming.threads)
  • Re: Replacing dynamic library with static one
    ... It would apply equally to dynamic linking, ... effect you think static linking does, and some others interpret it such ... The LGPL is only non-viral when dynamically linked; when statically linked an LGPL library is effectively "promoted" to GPL and GPL-infects the whole binary. ...
    (comp.unix.programmer)