source: rtems/doc/FAQ/build45.t @ c7f247d

4.104.114.84.95
Last change on this file since c7f247d was c7f247d, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/08/04 at 08:57:00

2004-09-08 Ralf Corsepius <ralf_corsepius@…>

  • FAQ/build45.t: Misc. corrections.
  • Property mode set to 100644
File size: 14.6 KB
Line 
1@c
2@c  $Id$
3@c
4
5@chapter Building RTEMS
6
7Building any package in a cross-compilation fashion can be difficult,
8but configuring and building a real-time operating system that
9supports many CPU families and target boards can be confusing.  The
10RTEMS development team has made every effort to make this process as
11straight forward as possible but there are going to be questions.
12
13Moreover, between RTEMS 4.0 and 4.5, the configure and Makefile system in RTEMS
14was changed to be more compatible with GNU standards.  This transition
15has lead to a number of subtle differences. 
16
17This section of the FAQ tries to address the more frequently asked
18questions about building RTEMS.  Thanks to Ralf Corsepius for
19compiling this section from excerpts from various postings to the
20rtems-users mailing list.
21
22@section Required Tools
23
24@subsection Which tools are required to build RTEMS?
25
26@itemize @bullet
27
28@item A native C-Toolchain, gcc prefered
29@item GNU-Bash and shell utils
30@item GNU-make.
31@item A target (typically cross) C- and (optional) C++-Toolchain.
32@item autoconf/automake (optional, recommended)
33@item Perl (optional, recommended, needed by automake and some tools within RTEMS)
34@item GNU-m4
35
36@end itemize
37
38@subsection Do I need autoconf and automake to build RTEMS?
39
40No, you don't.  Or to be more accurate, you won't need them until you
41modify something in RTEMS's Makefile.ams/configure.acs or start to develop
42with RTEMS.
43 
44I.e.  you won't need them to get started, but you will need them when getting
45serious.
46
47@subsection Do I need a native gcc on my host?
48
49No, you should be able to use any native, ansi-compliant C-compiler, but
50using a native gcc is highly recommended.
51
52@subsection Can I use a non-gcc cross-toolchain?
53
54Generally speaking, it should be possible.
55However, most RTEMS development has taken place using gcc, therefore
56getting it working may not be easy.
57
58@subsection Do I need gcc-2.9x for cross compilation?
59
60[FIXME: Partially obsolete]
61
62Not necessarily, but gcc-2.9x is highly recommended, because most development
63has taken place using gcc-2.9x and previous versions of gcc are not actively
64supported in RTEMS anymore (@ref{Can I use a non-gcc cross-toolchain?}).
65
66@subsection Where to get autoconf automake ld gcc etc.?
67
68The sources of all gnutools are available at any
69@uref{ftp://ftp.gnu.org,GNU} mirror.
70Native Linux binaries should come with any Linux distribution.
71Native Cygwin binaries should be available at @uref{http://www.cygwin.com}.
72
73GNU-Toolchain binaries (gcc, binutils etc.) for Linux and patches required
74to build them from source are available from
75@uref{@value{RTEMSFTPURL},the RTEMS ftp site}.
76
77
78@section Issues when building RTEMS
79
80@subsection When running ./configure weird thing start to happen
81
82You are probably trying to build within the source-tree.
83RTEMS requires a separate build directory.  I.e.  if the
84sources are located at @code{/usr/local/src/rtems-@value{VERSION}},
85use something similar to this to configure RTEMS:
86
87@example
88cd somewhere
89mkdir build
90cd build
91/usr/local/src/rtems-@value{VERSION}/configure [options]
92@end example
93
94@subsection When running bootstrap weird thing start to happen
95
96Many possibile causes: Most likely one of these:
97@itemize @bullet
98@item You are trying to build RTEMS with insufficient or incompatible
99versions of autoconf and automake.
100@item The autotools can't be found because your $PATH might not be set up
101correctly (Cf. @ref{How to set up $PATH?})
102@item You have used configure-script options which interfer with RTEMS
103configuration (Cf. @ref{configure --program-[prefix|suffix|transform-name]})
104@item You have tripped over a bug in RTEMS ;)
105@end itemize
106
107@subsection configure xxx cannot create executables
108
109While running a configure script, you see a message like this:
110@example
111checking for m68k-rtems-gcc... (cached) m68k-rtems-gcc
112checking for C compiler default output... configure: error: C compiler
113cannot create executables
114configure: error: /bin/sh '../../../../rtems-ss-@value{VERSION}/c/make/configure'
115failed for c/make
116@end example
117This kind of error message typically indicates a broken toolchain, broken
118toolchain installation or broken user environment.
119
120Examinating the @code{config.log} corresponding to the the failing
121configure script should provide further information of what
122actually goes wrong (In the example above: @code{<target>/c/<BSP>/make/config.log})
123
124@subsection Why can I not build RTEMS inside of the source tree?
125
126The build-directory hierarchy is setup dynamically at configuration time.
127
128Configuring inside of the source tree would prevent being able to configure
129for multiple targets simultaneously.
130
131Using a separate build-tree simplifies Makefiles and configure scripts
132significantly.
133
134Adaptation to GNU/Cygnus conventions.
135
136@subsection Which environment variables to set?
137
138None.  Unlike for previous releases, it is not recommended anymore to set any
139RTEMS related environment variable (Exception: $PATH, cf.
140@ref{How to set up $PATH?}).
141
142
143@subsection Compiler /Assembler /Linker report errors
144
145If you see a bunch of the error messages related to invalid instructions
146or similar, then probably your @code{$PATH} environment variable is not
147set up correctly (cf.  @ref{How to set up $PATH?}).  Otherwise you might
148have found a bug either in RTEMS or parts of the toolchain.
149
150@subsection How to set up $PATH?
151
152All target tools are supposed to be prefixed with a target-canonicalization
153prefix, eg.  i386-rtems-gcc, m68k-rtems-ld are target tools.
154
155Host tools are supposed not to be prefixed.
156e.g.: cc, ld, gcc, autoconf, automake, aclocal etc.
157
158If using the pre-built tool binaries provided by the RTEMS project,
159simply prepend @code{@value{RTEMSPREFIX}}/bin to @code{$PATH}.
160
161@subsection Can I build RTEMS Canadian Cross?
162
163RTEMS >= 4.6.0 configuration is prepared for building RTEMS Canadian Cross,
164however building RTEMS Canadian Cross is known to be in its infancy, so
165your mileage may vary (See @code{README.cdn-X} in the toplevel directory of
166RTEMS's source tree for details.)
167
168@subsection Building RTEMS is slow
169
170RTEMS has become fairly large :).
171
172In comparison to building previous versions, building RTEMS is slow,
173 but that's the tradeoff to pay for simplier and safer configuration.
174
175If using Cygwin, remember that Cygwin is emulating one OS ontop of another
176 -- this necessarily must be significantly slower than using U*nix on the
177 same hardware.
178
179@subsection Building my pre-4.5.x BSPs does not work anymore
180
181See @ref{How to merge pre-RTEMS-4.5.0 BSPs into RTEMS-4.5.0?}.
182
183@subsection make debug_install / make profile_install
184
185[FIXME:Partially obsolete]
186
187These make targets are not supported anymore.  Instead, use:
188
189@example
190make VARIANT=DEBUG install
191make VARIANT=PROFILE install
192@end example
193
194@subsection make debug / make profile
195
196[FIXME:Partially obsolete]
197
198These make targets are not supported anymore.
199Instead, use:
200
201@example
202make VARIANT=DEBUG all
203make VARIANT=PROFILE all
204@end example
205
206
207@subsection Building RTEMS does not honor XXX_FOR_TARGET
208
209RTEMS < 4.6.0 did not support passing flags from the environment.
210If using RTEMS < 4.6.0, editing your BSP's @code{make/custom/mybsp.cfg} and
211setting appropriate flags there is required.
212
213RTEMS >= 4.6.0 honors several XXX_FOR_TARGET environment variables.
214Run @code{<path-to-rtems>/configure --help} for a full list of supported variables.
215
216@subsection Editing Makefile.in Makefile configure
217
218These files are generated by auto* tools, cf.
219@ref{Editing auto* generated files}).
220
221@subsection Editing auto* generated files
222
223RTEMS uses automake, therefore @b{never}, @b{ever}, @b{ever}
224edit Makefile.ins, Makefiles, configure or other auto* generated files.
225Changes to them will be swapped away soon and will get lost.
226
227Instead edit the sources (eg.: Makefile.ams, configure.acs) auto* generated
228files are generated from directly.
229
230If sending patches always send Makefile.ams and configure.acs.
231Sending Makefile.ins, Makefiles and configure scripts is pretty much useless.
232If sending larger patches, consider removing all auto* generated files
233by running @code{bootstrap -c} (cf. See @ref{./bootstrap})
234before running diff to cut a patch.
235
236If you don't understand what this is all about, try start getting familiar
237with auto* tools by reading autoconf.info and automake.info, or feel free
238to ask for assistance on the RTEMS Mailing List
239(See @ref{Are there any mailing lists?}.
240
241@section Host Operating Systems and RTEMS
242
243@subsection Can I use Windows or DOS?
244
245
246No, plain DOS and plain Win will not work, but Cygwin should.
247Other U*nix emulations, such as Mingw and DJGPP are not supported and very
248likely will not work.
249Cywin / WinNT is known to work, but at the time of writing this, there
250seem to persist non-RTEMS related issues with Cygwin under Win9x which
251seem to prevent success on those systems.
252
253@subsection Do I need Linux?
254
255
256No, you should be able to build RTEMS on any U*ix OS and under Cygwin/NT
257(cf. @ref{Can I use Windows or DOS?}).
258 
259@subsection Which Linux distribution is recommended?
260
261None, any recent U*nix should work, i.e.
262any recent Linux distribution should work, too.
263
264@section Development related questions
265
266@subsection How to merge pre-RTEMS-4.5.0 BSPs into RTEMS-4.5.0?
267
268[FIXME:Partially obsolete]
269
270The simple answer is that between 4.0 and 4.5.0, RTEMS has moved to automake
271and greater compliance with GNU conventions.
272In 4.0, there was a single configure script at the top of the tree.
273Now RTEMS is configured more like other GNU tools -- as a collection of
274configurable entities.
275
276Each BSP now has its own configure script.
277I highly recommend you look at the Makefile.am's, configure.ac, of a similar
278BSP.  You might even want to consider running "bootstrap -c" from the top of
279the tree and looking at what is left.  bootstrap (cf. @ref{./bootstrap})
280generates/removes all automatically generated files.
281
282@subsection What is no_bsp / no_cpu?
283
284@code{no_bsp} is a fictional BSP for a fictional CPU of type
285@code{no_cpu}.  @code{no_cpu/no_bsp} support files in RTEMS can be used as
286templates when implementing BSPs or porting RTEMS to new CPUs.
287
288@subsection What is the bare-BSP?
289
290At the time being RTEMS is build per BSP, with all support files being build
291separately for each BSP.  This can become unhandy when using several similar
292but not identical boards (e.g.  a PC with different peripherial cards plugged
293in), because this in general requires to implement a BSP for each setup.
294The bare BSP is a general, setup independent BSP which can be used when
295keeping all BSP specific parts external from RTEMS.
296
297At present time the bare BSP is in its infancy.
298It is known that it can be build for most CPUs RTEMS supports.
299It is also known to work in individual cases, but your mileage may vary.
300
301@subsection What is the cpukit?
302
303[FIXME:To be extended]
304
305One major change having been introduced to RTEMS-4.6.0 is the cpukit,
306located below the directory @code{cpukit/} in RTEMS's toplevel directory.
307
308@subsection Multilib vs.  RTEMS CPU-variants
309
310The GNU toolchain applies a specific classification of similar CPUs into
311CPU variants (eg.  SH1, SH2 etc.) to provide better support for each CPU variant.
312
313RTEMS uses a different classification because it internally requires more
314details about a specific CPU than the GNU toolchain's multilib classification
315provides.
316
317@subsection Keeping auto* generated files in CVS
318
319When using CVS to archive source code, problems arise from keeping generated
320files in CVS.  In general, two possible solutions exist:
321
322@itemize @bullet
323
324@item Find a way to get correct timestamps after checking out the sources
325from CVS.  Some people try to achieve this by
326
327@itemize @bullet
328@item carefully checking in files into CVS in appropriate order
329@item applying scripts to fix timestamps accordingling (eg.  by applying
330@code{touch} and @code{find}).
331@end itemize
332
333@item Not keeping generated files in CVS, but regenerate them after
334having checked them out from CVS.
335
336@end itemize
337
338RTEMS favors the the latter variant, because it appears to be less error-prone
339and easier to handle (cf. @ref{./bootstrap} for details).
340
341@subsection Importing RTEMS into CVS/RCS
342
343When importing RTEMS into CVS/RCS or similar, we recommend not to import
344auto* generated files (cf. @ref{Keeping auto* generated files in CVS}).
345
346To remove them before importing, run
347
348@example
349./bootstrap -c
350@end example
351
352from the toplevel directory of the source tree (cf. @ref{./bootstrap}).
353 
354@subsection ./bootstrap
355
356
357@code{bootstrap} is a simple shell script which automatically generates all
358auto* generated files within RTEMS's source tree (Other packages use the name
359@code{autogen.sh} for similar scripts).  You will need to have autoconf,
360automake and further underlying packages installed to apply it.
361
362It typically should be applied when having:
363
364@itemize @bullet
365
366@item checked out RTEMS sources from a CVS repository which does
367not contain generated files.
368
369@item added new automake / autoconf files to the source tree (eg.
370having added a new BSP), and when not being sure about what needs to be
371updated.
372
373@end itemize
374
375Once all autoconf/automake generated files are present, you will rarely
376need to run @code{bootstrap}, because automake automatically updates
377generated files when it detects some files need to be updated (Cf.
378@ref{configure --enable-maintainer-mode}).
379
380@subsection configure --enable-maintainer-mode
381
382When working within the source-tree, consider to append
383@code{--enable-maintainer-mode} to the options passed to configure RTEMS.
384
385@example
386<path>/rtems-@value{VERSION}/configure <options> --enable-maintainer-mode
387@end example
388
389This will enable the maintainer-mode in automake generated Makefiles, which
390will let automake take care about dependencies between auto* generated
391files.  I.e.  auto* generated files will get automatically updated.
392
393Configuring RTEMS in maintainer-mode will require to have autoconf, automake
394and underlying tools installed (Cf. @ref{Required Tools}).
395
396@subsection configure --program-[prefix|suffix|transform-name]
397
398These are generic configure script options automatically added by autoconf.
399RTEMS configuration does not support these, worse, they interfer with
400RTEMS's configuration -- i.e. @b{do not use them}.
401
402@subsection configure.ac vs. configure.in
403
404autoconf < 2.50 used the name @code{configure.in} for it's input files.
405autoconf >= 2.50 recommends using the name @code{configure.ac}, instead.
406
407RTEMS > 4.5.0 applies autoconf >= 2.50, therefore all former RTEMS's
408@code{configure.in}'s have been renamed into @code{configure.ac} and
409have been adapted to autoconf >= 2.50 demands.
410
411@subsection Reporting bugs
412
413Several possibilities (In decreasing preference):
414@itemize @bullet
415@item File a bug report at @uref{@value{RTEMSGNATS},RTEMS's GNATS}
416@item Send an email to @uref{mailto:@value{RTEMSBUGS},@value{RTEMSBUGS}}
417@item Report your problem to one of the RTEMS mailing lists
418(Cf. @ref{Are there any mailing lists?}).
419@end itemize
Note: See TracBrowser for help on using the repository browser.