public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Linking to dynamic libraries compiled by old version g++
@ 2022-11-07  2:10 孙世龙
  2022-11-07 13:02 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: 孙世龙 @ 2022-11-07  2:10 UTC (permalink / raw)
  To: gcc-help

There are dynamic libraries provided by others, which are out of my control.

What I know is that most of the aforementioned libraries are compiled
by g++4.9.4 & g++4.8.4 with C++11 support, and some libraries are
compiled by g++11.1.0 with C++14 support.

And I have to use newer g++ which supports C++17 to compile my
project. I intend to use g++11.3.0 on Ubuntu20.4.

Is there any potential problem I should be aware of when linking to
dynamic libraries compiled by the said old version g++ ?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linking to dynamic libraries compiled by old version g++
  2022-11-07  2:10 Linking to dynamic libraries compiled by old version g++ 孙世龙
@ 2022-11-07 13:02 ` Jonathan Wakely
  2022-11-08  3:03   ` 孙世龙
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2022-11-07 13:02 UTC (permalink / raw)
  To: 孙世龙; +Cc: gcc-help

On Mon, 7 Nov 2022 at 02:11, 孙世龙 via Gcc-help <gcc-help@gcc.gnu.org> wrote:
>
> There are dynamic libraries provided by others, which are out of my control.
>
> What I know is that most of the aforementioned libraries are compiled
> by g++4.9.4 & g++4.8.4 with C++11 support, and some libraries are
> compiled by g++11.1.0 with C++14 support.
>
> And I have to use newer g++ which supports C++17 to compile my
> project. I intend to use g++11.3.0 on Ubuntu20.4.
>
> Is there any potential problem I should be aware of when linking to
> dynamic libraries compiled by the said old version g++ ?

Yes, this is not supported.

C++11 support in GCC 4.8 and 4.9 was experimental and unstable, and is
not ABI compatible with C++11 code compiled by GCC 5 or later.

Specifically, there were changes to std::chrono::system_clock, and
std::error_category, and std::condition_variable. If those types are
used in the old dynamic libraries, particularly across the library API
boundary, then you are likely to run into problems. There are probably
other incompatibilities that I'm forgetting. I don't bother to
remember all the incompatibilities, because what you're trying to do
is not supported and so I don't spend any effort memorising all the
ways it can fail.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linking to dynamic libraries compiled by old version g++
  2022-11-07 13:02 ` Jonathan Wakely
@ 2022-11-08  3:03   ` 孙世龙
  0 siblings, 0 replies; 3+ messages in thread
From: 孙世龙 @ 2022-11-08  3:03 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

> Specifically, there were changes to std::chrono::system_clock, and
>std::error_category, and std::condition_variable.
>If those types are used in the old dynamic libraries, particularly
>across the library API boundary, then you are likely to run into problems.
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If the aforementioned types are only used in the implementation of the library
which is compiled with 4.9.4 and the interface of the library is a C
interface.

If I understand you correctly, there is no potential problem if a binary program
is compiled with g++11.0.3 and is linked to the said library. Am I right?

Best regards

On Mon, Nov 7, 2022 at 9:02 PM Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> On Mon, 7 Nov 2022 at 02:11, 孙世龙 via Gcc-help <gcc-help@gcc.gnu.org> wrote:
> >
> > There are dynamic libraries provided by others, which are out of my control.
> >
> > What I know is that most of the aforementioned libraries are compiled
> > by g++4.9.4 & g++4.8.4 with C++11 support, and some libraries are
> > compiled by g++11.1.0 with C++14 support.
> >
> > And I have to use newer g++ which supports C++17 to compile my
> > project. I intend to use g++11.3.0 on Ubuntu20.4.
> >
> > Is there any potential problem I should be aware of when linking to
> > dynamic libraries compiled by the said old version g++ ?
>
> Yes, this is not supported.
>
> C++11 support in GCC 4.8 and 4.9 was experimental and unstable, and is
> not ABI compatible with C++11 code compiled by GCC 5 or later.
>
> Specifically, there were changes to std::chrono::system_clock, and
> std::error_category, and std::condition_variable. If those types are
> used in the old dynamic libraries, particularly across the library API
> boundary, then you are likely to run into problems. There are probably
> other incompatibilities that I'm forgetting. I don't bother to
> remember all the incompatibilities, because what you're trying to do
> is not supported and so I don't spend any effort memorising all the
> ways it can fail.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-08  3:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07  2:10 Linking to dynamic libraries compiled by old version g++ 孙世龙
2022-11-07 13:02 ` Jonathan Wakely
2022-11-08  3:03   ` 孙世龙

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).