Jonathan Wakely via Gcc-help kirjoitti 19.4.2020 klo 21.49:
On Sun, 19 Apr 2020 at 16:16, R. Diez via Gcc-help <gcc-help@xxxxxxxxxxx> wrote:
Hi all:
I have been building cross-compiler toolchains for years with makefiles similar to this one:
https://github.com/rdiez/JtagDue/blob/master/Toolchain/Makefile
I have always been worried that installing GCC phase 2 on top of GCC phase 1 (with the same --prefix=/my/dir) may leave some undesired remnants behind.
That seems like an unnecessary worry. Why would the phase 1 compiler
install *more* than the final one?
So I thought I should build and install GCC phase 1 somewhere else. After all, GCC phase 1 is not needed after the toolchain is complete.
The steps would look like this:
- Build and install Binutils with --prefix=/final/destination
- Build and install GCC phase 1 (minimal compiler) with --prefix=/temporary/destination
- Build and install Newlib with GCC phase 1 with --prefix=/final/destination
- Build and install GCC phase 2 with --prefix=/final/destination
- At this point, we could delete /temporary/destination
Meanwhile one cannot build the standard C libraries for "system targets"
(those which have the "native GCC" as the default) at the same
time with GCC, it is the assumption with the "embedded targets" using
newlib (those which have the "cross GCC" as the default). Maybe
in the distant past of GCC there were some problems with this "combined
build of GCC and newlib" but someone suggesting a separate
build somewhere nowadays is really weird. Already in the gcc-2.95 age
the instructions were like this :
1. Link the following directories from Newlib to the main GCC
directory, /source/gcc-2.95.3/ :
* ln -s ../newlib-1.8.2/newlib newlib
* ln -s ../newlib-1.8.2/libgloss libgloss
2. Change to the /build/gcc directory to configure the compiler:
/source/gcc-2.95.3/configure \
--verbose --target=m68k-rtems \
--prefix=/gcc-m68k --with-gnu-as --with-gnu-ld \
--with-newlib
In :
https://docs.rtems.org/releases/4.5.1-pre3/rtemsdoc/html/started/started00072.html
In the generic newlib build instructions this same thing should be seen.
Symlinking the 'newlib' and 'libgloss' subdirectories from the newlib
sources into the GCC sources main directory is what should be
tried first and if doing that there are problems, they should be
reported here or in other suitable places.