public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "Anton Wöllert" <a.woellert@gmail.com>
Cc: "gcc-help@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: Relation between gcc version and libstdc++ version
Date: Tue, 30 Aug 2022 20:24:12 +0100	[thread overview]
Message-ID: <CAH6eHdQ811grUPdQuotpHm1Ns=TkuVq7u2fkNqkcS4rm_EcSpg@mail.gmail.com> (raw)
In-Reply-To: <7d0bd41ee0e5fd9de922e35fe4d1312488635ce8.camel@gmail.com>

On Tue, 30 Aug 2022, 19:46 Anton Wöllert, <a.woellert@gmail.com> wrote:

> Thanks for your comments,
>
> sorry for posting on the wrong mailing list.  I'll just restate my
> initial question here on gcc-help again:
>
>    I was trying to build a cross-compilation toolchain for a specific
>    target using a newer GCC version, than the one that the binaries
>    were build on the target.
>
>    The C part seems to work well, but the C++ part doesn't.  It seems
>    that the G++ ships it's own libstdc++ include headers.  If this
>    libstdc++ is newer than the one one the target, I get undefined
>    references (because there are some newer implementation details and
>    things like that).  Is it possible to tell G++/GCC to use the
>    libstdc++.so from the target and also to use the C++ headers (like
>    iostream) from the target?
>    If not, is there any reason this is hard-coded?
>
>    With clang it looks like you can specify "any" libstdc++ version you
>    want, although I haven't tested it yet.
>
> On Tue, 2022-08-30 at 18:21 +0100, Jonathan Wakely wrote:
> > This doesn't belong on this mailing list though, please use the gcc-
> > help list instead.
> >
> > This list is for discussion of GCC development, not help using it.
> >
> >
> > > > C++ in general
> > > > tries to be very good in backward compatibility.
> > > > This essentially means that you can't use newer compilers with
> > > > more
> > > > features/bugfixes to compile software for older targets.
> > >
> > >
> > > No it doesn't. Using new compilers on older machines works fine.
> > > You just need to do it right.
> > >
>
> So what is the right way to compile software with a newer version of
> gcc for a target, that has an older version of gcc?  I can't find any
> hints about that in documentation.  Should I ship the newer
> libstdc++.so with the application to the target and set
> LD_LIBRARY_PATH?


As the documentation says, there are other ways that might be better than
LD_LIBRARY_PATH, but they all require shipping the new libstdc++.so.6 with
the application. Static linking is another option, which avoids needing the
new libstdc++.so.6 at runtime.



  Then I probably also have to add other libraries,
> right?
>

No, you shouldn't need to.


>
> Kind regards,
> Anton
>
>
>

WARNING: multiple messages have this Message-ID
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "Anton Wöllert" <a.woellert@gmail.com>
Cc: "gcc-help@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: Relation between gcc version and libstdc++ version
Date: Tue, 30 Aug 2022 20:24:12 +0100	[thread overview]
Message-ID: <CAH6eHdQ811grUPdQuotpHm1Ns=TkuVq7u2fkNqkcS4rm_EcSpg@mail.gmail.com> (raw)
Message-ID: <20220830192412.2uWwpQtZ2Vqg1sVGojmMNMmNvJn9lf4l4dGjSasB33k@z> (raw)
In-Reply-To: <7d0bd41ee0e5fd9de922e35fe4d1312488635ce8.camel@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2354 bytes --]

On Tue, 30 Aug 2022, 19:46 Anton Wöllert, <a.woellert@gmail.com> wrote:

> Thanks for your comments,
>
> sorry for posting on the wrong mailing list.  I'll just restate my
> initial question here on gcc-help again:
>
>    I was trying to build a cross-compilation toolchain for a specific
>    target using a newer GCC version, than the one that the binaries
>    were build on the target.
>
>    The C part seems to work well, but the C++ part doesn't.  It seems
>    that the G++ ships it's own libstdc++ include headers.  If this
>    libstdc++ is newer than the one one the target, I get undefined
>    references (because there are some newer implementation details and
>    things like that).  Is it possible to tell G++/GCC to use the
>    libstdc++.so from the target and also to use the C++ headers (like
>    iostream) from the target?
>    If not, is there any reason this is hard-coded?
>
>    With clang it looks like you can specify "any" libstdc++ version you
>    want, although I haven't tested it yet.
>
> On Tue, 2022-08-30 at 18:21 +0100, Jonathan Wakely wrote:
> > This doesn't belong on this mailing list though, please use the gcc-
> > help list instead.
> >
> > This list is for discussion of GCC development, not help using it.
> >
> >
> > > > C++ in general
> > > > tries to be very good in backward compatibility.
> > > > This essentially means that you can't use newer compilers with
> > > > more
> > > > features/bugfixes to compile software for older targets.
> > >
> > >
> > > No it doesn't. Using new compilers on older machines works fine.
> > > You just need to do it right.
> > >
>
> So what is the right way to compile software with a newer version of
> gcc for a target, that has an older version of gcc?  I can't find any
> hints about that in documentation.  Should I ship the newer
> libstdc++.so with the application to the target and set
> LD_LIBRARY_PATH?


As the documentation says, there are other ways that might be better than
LD_LIBRARY_PATH, but they all require shipping the new libstdc++.so.6 with
the application. Static linking is another option, which avoids needing the
new libstdc++.so.6 at runtime.



  Then I probably also have to add other libraries,
> right?
>

No, you shouldn't need to.


>
> Kind regards,
> Anton
>
>
>

  reply	other threads:[~2022-08-30 19:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 14:47 Anton Wöllert
2022-08-30 16:09 ` Jonathan Wakely
2022-08-30 16:09   ` Jonathan Wakely
2022-08-30 16:53   ` Anton Wöllert
2022-08-30 17:20     ` Jonathan Wakely
2022-08-30 17:20       ` Jonathan Wakely
2022-08-30 17:21       ` Jonathan Wakely
2022-08-30 17:21         ` Jonathan Wakely
2022-08-30 18:46         ` Anton Wöllert
2022-08-30 19:24           ` Jonathan Wakely [this message]
2022-08-30 19:24             ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH6eHdQ811grUPdQuotpHm1Ns=TkuVq7u2fkNqkcS4rm_EcSpg@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=a.woellert@gmail.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).