On Wed, 6 Oct 2021, 18:22 Xi Ruoyao, <xry111@xxxxxxxxxxxxxxxx> wrote: > On Mon, 2021-10-04 at 23:23 +0100, Jonathan Wakely via Gcc-help wrote: > > On Mon, 4 Oct 2021 at 22:03, Bill Cunningham via Gcc-help > > <gcc-help@xxxxxxxxxxx> wrote: > > > > > > I have bee looking at the LFS project. www.linuxfromscratch.org and > > > I > > > find their instructions a bit difficult. But at one point there is a > > > gcc > > > compiler compiled and installed with the --disable-libstdcxx option. > > > Later, you are supposed to go back to your build directory and > > > install > > > libstdc++. I am not asking anyone to go to linuxfromscratch and > > > investigate it so I will explain as much as possible as I believe I > > > need > > > too. > > > > > > This is compiling a "fake"cross compiler. Since everything is > > > compiled from scratch, C++ libraries do not exist at the time of the > > > first compilation. After glibc is built and installed, you go back > > > to > > > gcc and compile the libstdcxx libraries of gcc. Exactly how is that > > > done? > > > > Exactly as it says at > > > https://www.linuxfromscratch.org/lfs/view/development/chapter05/gcc-libstdc++-pass1.html > > There is actually two ways for this. One is our way in LFS, another is > not to pass --disable-libstdcxx, but use "make all-gcc" and "make > install-gcc" to install the compiler (without libstdc++) first. Then, > build and install libc. Finally, go back to the gcc build directory, > and run "make all" to build the parts depending on libc, which were not > built with "make all-gcc". > Yes, that's what I do when testing cross compilers. > AFAIK the second approach is often used by embedded developers (building > for e.g. avr-gcc). We use the first approach in LFS because we don't > want to say something like "please keep the GCC building directory here, > don't remove it like building other packages" in the book. > -- > Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx> > School of Aerospace Science and Technology, Xidian University >