I know this is an age-old thread, but I've just stumbled over this issue
and thought I write my two pence down as well in case anybody else
will ever have a similar problem:

In general I agree that it is advisable to dynamically link libgcc, but one
real problem it creates is the fact that it prevents you from building on an
old OS version with a new version of GCC.

This was exactly the problem I was running into: I built on SuSE 9 with
a self-compiled GCC 4.1. There's no problem with the HotSpot which is
still statically linked to libgcc as mentioned by Martin, but once the JDK
loads for example libfontconfig.so it will crash, because libfontconfig.so
is dynamically linked against the newer libgcc from GCC 4.1 which is not
available on SuSE 9.

So for JDK8 we should at least align the way how we link libgcc between
all the shared libraries of the JDK (either way:).

Regards,
Volker


On Mon, Oct 18, 2010 at 7:16 PM, Kelly O'Hair <kelly.oh...@oracle.com> wrote:
>
> On Oct 18, 2010, at 1:29 AM, Andrew Haley wrote:
>
>> On 10/18/2010 12:51 AM, David Holmes wrote:
>>>
>>> Just to revive this ...
>>>
>>> Andrew Haley said the following on 09/27/10 20:06:
>>>>
>>>> In practice, it's often the other way round: static linking with
>>>> libgcc on GNU/Linux causes more problems than it solves.  If we're not
>>>> linking statically with libgcc now, it would be risky to start doing
>>>> so again.
>>>
>>>
>>> So the current situation is that if you build with gcc 3.x you will get
>>> static linking and with 4.x you won't. This seems to me to be an
>>> oversight when we moved to gcc 4 builds.
>>>
>>> That said, the lack of static linking does not appear to have harmed
>>> anything.
>>>
>>> So do we just leave this as-is or try to rectify it?
>>
>>
>> Please leave it as it is.
>>
>> We gcc maintainers moved from statically linking libgcc to making it a
>> dynamic library because of a library versioning problem.  If, in a
>> single process, two shared objects (or one shared object and a main
>> program) are linked against different versions of libgcc all manner of
>> things may break.
>>
>> http://gcc.gnu.org/ml/gcc/2000-04/msg00610.html
>>
>> Andrew.
>>
>
> I have to agree with Andrew.
>
> Static linking is never a great idea, but I understand is was done a long
> time ago to
> deal with some quality issues and maximize portability of the binaries over
> many Linux systems.
> I don't think those reasons are valid anymore.
>
> I'm not sure this change was done by design or accident, but I'd vote that
> we start
> avoiding static links if at all possible. Just my opinion.
>
> -kto
>

Reply via email to