X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=INSTALL%2Fbuild.html;h=30f2b6b0a564f2530e44eeb4743c2ec1208f8488;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=9c5fd524ea75f9220a4e82bd9986b7b1eca02133;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/INSTALL/build.html b/INSTALL/build.html index 9c5fd524..30f2b6b0 100644 --- a/INSTALL/build.html +++ b/INSTALL/build.html @@ -3,35 +3,63 @@
We highly recommend that GCC be built using GNU make; -other versions may work, then again they might not. -GNU make is required for compiling GNAT (the Ada compiler) and the Java -runtime library. - -
(For example, many broken versions of make will fail if you use the -recommended setup where objdir is different from srcdir. -Other broken versions may recompile parts of the compiler when -installing the compiler.) -
Some commands executed when making the compiler may fail (return a
-nonzero status) and be ignored by make
. These failures, which
+nonzero status) and be ignored by make. These failures, which
are often due to files that were not found, are expected, and can safely
be ignored.
It is normal to have compiler warnings when compiling certain files. Unless you are a GCC developer, you can generally ignore these warnings -unless they cause compilation to fail. +unless they cause compilation to fail. Developers should attempt to fix +any warnings encountered, however they can temporarily continue past +warnings-as-errors by specifying the configure flag +--disable-werror.
On certain old systems, defining certain environment variables such as
-CC
can interfere with the functioning of make
.
+CC can interfere with the functioning of make.
If you encounter seemingly strange errors when trying to build the compiler in a directory other than the source directory, it could be @@ -39,40 +67,47 @@ because you have previously configured the compiler in the source directory. Make sure you have done all the necessary preparations.
If you build GCC on a BSD system using a directory stored in an old System
-V file system, problems may occur in running fixincludes
if the
+V file system, problems may occur in running fixincludes if the
System V file system doesn't support symbolic links. These problems
result in a failure to fix the declaration of size_t
in
-sys/types.h
. If you find that size_t
is a signed type and
+sys/types.h. If you find that size_t
is a signed type and
that type mismatches occur, this could be the cause.
The solution is not to use such a directory for building GCC. -
When building from CVS or snapshots, or if you modify parser sources, -you need the Bison parser generator installed. Any version 1.25 or -later should work; older versions may also work. If you do not modify -parser sources, releases contain the Bison-generated files and you do -not need Bison installed to build them. +
Similarly, when building from SVN or snapshots, or if you modify +*.l files, you need the Flex lexical analyzer generator +installed. If you do not modify *.l files, releases contain +the Flex-generated files and you do not need Flex installed to build +them. There is still one Flex-based lexical analyzer (part of the +build machinery, not of GCC itself) that is used even if you only +build the C front end. -
When building from CVS or snapshots, or if you modify Texinfo -documentation, you need version 4.1 or later of Texinfo installed if you +
When building from SVN or snapshots, or if you modify Texinfo +documentation, you need version 4.7 or later of Texinfo installed if you want Info documentation to be regenerated. Releases contain Info documentation pre-built for the unmodified documentation in the release.
For a native build issue the command make bootstrap
. This
-will build the entire GCC system, which includes the following steps:
+
For a native build, the default configuration is to perform +a 3-stage bootstrap of the compiler when ‘make’ is invoked. +This will build the entire GCC system and ensure that it compiles +itself correctly. It can be disabled with the --disable-bootstrap +parameter to ‘configure’, but bootstrapping is suggested because +the compiler will be tested more completely and could also have +better performance. -
The bootstrapping process will complete the following steps: -
If you are short on disk space you might consider make
-bootstrap-lean
instead. This is identical to make
-bootstrap
except that object files from the stage1 and
+
If you are short on disk space you might consider ‘make +bootstrap-lean’ instead. The sequence of compilation is the +same described above, but object files from the stage1 and stage2 of the 3-stage bootstrap of the compiler are deleted as soon as they are no longer needed. -
If you want to save additional space during the bootstrap and in -the final installation as well, you can build the compiler binaries -without debugging information as in the following example. This will save -roughly 40% of disk space both for the bootstrap and the final installation. -(Libraries will still contain debugging information.) - -
make CFLAGS='-O' LIBCFLAGS='-g -O2' \ - LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap -- -
If you wish to use non-default GCC flags when compiling the stage2 and
-stage3 compilers, set BOOT_CFLAGS
on the command line when doing
-make bootstrap
. Non-default optimization flags are less well
-tested here than the default of -g -O2
, but should still work.
-In a few cases, you may find that you need to specify special flags such
-as -msoft-float
here to complete the bootstrap; or, if the
-native compiler miscompiles the stage1 compiler, you may need to work
-around this, by choosing BOOT_CFLAGS
to avoid the parts of the
-stage1 compiler that were miscompiled, or by using make
-bootstrap4
to increase the number of stages of bootstrap.
-
-
If you used the flag --enable-languages=...
to restrict
+
If you wish to use non-default GCC flags when compiling the stage2
+and stage3 compilers, set BOOT_CFLAGS
on the command line when
+doing ‘make’. For example, if you want to save additional space
+during the bootstrap and in the final installation as well, you can
+build the compiler binaries without debugging information as in the
+following example. This will save roughly 40% of disk space both for
+the bootstrap and the final installation. (Libraries will still contain
+debugging information.)
+
+
make BOOT_CFLAGS='-O' bootstrap ++
You can place non-default optimization flags into BOOT_CFLAGS
; they
+are less well tested here than the default of ‘-g -O2’, but should
+still work. In a few cases, you may find that you need to specify special
+flags such as -msoft-float here to complete the bootstrap; or,
+if the native compiler miscompiles the stage1 compiler, you may need
+to work around this, by choosing BOOT_CFLAGS
to avoid the parts
+of the stage1 compiler that were miscompiled, or by using ‘make
+bootstrap4’ to increase the number of stages of bootstrap.
+
+
BOOT_CFLAGS
does not apply to bootstrapped target libraries.
+Since these are always compiled with the compiler currently being
+bootstrapped, you can use CFLAGS_FOR_TARGET
to modify their
+compilation flags, as for non-bootstrapped target libraries.
+Again, if the native compiler miscompiles the stage1 compiler, you may
+need to work around this by avoiding non-working parts of the stage1
+compiler. Use STAGE1_LIBCFLAGS
to this end.
+
+
If you used the flag --enable-languages=... to restrict
the compilers to be built, only those you've actually enabled will be
built. This will of course only build those runtime libraries, for
which the particular compiler has been built. Please note,
-that re-defining LANGUAGES
when calling make bootstrap
+that re-defining LANGUAGES when calling ‘make’
does not work anymore!
If the comparison of stage2 and stage3 fails, this normally indicates
that the stage2 compiler has compiled GCC incorrectly, and is therefore
a potentially serious bug which you should investigate and report. (On
a few systems, meaningful comparison of object files is impossible; they
-always appear "different". If you encounter this problem, you will
-need to disable comparison in the Makefile
.)
+always appear “different”. If you encounter this problem, you will
+need to disable comparison in the Makefile.)
-
If you do not want to bootstrap your compiler, you can configure with
+--disable-bootstrap. In particular cases, you may want to
+bootstrap your compiler even if the target system is not the same as
+the one you are building on: for example, you could build a
+powerpc-unknown-linux-gnu
toolchain on a
+powerpc64-unknown-linux-gnu
host. In this case, pass
+--enable-bootstrap to the configure script.
-
We recommend reading the -crossgcc FAQ -for information about building cross compilers. +
When building a cross compiler, it is not generally possible to do a +
When building a cross compiler, it is not generally possible to do a 3-stage bootstrap of the compiler. This makes for an interesting problem as parts of GCC can only be built with GCC. @@ -136,13 +182,19 @@ native compiler. You can then use the native GCC compiler to build the cross compiler. The installed native compiler needs to be GCC version 2.95 or later. +
If the cross compiler is to be built with support for the Java +programming language and the ability to compile .java source files is +desired, the installed native compiler used to build the cross +compiler needs to be the same GCC version as the cross compiler. In +addition the cross compiler needs to be configured with +--with-ecj-jar=.... +
Assuming you have already installed a native copy of GCC and configured
-your cross compiler, issue the command make
, which performs the
+your cross compiler, issue the command make, which performs the
following steps:
Note that if an error occurs in any step the make process will exit. +
If you are not building GNU binutils in the same source tree as GCC, +you will need a cross-assembler and cross-linker installed before +configuring GCC. Put them in the directory +prefix/target/bin. Here is a table of the tools +you should put in this directory: + +
The installation of GCC will find these programs in that directory, +and copy or link them to the proper place to for the cross-compiler to +find them when run later. + +
The easiest way to provide these files is to build the Binutils package. +Configure it with the same --host and --target +options that you use for configuring GCC, then build and install +them. They install their executables automatically into the proper +directory. Alas, they do not support all the targets that GCC +supports. + +
If you are not building a C library in the same source tree as GCC,
+you should also provide the target libraries and headers before
+configuring GCC, specifying the directories with
+--with-sysroot or --with-headers and
+--with-libs. Many targets also require “start files” such
+as crt0.o and
+crtn.o which are linked into each executable. There may be several
+alternatives for crt0.o, for use with profiling or other
+compilation options. Check your target's definition of
+STARTFILE_SPEC
to find out what start files it uses.
+
If you have a multiprocessor system you can use make bootstrap
-MAKE="make -j 2" -j 2
or just make -j 2 bootstrap
-for GNU Make 3.79 and above instead of just make bootstrap
-when building GCC. You can use a bigger number instead of two if
-you like. In most cases, it won't help to use a number bigger than
-the number of processors in your machine.
+
GNU Make 3.79 and above, which is necessary to build GCC, support +building in parallel. To activate this, you can use ‘make -j 2’ +instead of ‘make’. You can also specify a bigger number, and +in most cases using a value greater than the number of processors in +your machine will result in fewer and shorter I/O latency hits, thus +improving overall throughput; this is especially true for slow drives +and network filesystems.
In order to build GNAT, the Ada compiler, you need a working GNAT -compiler (GNAT version 3.13 or later, or GCC version 3.1 or later), -since the Ada front end is written in Ada (with some -GNAT-specific extensions), and GNU make. - -
However, you do not need a full installation of GNAT, just the GNAT
-binary gnat1
, a copy of gnatbind
, and a compiler driver
-which can deal with Ada input (by invoking the gnat1
binary).
-You can specify this compiler driver by setting the ADAC
-environment variable at the configure step. configure
can
-detect the driver automatically if it has got a common name such as
-gcc
or gnatgcc
. Of course, you still need a working
-C compiler (the compiler driver can be different or not).
-configure
does not test whether the GNAT installation works
+
In order to build GNAT, the Ada compiler, you need a working GNAT +compiler (GCC version 3.4 or later). +This includes GNAT tools such as gnatmake and +gnatlink, since the Ada front end is written in Ada and +uses some GNAT-specific extensions. + +
In order to build a cross compiler, it is suggested to install +the new compiler as native first, and then use it to build the cross +compiler. + +
configure does not test whether the GNAT installation works
and has a sufficiently recent version; if too old a GNAT version is
-installed, the build will fail unless --enable-languages
is
+installed, the build will fail unless --enable-languages is
used to disable building the Ada front end.
-
Additional build tools (such as gnatmake
) or a working GNAT
-run-time library installation are usually not required. However,
-if you want to bootstrap the compiler using a minimal version of GNAT,
-you have to issue the following commands before invoking make
-bootstrap
(this assumes that you start with an unmodified and consistent
-source distribution):
-
-
cd srcdir/gcc/ada - touch treeprs.ads [es]info.h nmake.ad[bs] -- -
At the moment, the GNAT library and several tools for GNAT are not built
-by make bootstrap
. You have to invoke
-make gnatlib_and_tools
in the objdir
/gcc
-subdirectory before proceeding with the next steps.
-
-
For example, you can build a native Ada compiler by issuing the
-following commands (assuming make
is GNU make):
-
-
cd objdir - srcdir/configure --enable-languages=c,ada - cd srcdir/gcc/ada - touch treeprs.ads [es]info.h nmake.ad[bs] - cd objdir - make bootstrap - cd gcc - make gnatlib_and_tools - cd .. -- -
Currently, when compiling the Ada front end, you cannot use the parallel -build feature described in the previous section. - -