On Tue, 30 Aug 2022, 15:48 Anton Wöllert via Gcc, <gcc@gcc.gnu.org> wrote:

> Hello list!
>
> 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.


Yes, because libstdc++ is part of GCC.


  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).


Then you're not telling the executable how find the new libstdc++.

https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths



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?
>

It's possible, but unsupported and probably won't work.

If not, is there any reason this is hard-coded?
>

The libstdc++ headers are tightly coupled to the GCC version, so headers
from a given GCC release might not even compile with a newer or older GCC.

Reply via email to