source: rtems/doc/started/buildc.t @ f5bbc042

4.115
Last change on this file since f5bbc042 was f5bbc042, checked in by Joel Sherrill <joel.sherrill@…>, on 03/20/14 at 21:16:39

started/buildc.t: Change CVS to Git

  • Property mode set to 100644
File size: 28.6 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-2014.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5
6@chapter Building the GNU Cross Compiler Toolset
7
8@b{NOTE}:  This chapter describes the steps required to build cross-compilation
9toolset on Linux (and possibly Windows using Cygwin) systems.  This chapter
10does @b{NOT} apply if you installed prebuilt toolset executables for BINUTILS,
11GCC, NEWLIB, and GDB.  If you installed prebuilt executables for all of those,
12proceed to @ref{Building RTEMS}.  If you require a GDB with a special
13configuration to connect to your target board, then proceed to
14@ref{Installing GDB Without RPM} for some advice.
15
16This chapter describes the steps required to acquire the source code for
17a GNU cross compiler toolset, apply any required RTEMS specific patches,
18compile that toolset and install it.
19
20It is recommended that when toolset binaries are available for your
21particular host, that they be used.  Prebuilt binaries are much easier
22to install.  They are also much easier for the RTEMS Project to support.
23
24@c
25@c  Preparation
26@c
27@section Preparation
28
29Before you can build an RTEMS toolset from source, there are some
30preparatory steps which must be performed.  You will need to determine
31the various tool versions and patches required and download them  You
32will also have to unarchive the source and apply any patches.
33
34@c
35@c  Determining Tool Version and Patch Revision
36@c
37@subsection Determining Tool Version and Patch Revision
38
39The tool versions and patch revisions change on a fairly frequent basis.
40In addition, these may vary based upon the target architecture.  In some
41cases, the RTEMS Project may have to stick with a particular version
42of a tool to provide a working version for a specific architecture.
43Because of this, it is impossible to provide this information in a
44complete and accurate manner in this manual.  You will need to refer
45to the configuration files used by the RTEMS RPM specification files to
46determine the current versions and, if a patch is required, what version.
47This section describes how to locate the appropriate tool versions and
48patches for a particular target architecture.
49
50All patches and RPM specification files are kept under source code
51control.  They are not included in release tarballs.  You will have to
52access the CVS branch for RTEMS @value{RTEMSAPI}.  For details on this,
53visit @uref{http://wiki.rtems.org/wiki/index.php/RTEMS_GIT_Repository,
54http://wiki.rtems.org/wiki/index.php/RTEMS_GIT_Repository} and look for
55instructions on accessing the RTEMS Source Code Repository in read-only
56mode.
57
58In the checked out source code, you will need to look in the subdirectory
59@code{contrib/crossrpms/autotools} to determine the versions of AUTOCONF
60and AUTOMAKE as well as any patches required.  In this directory are
61a few files you will need to look at.  The first is @code{Makefile.am}
62which defines the versions of AUTOCONF and AUTOMAKE required for this
63RTEMS Release Series.  Make a note of the version numbers required for
64AUTOCONF and AUTOMAKE (AUTOCONF_VERS and AUTOMAKE_VERS respectively).  Then
65examine the following files to determine the master location for the source
66tarballs and to determine if a patch is required for each tool version cited in
67the @code{Makefile.am}.
68
69@example
70autoconf-sources.add
71automake-sources.add
72@end example
73
74If any patches are required, they will be in the
75@code{contrib/crossrpms/patches} subdirectory of your checked out RTEMS
76source tree.
77
78If no patches are required, you can use a package manager provided by your
79Linux distribution to install AUTOMAKE and AUTOCONF to avoid building them from
80source.
81
82In the checked out source code, you will need to look in the subdirectory
83@code{contrib/crossrpms/rtems@value{RTEMSAPI}} to determine the target
84specific tool versions and patches required. In this directory, you
85will find a number of subdirectories with many named after target
86architectures supported by RTEMS.  Descend into the directory for the
87architecture you plan to build tools for.  Again, the @code{Makefile.am}
88defines the tool versions for this architecture and RTEMS Release Series.
89Make a note of the version numbers required for BINUTILS, GCC, NEWLIB,
90and GDB.  Then examine the following files to determine the master
91location for the source tarballs and to determine if a patch is required
92for each tool version cited in the @code{Makefile.am}.
93
94@itemize
95@item binutils-sources.add
96@item gcc-sources.add
97@item gdb-sources.add
98@end itemize
99
100If any patches are required, they will be in the
101@code{contrib/crossrpms/patches} subdirectory of your checked out RTEMS
102source tree.
103
104This is the entire set of source tarballs and patches required for a
105toolset targeting the selected architecture.  In many cases, this will be
106the same versions required by other targets on this RTEMS Release Series.
107
108@c
109@c  Obtain Source and Patches
110@c
111@subsection Obtain Source and Patches
112
113You will need to download the sources for the various packages from
114their master locations as identified in the previous section.
115
116Any patches needed should be in the @code{contrib/crossrpms/patches}
117directory of your RTEMS source.
118
119@c
120@c  Installing the Tools Without RPM
121@c
122@section Installing the Tools Without RPM
123
124This section describes the procedure for building and installing an RTEMS
125cross toolset from source code without using the RPM build infrastructure.
126
127Direct invocation of @code{configure} and @code{make} provides more control
128and easier recovery from problems when building.
129
130@c
131@c Archive and Build Directory Format
132@c
133@subsection Archive and Build Directory Format
134
135When no packaging format requirements are present, the root directory for
136the storage of source archives and patches as well as for building the
137tools is up to the user.  The only concern is that there be enough
138disk space to complete the build.  In this document, the following
139organization will be used.
140
141Make an @code{archive} directory to contain the downloaded source code
142and pataches.  Additionally, a @code{tools} directory to be used as a
143build directory.  The command sequence to do this is shown below:
144
145@example
146mkdir archive
147mkdir tools
148@end example
149
150This will result in an initial directory structure similar to the
151one shown in the following figure:
152
153@example
154@group
155/whatever/prefix/you/choose/
156        archive/
157        tools/
158
159@end group
160@end example
161
162The RTEMS Project tries to submit all of our patches upstream to the
163parent projects.  In the event there are patches, the master copy of them
164is located in the appropriate branch of the RTEMS source module in CVS.
165Patches are in the @code{contrib/crossrpms/patches}.
166
167@c
168@c  Unarchiving the Tools
169@c
170@subsection Unarchiving the Tools
171
172@b{NOTE}:  This step is required if building any of the tools without using RPM.
173It is @b{NOT} required if using the procedure described in @ref{Using RPM
174to Build Tools}.  This section describes the process of unarchiving the
175tools that comprise an RTEMS toolset.
176
177GNU source distributions are archived using @code{tar} and
178compressed using either @code{gzip} or @code{bzip}.
179If compressed with @code{gzip}, the extension @code{.gz} is used.
180If compressed with @code{bzip}, the extension @code{.bz2} is used.
181
182While in the @code{tools} directory, unpack the compressed tar files
183using the appropriate command based upon the compression program used.
184
185@example
186cd tools
187tar xzf ../archive/TOOLNAME.tar.gz  # for gzip'ed tools
188tar xjf ../archive/TOOLNAME.tar.bz2 # for bzip'ed tools
189@end example
190
191Assuming you are building a complete toolset, after all of the the
192compressed tar files have been unpacked using the appropriate commands,
193the following directories will have been created under @code{tools}.
194
195@itemize @bullet
196@item autoconf-<VERSION>
197@item automake-<VERSION>
198@item binutils-<VERSION>
199@item gcc-<VERSION>
200@item newlib-<VERSION>
201@item gdb-<VERSION>
202@end itemize
203
204The tree should look something like the following figure:
205
206@example
207@group
208/whatever/prefix/you/choose/
209        archive/
210          variable tarballs
211          variable patches
212        tools/
213          various tool source trees
214@end group
215@end example
216
217@c
218@c Applying RTEMS Project Tool Patches
219@c
220
221@subsection Applying RTEMS Project Tool Patches
222
223@b{NOTE}:  This step is required if building any of the tools IF they have a
224patch currently required and you are building the tools without using RPM.
225is @b{NOT} required if using the procedure described in @ref{Using RPM
226to Build Tools}.  This section describes the process of applying the
227RTEMS patches to any of the tools.
228
229If a patch is required for a particular tool source tree, it is placed in the
230@code{contrib/crossrpms/patches} directory in the CVS tree.  Make sure the
231patch version is the same as of the tool you are building.  You will perform a
232command similar to the following to apply the patch.  In this example, <TOOL>
233should be replaced by the appropriate tool directory and <TOOL_PATCH> with the
234appropriate patch file.
235
236@example
237cd tools/<TOOL>
238cat ../../archive/<TOOL_PATCH> | patch -p1
239@end example
240
241@b{NOTE}: If you add the @code{--dry-run} option to the @code{patch} command
242in the above commands, it will attempt to apply the patch and report
243any issues without actually modifying any files.
244
245If the patch was compressed with the @code{gzip} program, it will
246have a suffix of @code{.gz} and you should use @code{zcat} instead
247of @code{cat} as shown above.  If the patch was compressed with
248the @code{gzip} program, it will have a suffix of @code{.bz2} and
249you should use @code{bzcat} instead of @code{cat} as shown above.
250
251Check to see if any of these patches have been rejected using the following
252sequence:
253
254@example
255cd tools/<TOOL>
256find . -name "*.rej" -print
257@end example
258
259If any files are found with the .rej extension, a patch has been rejected.
260This should not happen with a good patch file which is properly applied.
261
262@c
263@c  Installing AUTOCONF From Source
264@c
265
266@subsection Installing AUTOCONF From Source
267
268The following example illustrates the invocation of @code{configure}
269and @code{make} to build and install autoconf-<version>.  This tool is
270installed as a native utility and is independent of any RTEMS target.
271
272@b{NOTE}: If no patch is required for Autoconf and Automake, you can use the
273standard package manager provided by your Linux distribution to install them.
274Of course, the versions provided by your package manager should be the same
275that specified in Makefile.am or better.
276
277@example
278mkdir b-autoconf
279cd b-autoconf
280../autoconf-<VERSION>/configure --prefix=@value{RTEMSPREFIX}
281make
282make install
283@end example
284
285After autoconf-<VERSION> is built and installed the build directory
286@code{b-autoconf} may be removed.
287
288For more information on the invocation of @code{configure}, please
289refer to the documentation for autoconf-<VERSION> or invoke the
290autoconf-VERSION> @code{configure} command with the @code{--help} option.
291
292@c
293@c  Installing AUTOMAKE From Source
294@c
295
296@subsection Installing AUTOMAKE From Source
297
298The following example illustrates the invocation of @code{configure}
299and @code{make} to build and install automake-<version>.  This tool is
300installed as a native utility and is independent of any RTEMS target.
301
302@example
303mkdir b-automake
304cd b-automake
305../automake-<VERSION>/configure --prefix=@value{RTEMSPREFIX}
306make all
307make info
308make install
309@end example
310
311After automake-<VERSION> is built and installed the build directory
312@code{b-automake} may be removed.
313
314For more information on the invocation of @code{configure}, please
315refer to the documentation for automake-<VERSION> or invoke the
316automake-VERSION> @code{configure} command with the @code{--help} option.
317
318@c
319@c  Installing BINUTILS From Source
320@c
321@subsection Installing BINUTILS From Source
322
323The following example illustrates the invocation of @code{configure}
324and @code{make} to build and install binutils-<version>
325sparc-rtems@value{RTEMSAPI} target:
326
327@example
328mkdir b-binutils
329cd b-binutils
330../binutils-<VERSION>/configure --target=sparc-rtems@value{RTEMSAPI} \
331  --prefix=@value{RTEMSPREFIX}
332make all
333make info
334make install
335@end example
336
337After binutils-<VERSION> is built and installed the build directory
338@code{b-binutils} may be removed.
339
340For more information on the invocation of @code{configure}, please
341refer to the documentation for binutils-<VERSION> or invoke the
342binutils-VERSION> @code{configure} command with the @code{--help} option.
343
344NOTE: The shell PATH variable needs to be updated to include the path
345the binutils user executables have  been installed in.  The directory
346containing the executables is the prefix used above with
347@file{bin} post-fixed.
348
349@example
350export PATH=@value{RTEMSPREFIX}/bin:$@{PATH@}
351@end example
352
353As you will need to frequently run various commands in the
354@value{RTEMSPREFIX}/bin, you can update your @code{~/.bashrc} to include this
355line. After doing that, don't forget to run
356@example
357source ~/.bashrc
358@end example
359for the changes to take place.
360
361Failure to have the binutils in the path will cause the GCC and NEWLIB
362build to fail with an error message similar to:
363
364@example
365sparc-rtems@value{RTEMSAPI}-ar: command not found
366@end example
367
368@c
369@c  Installing GCC and NEWLIB Without RPM
370@c
371@subsection Installing GCC and NEWLIB Without RPM
372
373Before building gcc-<VERSION> and newlib-<VERSION>,
374binutils-<VERSION> must be installed and the directory
375containing those executables must be in your PATH.
376
377The C Library is built as a subordinate component of
378gcc-<VERSION>.  Because of this, the newlib-<VERSION>
379directory source must be available inside the gcc-<VERSION>
380source tree.  This is normally accomplished using a symbolic
381link as shown in this example:
382
383@example
384cd gcc-<VERSION>
385ln -s ../newlib-<VERSION>/newlib .
386@end example
387
388The following example illustrates the invocation of
389@code{configure} and @code{make}
390to build and install gcc-<VERSION> with only
391C and C++ support for the sparc-rtems@value{RTEMSAPI} target:
392
393@example
394mkdir b-gcc
395cd b-gcc
396../gcc-<VERSION>/configure --target=sparc-rtems@value{RTEMSAPI} \
397   --with-gnu-as --with-gnu-ld --with-newlib --verbose \
398   --enable-threads --enable-languages="c,c++" \
399   --prefix=@value{RTEMSPREFIX}
400make all
401make info
402make install
403@end example
404
405After gcc-<VERSION> is built and installed the
406build directory @code{b-gcc} may be removed.
407
408For more information on the invocation of @code{configure}, please
409refer to the documentation for gcc-<VERSION> or
410invoke the gcc-<VERSION> @code{configure} command with the
411@code{--help} option.
412
413@c
414@c Building GCC with Ada Support
415@c
416@subsection Building GCC with Ada Support
417
418If you want a GCC toolset that includes support for Ada
419(e.g. GNAT), there are some additional requirements on
420the host environment and additional build steps to perform.
421It is critical that you use the same version of GCC/GNAT as
422the native compiler.  GNAT must be compiled with an Ada compiler
423and when building a GNAT cross-compiler, it should be
424the same version of GNAT itself.
425
426It is also important to verify whether there is an RTEMS specific
427Ada patch required for GCC.  These can be found in
428@uref{http://www.rtems.org/ftp/pub/rtems/people/joel/ada,
429http://www.rtems.org/ftp/pub/rtems/people/joel/ada}.  The patch is
430often a minor version or two behind GCC but will usually apply cleanly.
431This patch must be applied.
432
433After this, it is critical to perform these steps in the correct order.
434GNAT requires that the C Library and RTEMS itself be installed before
435the language run-time can be built.
436
437@itemize @bullet
438@item install native GCC with GNAT
439@item place new native GNAT at head of PATH
440@item install BINUTILS
441@item place RTEMS prefix at head of PATH
442@item install C toolset (C++ is optional)
443@item install RTEMS built multilib
444@item install RTEMS built for your BSP
445@end itemize
446
447The build procedure is the same until the Ada configure step.  A GCC
448toolset with GNAT enabled requires that @code{ada} be included in the set
449of enabled languages.  The following example illustrates the invocation of
450@code{configure} and @code{make} to build and install gcc-<VERSION> with
451only C, C++, and Ada support for the sparc-rtems@value{RTEMSAPI} target:
452
453@example
454mkdir b-gcc
455cd b-gcc
456../gcc-<VERSION>/configure --target=sparc-rtems@value{RTEMSAPI} \
457   --with-gnu-as --with-gnu-ld --with-newlib --verbose \
458   --enable-threads --enable-languages="c,c++,ada" \
459   --prefix=@value{RTEMSPREFIX}
460make all
461make info
462make install
463@end example
464
465After gcc-<VERSION> is built and installed the build directory
466@code{b-gcc} may be removed.
467
468@c
469@c Installing GDB Without RPM
470@c
471@subsection Installing GDB Without RPM
472
473@b{NOTE}:  This step is NOT required if prebuilt executables for the
474GDB were installed and they meet your target interface
475requirements.
476
477GDB supports many configurations but requires some means of communicating
478between the host computer and target board.  This communication can be via
479a serial port, Ethernet, BDM, or ROM emulator.  The communication protocol
480can be the GDB remote protocol or GDB can talk directly to a ROM monitor.
481This setup is target board specific.  Some of the configurations that have
482been successfully used with RTEMS applications are:
483
484@itemize @bullet
485@item BDM with ColdFire, 683xx, MPC860 CPUs
486@item Motorola Mxxxbug found on M68xxx VME boards
487@item Motorola PPCbug found on PowerPC VME, CompactPCI, and MTX boards
488@item ARM based Cogent EDB7312
489@item PC's using various Intel and AMD CPUs including i386,
490i486, Pentium and above, and Athlon
491@item PowerPC Instruction Simulator in GDB (PSIM)
492@item MIPS Instruction Simulator in GDB (JMR3904)
493@item Sparc Instruction Simulator in GDB (SIS)
494@item Sparc Instruction Simulator (TSIM)
495@end itemize
496
497GDB is currently RTEMS thread/task aware only if you are using the
498remote debugging support via Ethernet.  These are configured
499using gdb targets of the form CPU-RTEMS.  Note the capital RTEMS.
500
501It is recommended that when toolset binaries are available for
502your particular host, that they be used.  Prebuilt binaries
503are much easier to install but in the case of gdb may or may
504not include support for your particular target board.
505
506The following example illustrates the invocation of @code{configure}
507and @code{make} to build and install gdb-<VERSION> for the
508m68k-rtems@value{RTEMSAPI} target:
509
510@example
511mkdir b-gdb
512cd b-gdb
513../gdb-<VERSION>/configure --target=m68k-rtems@value{RTEMSAPI} \
514  --prefix=@value{RTEMSPREFIX}
515make all
516make info
517make install
518@end example
519
520For some configurations, it is necessary to specify extra options
521to @code{configure} to enable and configure option components
522such as a processor simulator.  The following is a list of
523configurations for which there are extra options:
524
525@table @b
526@item powerpc-rtems@value{RTEMSAPI}
527@code{--enable-sim --enable-sim-powerpc --enable-sim-timebase --enable-sim-hardware}
528
529@item sparc-rtems@value{RTEMSAPI}
530@code{--enable-sim}
531
532@end table
533
534After gdb-<VERSION> is built and installed the
535build directory @code{b-gdb} may be removed.
536
537For more information on the invocation of @code{configure}, please
538refer to the documentation for gdb-<VERSION> or
539invoke the gdb-<VERSION> @code{configure} command with the
540@code{--help} option.
541
542
543@c
544@c  Using RPM to Build Tools
545@c
546
547@section Using RPM to Build Tools
548
549RPM is a packaging format which can be used to distribute binary files as
550well as to capture the procedure and source code used to produce those
551binary files.  For RPM, it is assumed that the following subdirectories
552are under a root directory such as @code{/usr/src/redhat} or
553@code{/usr/local/src/redhat}) on your machine.
554
555@example
556BUILD
557RPMS
558SOURCES
559SPECS
560SRPMS
561@end example
562
563For the purposes of this document, the RPM @code{SOURCES} directory is the
564directory into which all tool source and patches are assumed to reside.
565The @code{BUILD} directory is where the actual build is performed when
566building binaries from a source RPM.
567
568RPM automatically unarchives the source and applies any needed patches
569so you do @b{NOT} have to manually perform the procedures described
570@ref{Unarchiving the Tools} and @ref{Applying RTEMS Project Tool Patches}.
571But you are responsible for placing all source tarballs
572and patches in the @code{SOURCES} directory per the instructions in
573@ref{Obtain Source and Patches}
574
575This procedure starts by installing the source (e.g. @code{.src.rpm}
576extension) RPMs.  The RTEMS tool source RPMS are called "nosrc" to
577indicate that one or more source files required to produce the RPMs
578are not present.  The RTEMS source RPMs typically include all required
579patches, but do not include the large @code{.tar.gz} or @code{.tgz} files
580for each component such as BINUTILS, GCC, or NEWLIB.  These are shared
581by all RTEMS RPMs regardless of target CPU and there was no reason to
582duplicate them.  You will have to get the required source archive files
583by hand and place them in the @code{SOURCES} directory before attempting
584to build.  If you forget to do this, RPM is smart -- it will tell you
585what is missing. You can fetch any missing files and try again.
586
587@c
588@c  Building AUTOCONF using RPM
589@c
590@subsection Building AUTOCONF using RPM
591
592This section illustrates the invocation of RPM to build a new, locally
593compiled, AUTOCONF binary RPM that matches the installed source RPM.
594This example assumes that all of the required source is installed.
595
596@example
597rpm -U @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-autoconf-<VERSION>-<RPM_RELEASE>.src.rpm
598@end example
599
600@example
601cd <RPM_ROOT_DIRECTORY>/SPECS
602rpm -bb i386-rtems@value{RTEMSAPI}-autoconf-<VERSION>.spec
603@end example
604
605If the build completes successfully, RPMS like the following will be
606generated in a build-host architecture specific subdirectory of the RPMs
607directory under the RPM root directory.
608
609@example
610@value{RTEMSRPMPREFIX}rtems@value{RTEMSAPI}-autoconf-<VERSION>-<RPM_RELEASE>.<ARCH>.rpm
611@end example
612
613@b{NOTE}:  It may be necessary to remove the build tree in the @code{BUILD}
614directory under the RPM root directory.
615
616@c
617@c  Building AUTOMAKE using RPM
618@c
619@subsection Building AUTOMAKE using RPM
620
621This section illustrates the invocation of RPM to build a new, locally
622compiled, AUTOMAKE binary RPM that matches the installed source RPM.
623This example assumes that all of the required source is installed.
624
625@example
626rpm -U @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-automake-<VERSION>-<RPM_RELEASE>.src.rpm
627@end example
628
629@example
630cd <RPM_ROOT_DIRECTORY>/SPECS
631rpm -bb i386-rtems@value{RTEMSAPI}-automake-<VERSION>.spec
632@end example
633
634If the build completes successfully, RPMS like the following will be
635generated in a build-host architecture specific subdirectory of the RPMs
636directory under the RPM root directory.
637
638@example
639@value{RTEMSRPMPREFIX}rtems@value{RTEMSAPI}-automake-<VERSION>-<RPM_RELEASE>.<ARCH>.rpm
640@end example
641
642@b{NOTE}:  It may be necessary to remove the build tree in the @code{BUILD}
643directory under the RPM root directory.
644
645
646@c
647@c  Building BINUTILS using RPM
648@c
649@subsection Building BINUTILS using RPM
650
651This section illustrates the invocation of RPM to build a new, locally
652compiled, binutils binary RPM that matches the installed source RPM.
653This example assumes that all of the required source is installed.
654
655@example
656rpm -U @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-binutils-<VERSION>-<RPM_RELEASE>.src.rpm
657@end example
658
659@example
660cd <RPM_ROOT_DIRECTORY>/SPECS
661rpm -bb i386-rtems@value{RTEMSAPI}-binutils-<VERSION>.spec
662@end example
663
664If the build completes successfully, RPMS like the following will be
665generated in a build-host architecture specific subdirectory of the RPMS
666directory under the RPM root directory.
667
668@example
669@value{RTEMSRPMPREFIX}binutils-common-<VERSION>-<RPM_RELEASE>.<ARCH>.rpm
670@value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-binutils-<VERSION>-<RPM_RELEASE>.<ARCH>.rpm
671@end example
672
673NOTE: It may be necessary to remove the build tree in the @code{BUILD}
674directory under the RPM root directory.
675
676@c
677@c  Building GCC and NEWLIB using RPM
678@c
679@subsection Building GCC and NEWLIB using RPM
680
681This section illustrates the invocation of RPM to build a new,
682locally compiled, set of GCC and NEWLIB binary RPMs that match the
683installed source RPM.  It is also necessary to install the BINUTILS
684RPMs and place them in your PATH.  This example assumes that all of
685the required source is installed.
686
687@example
688cd <RPM_ROOT_DIRECTORY>/SPECS
689rpm -bb i386-rtems@value{RTEMSAPI}-gcc-<VERSION>.spec
690@end example
691
692If the build completes successfully, a set of RPMS like the following will
693be generated in a build-host architecture specific subdirectory
694of the RPMS directory under the RPM root directory.
695
696@example
697@value{RTEMSRPMPREFIX}gcc-common-<VERSION>-<RPM>.<DIST>.noarch.rpm \
698@value{RTEMSRPMPREFIX}newlib-common-<VERSION>-<RPM>.<DIST>.noarch.rpm \
699@value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gcc-<VERSION>-<RPM>.<ARCH>.rpm \
700@value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-newlib-<VERSION>-<RPM>.<ARCH>.rpm \
701@value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-libgcc-<VERSION>-<RPM>.<ARCH>.rpm \
702@value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gcc-c++-<VERSION>-<RPM>.<ARCH>.rpm \
703@value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-libstd++-<VERSION>-<RPM>.<ARCH>.rpm
704@end example
705
706@b{NOTE}: Some targets do not support building all languages.
707
708@b{NOTE}: It may be necessary to remove the build tree in the
709@code{BUILD} directory under the RPM root directory.
710
711@c
712@c Building the GDB using RPM
713@c
714@subsection Building the GDB using RPM
715
716The following example illustrates the invocation of RPM to build a new,
717locally compiled, binutils binary RPM that matches the installed source
718RPM.  This example assumes that all of the required source is installed.
719
720
721@example
722rpm -U @value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gdb-<VERSION>-<RPM_RELEASE>.src.rpm
723@end example
724
725@example
726cd <RPM_ROOT_DIRECTORY>/SPECS
727rpm -bb i386-rtems@value{RTEMSAPI}-gdb-<VERSION>.spec
728@end example
729
730If the build completes successfully, RPMS like the following will
731be generated in a build-host architecture specific subdirectory
732of the RPMS directory under the RPM root directory.
733
734@example
735@value{RTEMSRPMPREFIX}gdb-common-<VERSION>-<RPM_RELEASE>.<ARCH>.rpm
736@value{RTEMSRPMPREFIX}i386-rtems@value{RTEMSAPI}-gdb-<VERSION>-<RPM_RELEASE>.<ARCH>.rpm
737@end example
738
739@b{NOTE}: It may be necessary to remove the build tree in the
740@code{BUILD} directory under the RPM root directory.
741
742@c
743@c Common Problems
744@c
745
746@section Common Problems
747
748@subsection Error Message Indicates Invalid Option to Assembler
749
750If a message like this is printed then the new cross compiler
751is most likely using the native assembler instead of the cross
752assembler or vice-versa (native compiler using new cross assembler).
753This can occur for one of the following reasons:
754
755@itemize @bullet
756
757@item Binutils Patch Improperly Applied
758@item Binutils Not Built
759@item Current Directory is in Your PATH
760
761@end itemize
762
763If you are using binutils 2.9.1 or newer with certain older versions of
764gcc, they do not agree on what the name of the newly
765generated cross assembler is.  Older binutils called it @code{as.new}
766which became @code{as.new.exe} under Windows.  This is not a valid
767file name, so @code{as.new} is now called @code{as-new}.  By using the latest
768released tool versions and RTEMS patches, this problem will be avoided.
769
770If binutils did not successfully build the cross assembler, then
771the new cross gcc (@code{xgcc}) used to build the libraries can not
772find it.  Make sure the build of the binutils succeeded.
773
774If you include the current directory in your PATH, then there
775is a chance that the native compiler will accidentally use
776the new cross assembler instead of the native one.  This usually
777indicates that "." is before the standard system directories
778in your PATH.  As a general rule, including "." in your PATH
779is a security risk and should be avoided.  Remove "." from
780your PATH.
781
782@b{NOTE}:  In some environments, it may be difficult to remove "."
783completely from your PATH.  In this case, make sure that "."
784is after the system directories containing "as" and "ld".
785
786@subsection Error Messages Indicating Configuration Problems
787
788If you see error messages like the following,
789
790@itemize @bullet
791
792@item cannot configure libiberty
793@item coff-emulation not found
794@item etc.
795
796@end itemize
797
798Then it is likely that one or more of your gnu tools is
799already configured locally in its source tree.  You can check
800for this by searching for the @code{config.status} file
801in the various tool source trees.  The following command
802does this for the binutils source:
803
804@example
805find binutils-<VERSION> -name config.status -print
806@end example
807
808The solution for this is to execute the command
809@code{make distclean} in each of the GNU tools
810root source directory.  This should remove all
811generated files including Makefiles.
812
813This situation usually occurs when you have previously
814built the tool source for some non-RTEMS target.  The
815generated configuration specific files are still in
816the source tree and the include path specified during
817the RTEMS build accidentally picks up the previous
818configuration.  The include path used is something like
819this:
820
821@example
822-I../../binutils-<VERSION>/gcc -I/binutils-<VERSION>/gcc/include -I.
823@end example
824
825Note that the tool source directory is searched before the
826build directory.
827
828This situation can be avoided entirely by never using
829the source tree as the build directory.
Note: See TracBrowser for help on using the repository browser.