For Help about libstdc++

Amker.Cheng amker.cheng@gmail.com
Thu May 28 13:32:00 GMT 2009


Thanks for replying.

>
>> I want to build a c++ cross-toolchain from gcc source code.
>> which I'm not sure is that libstdc++ depends on libc?
>
> Yes, it depends on the "custom C library" for the target,
> although that is usually called as "standard C library" :(

this is because libstdc++'s code is implemented on the base of c library.

>
>> In my experiment, I found that it is only possible to built c++
>> compiler after libc(uclibc, newlib,...) is compiled and installed.
>
> That is not true. Producing the C++ compiler parts ('cc1plus', 'g++')
> shouldn't require any information about the target C library!
>
> Even producing "everything" for a cross GCC for an newlib-using
> embedded target shouldn't require anything else than the generic
> newlib headers being copied from 'newlib/libc/include' in the
> newlib sources.  So 'libstdc++' should succeed without a prebuilt
> newlib for the target !

I got it, It is c library's header files which needed for building libstdc++,
But the libc(both header files and the library) is needed when we
building applications using libstdc++.(assuming static library for
simplicity)

>
> Furthermore it is nonsense that the target C library should be
> compiled from its sources during the GCC build!  The expectation
> is that it already exists on the target system and one only copies
> it from there onto the cross host.

I think It maybe common and necessary to build libc along with
cross-toolchain at one time.
For example, in embedded context, we often have to porting linux OS,
which means we
often have no already built c library when building cross-toolchain,
So we have to rebuild libc(uclibc,...) when building the toolchain.
This is toolchain auto-build scripts such as buildroot/crosstool normally do.
Am I right?

>


Thanks again


-- 
Best Regards.



More information about the Gcc-help mailing list