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?  Then I probably also have to add other libraries,
right?


Kind regards,
Anton


Reply via email to