blob: 197d4907458c5d99a16996ec09e88ebde3d23119 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3[<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
4
5<chapter id='faq'>
6<title>FAQ</title>
7<qandaset>
8 <qandaentry>
9 <question>
10 <para>
11 How does Poky differ from <ulink url='&OE_HOME_URL;'>OpenEmbedded</ulink>?
12 </para>
13 </question>
14 <answer>
15 <para>
16 The term "<ulink url='&YOCTO_DOCS_DEV_URL;#poky'>Poky</ulink>"
17 refers to the specific reference build system that
18 the Yocto Project provides.
19 Poky is based on <ulink url='&YOCTO_DOCS_DEV_URL;#oe-core'>OE-Core</ulink>
20 and <ulink url='&YOCTO_DOCS_DEV_URL;#bitbake-term'>BitBake</ulink>.
21 Thus, the generic term used here for the build system is
22 the "OpenEmbedded build system."
23 Development in the Yocto Project using Poky is closely tied to OpenEmbedded, with
24 changes always being merged to OE-Core or BitBake first before being pulled back
25 into Poky.
26 This practice benefits both projects immediately.
27 </para>
28 </answer>
29 </qandaentry>
30
31 <qandaentry>
32 <question>
33 <para id='faq-not-meeting-requirements'>
34 My development system does not meet the
35 required Git, tar, and Python versions.
36 In particular, I do not have Python 2.7.3 or greater, or
37 I do have Python 3.x, which is specifically not supported by
38 the Yocto Project.
39 Can I still use the Yocto Project?
40 </para>
41 </question>
42 <answer>
43 <para>
44 You can get the required tools on your host development
45 system a couple different ways (i.e. building a tarball or
46 downloading a tarball).
47 See the
48 "<link linkend='required-git-tar-and-python-versions'>Required Git, tar, and Python Versions</link>"
49 section for steps on how to update your build tools.
50 </para>
51 </answer>
52 </qandaentry>
53
54 <qandaentry>
55 <question>
56 <para>
57 How can you claim Poky / OpenEmbedded-Core is stable?
58 </para>
59 </question>
60 <answer>
61 <para>
62 There are three areas that help with stability;
63 <itemizedlist>
64 <listitem><para>The Yocto Project team keeps
65 <ulink url='&YOCTO_DOCS_DEV_URL;#oe-core'>OE-Core</ulink> small
66 and focused, containing around 830 recipes as opposed to the thousands
67 available in other OpenEmbedded community layers.
68 Keeping it small makes it easy to test and maintain.</para></listitem>
69 <listitem><para>The Yocto Project team runs manual and automated tests
70 using a small, fixed set of reference hardware as well as emulated
71 targets.</para></listitem>
72 <listitem><para>The Yocto Project uses an autobuilder,
73 which provides continuous build and integration tests.</para></listitem>
74 </itemizedlist>
75 </para>
76 </answer>
77 </qandaentry>
78
79 <qandaentry>
80 <question>
81 <para>
82 How do I get support for my board added to the Yocto Project?
83 </para>
84 </question>
85 <answer>
86 <para>
87 Support for an additional board is added by creating a
88 Board Support Package (BSP) layer for it.
89 For more information on how to create a BSP layer, see the
90 "<ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>Understanding and Creating Layers</ulink>"
91 section in the Yocto Project Development Manual and the
92 <ulink url='&YOCTO_DOCS_BSP_URL;'>Yocto Project Board Support Package (BSP) Developer's Guide</ulink>.
93 </para>
94 <para>
95 Usually, if the board is not completely exotic, adding support in
96 the Yocto Project is fairly straightforward.
97 </para>
98 </answer>
99 </qandaentry>
100
101 <qandaentry>
102 <question>
103 <para>
104 Are there any products built using the OpenEmbedded build system?
105 </para>
106 </question>
107 <answer>
108 <para>
109 The software running on the <ulink url='http://vernier.com/labquest/'>Vernier LabQuest</ulink>
110 is built using the OpenEmbedded build system.
111 See the <ulink url='http://www.vernier.com/products/interfaces/labq/'>Vernier LabQuest</ulink>
112 website for more information.
113 There are a number of pre-production devices using the OpenEmbedded build system
114 and the Yocto Project team
115 announces them as soon as they are released.
116 </para>
117 </answer>
118 </qandaentry>
119
120 <qandaentry>
121 <question>
122 <para>
123 What does the OpenEmbedded build system produce as output?
124 </para>
125 </question>
126 <answer>
127 <para>
128 Because you can use the same set of recipes to create output of
129 various formats, the output of an OpenEmbedded build depends on
130 how you start it.
131 Usually, the output is a flashable image ready for the target
132 device.
133 </para>
134 </answer>
135 </qandaentry>
136
137 <qandaentry>
138 <question>
139 <para>
140 How do I add my package to the Yocto Project?
141 </para>
142 </question>
143 <answer>
144 <para>
145 To add a package, you need to create a BitBake recipe.
146 For information on how to create a BitBake recipe, see the
147 "<ulink url='&YOCTO_DOCS_DEV_URL;#new-recipe-writing-a-new-recipe'>Writing a New Recipe</ulink>"
148 in the Yocto Project Development Manual.
149 </para>
150 </answer>
151 </qandaentry>
152
153 <qandaentry>
154 <question>
155 <para>
156 Do I have to reflash my entire board with a new Yocto Project image when recompiling
157 a package?
158 </para>
159 </question>
160 <answer>
161 <para>
162 The OpenEmbedded build system can build packages in various
163 formats such as IPK for OPKG, Debian package
164 (<filename>.deb</filename>), or RPM.
165 You can then upgrade the packages using the package tools on
166 the device, much like on a desktop distribution such as
167 Ubuntu or Fedora.
168 However, package management on the target is entirely optional.
169 </para>
170 </answer>
171 </qandaentry>
172
173 <qandaentry>
174 <question>
175 <para>
176 I see the error '<filename>chmod: XXXXX new permissions are r-xrwxrwx, not r-xr-xr-x</filename>'.
177 What is wrong?
178 </para>
179 </question>
180 <answer>
181 <para>
182 You are probably running the build on an NTFS filesystem.
183 Use <filename>ext2</filename>, <filename>ext3</filename>, or <filename>ext4</filename> instead.
184 </para>
185 </answer>
186 </qandaentry>
187
188<!-- <qandaentry>
189 <question>
190 <para>
191 How do I make the Yocto Project work in RHEL/CentOS?
192 </para>
193 </question>
194 <answer>
195 <para>
196 To get the Yocto Project working under RHEL/CentOS 5.1 you need to first
197 install some required packages.
198 The standard CentOS packages needed are:
199 <itemizedlist>
200 <listitem><para>"Development tools" (selected during installation)</para></listitem>
201 <listitem><para><filename>texi2html</filename></para></listitem>
202 <listitem><para><filename>compat-gcc-34</filename></para></listitem>
203 </itemizedlist>
204 On top of these, you need the following external packages:
205 <itemizedlist>
206 <listitem><para><filename>python-sqlite2</filename> from
207 <ulink url='http://dag.wieers.com/rpm/packages/python-sqlite2/'>DAG repository</ulink>
208 </para></listitem>
209 <listitem><para><filename>help2man</filename> from
210 <ulink url='http://centos.karan.org/el4/extras/stable/x86_64/RPMS/repodata/repoview/help2man-0-1.33.1-2.html'>Karan repository</ulink></para></listitem>
211 </itemizedlist>
212 </para>
213
214 <para>
215 Once these packages are installed, the OpenEmbedded build system will be able
216 to build standard images.
217 However, there might be a problem with the QEMU emulator segfaulting.
218 You can either disable the generation of binary locales by setting
219 <filename><link linkend='var-ENABLE_BINARY_LOCALE_GENERATION'>ENABLE_BINARY_LOCALE_GENERATION</link>
220 </filename> to "0" or by removing the <filename>linux-2.6-execshield.patch</filename>
221 from the kernel and rebuilding it since that is the patch that causes the problems with QEMU.
222 </para>
223
224 <note>
225 <para>For information on distributions that the Yocto Project
226 uses during validation, see the
227 <ulink url='&YOCTO_WIKI_URL;/wiki/Distribution_Support'>Distribution Support</ulink>
228 Wiki page.</para>
229 <para>For notes about using the Yocto Project on a RHEL 4-based
230 host, see the
231 <ulink url='&YOCTO_WIKI_URL;/wiki/BuildingOnRHEL4'>Building on RHEL4</ulink>
232 Wiki page.</para>
233 </note>
234 </answer>
235 </qandaentry> -->
236
237 <qandaentry>
238 <question>
239 <para>
240 I see lots of 404 responses for files on
241 <filename>&YOCTO_HOME_URL;/sources/*</filename>. Is something wrong?
242 </para>
243 </question>
244 <answer>
245 <para>
246 Nothing is wrong.
247 The OpenEmbedded build system checks any configured source mirrors before downloading
248 from the upstream sources.
249 The build system does this searching for both source archives and
250 pre-checked out versions of SCM-managed software.
251 These checks help in large installations because it can reduce load on the SCM servers
252 themselves.
253 The address above is one of the default mirrors configured into the
254 build system.
255 Consequently, if an upstream source disappears, the team
256 can place sources there so builds continue to work.
257 </para>
258 </answer>
259 </qandaentry>
260
261 <qandaentry>
262 <question>
263 <para>
264 I have machine-specific data in a package for one machine only but the package is
265 being marked as machine-specific in all cases, how do I prevent this?
266 </para>
267 </question>
268 <answer>
269 <para>
270 Set <filename><link linkend='var-SRC_URI_OVERRIDES_PACKAGE_ARCH'>SRC_URI_OVERRIDES_PACKAGE_ARCH</link>
271 </filename> = "0" in the <filename>.bb</filename> file but make sure the package is
272 manually marked as
273 machine-specific for the case that needs it.
274 The code that handles
275 <filename>SRC_URI_OVERRIDES_PACKAGE_ARCH</filename> is in
276 the <filename>meta/classes/base.bbclass</filename> file.
277 </para>
278 </answer>
279 </qandaentry>
280
281 <qandaentry>
282 <question>
283 <para>
284 I'm behind a firewall and need to use a proxy server. How do I do that?
285 </para>
286 </question>
287 <answer>
288 <para>
289 Most source fetching by the OpenEmbedded build system is done by <filename>wget</filename>
290 and you therefore need to specify the proxy settings in a
291 <filename>.wgetrc</filename> file in your home directory.
292 Here are some example settings:
293 <literallayout class='monospaced'>
294 http_proxy = http://proxy.yoyodyne.com:18023/
295 ftp_proxy = http://proxy.yoyodyne.com:18023/
296 </literallayout>
297 The Yocto Project also includes a
298 <filename>site.conf.sample</filename> file that shows how to
299 configure CVS and Git proxy servers if needed.
300 </para>
301 </answer>
302 </qandaentry>
303
304 <qandaentry>
305 <question>
306 <para>
307 What’s the difference between <replaceable>target</replaceable> and <replaceable>target</replaceable><filename>-native</filename>?
308 </para>
309 </question>
310 <answer>
311 <para>
312 The <filename>*-native</filename> targets are designed to run on the system
313 being used for the build.
314 These are usually tools that are needed to assist the build in some way such as
315 <filename>quilt-native</filename>, which is used to apply patches.
316 The non-native version is the one that runs on the target device.
317 </para>
318 </answer>
319 </qandaentry>
320
321 <qandaentry>
322 <question>
323 <para>
324 I'm seeing random build failures. Help?!
325 </para>
326 </question>
327 <answer>
328 <para>
329 If the same build is failing in totally different and random
330 ways, the most likely explanation is:
331 <itemizedlist>
332 <listitem><para>The hardware you are running the build on
333 has some problem.</para></listitem>
334 <listitem><para>You are running the build under
335 virtualization, in which case the virtualization
336 probably has bugs.</para></listitem>
337 </itemizedlist>
338 The OpenEmbedded build system processes a massive amount of
339 data that causes lots of network, disk and CPU activity and
340 is sensitive to even single-bit failures in any of these areas.
341 True random failures have always been traced back to hardware
342 or virtualization issues.
343 </para>
344 </answer>
345 </qandaentry>
346
347 <qandaentry>
348 <question>
349 <para>
350 When I try to build a native recipe, the build fails with <filename>iconv.h</filename> problems.
351 </para>
352 </question>
353 <answer>
354 <para>
355 If you get an error message that indicates GNU
356 <filename>libiconv</filename> is not in use but
357 <filename>iconv.h</filename> has been included from
358 <filename>libiconv</filename>, you need to check to see if
359 you have a previously installed version of the header file
360 in <filename>/usr/local/include</filename>.
361 <literallayout class='monospaced'>
362 #error GNU libiconv not in use but included iconv.h is from libiconv
363 </literallayout>
364 If you find a previously installed file, you should either
365 uninstall it or temporarily rename it and try the build again.
366 </para>
367
368 <para>
369 This issue is just a single manifestation of "system
370 leakage" issues caused when the OpenEbedded build system
371 finds and uses previously installed files during a native
372 build.
373 This type of issue might not be limited to
374 <filename>iconv.h</filename>.
375 Be sure that leakage cannot occur from
376 <filename>/usr/local/include</filename> and
377 <filename>/opt</filename> locations.
378 </para>
379 </answer>
380 </qandaentry>
381
382 <qandaentry>
383 <question>
384 <para>
385 What do we need to ship for license compliance?
386 </para>
387 </question>
388 <answer>
389 <para>
390 This is a difficult question and you need to consult your lawyer
391 for the answer for your specific case.
392 It is worth bearing in mind that for GPL compliance, there needs
393 to be enough information shipped to allow someone else to
394 rebuild and produce the same end result you are shipping.
395 This means sharing the source code, any patches applied to it,
396 and also any configuration information about how that package
397 was configured and built.
398 </para>
399
400 <para>
401 You can find more information on licensing in the
402 "<ulink url='&YOCTO_DOCS_DEV_URL;#licensing'>Licensing</ulink>"
403 and "<ulink url='&YOCTO_DOCS_DEV_URL;#maintaining-open-source-license-compliance-during-your-products-lifecycle'>Maintaining Open Source License Compliance During Your Product's Lifecycle</ulink>"
404 sections, both of which are in the Yocto Project Development
405 Manual.
406 </para>
407 </answer>
408 </qandaentry>
409
410 <qandaentry>
411 <question>
412 <para>
413 How do I disable the cursor on my touchscreen device?
414 </para>
415 </question>
416 <answer>
417 <para>
418 You need to create a form factor file as described in the
419 "<ulink url='&YOCTO_DOCS_BSP_URL;#bsp-filelayout-misc-recipes'>Miscellaneous BSP-Specific Recipe Files</ulink>"
420 section in the Yocto Project Board Support Packages (BSP)
421 Developer's Guide.
422 Set the <filename>HAVE_TOUCHSCREEN</filename> variable equal to
423 one as follows:
424 <literallayout class='monospaced'>
425 HAVE_TOUCHSCREEN=1
426 </literallayout>
427 </para>
428 </answer>
429 </qandaentry>
430
431 <qandaentry>
432 <question>
433 <para>
434 How do I make sure connected network interfaces are brought up by default?
435 </para>
436 </question>
437 <answer>
438 <para>
439 The default interfaces file provided by the netbase recipe does not
440 automatically bring up network interfaces.
441 Therefore, you will need to add a BSP-specific netbase that includes an interfaces
442 file.
443 See the "<ulink url='&YOCTO_DOCS_BSP_URL;#bsp-filelayout-misc-recipes'>Miscellaneous BSP-Specific Recipe Files</ulink>"
444 section in the Yocto Project Board Support Packages (BSP)
445 Developer's Guide for information on creating these types of
446 miscellaneous recipe files.
447 </para>
448 <para>
449 For example, add the following files to your layer:
450 <literallayout class='monospaced'>
451 meta-MACHINE/recipes-bsp/netbase/netbase/MACHINE/interfaces
452 meta-MACHINE/recipes-bsp/netbase/netbase_5.0.bbappend
453 </literallayout>
454 </para>
455 </answer>
456 </qandaentry>
457
458 <qandaentry>
459 <question>
460 <para>
461 How do I create images with more free space?
462 </para>
463 </question>
464 <answer>
465 <para>
466 By default, the OpenEmbedded build system creates images
467 that are 1.3 times the size of the populated root filesystem.
468 To affect the image size, you need to set various
469 configurations:
470 <itemizedlist>
471 <listitem><para><emphasis>Image Size:</emphasis>
472 The OpenEmbedded build system uses the
473 <link linkend='var-IMAGE_ROOTFS_SIZE'><filename>IMAGE_ROOTFS_SIZE</filename></link>
474 variable to define the size of the image in Kbytes.
475 The build system determines the size by taking into
476 account the initial root filesystem size before any
477 modifications such as requested size for the image and
478 any requested additional free disk space to be
479 added to the image.</para></listitem>
480 <listitem><para><emphasis>Overhead:</emphasis>
481 Use the
482 <link linkend='var-IMAGE_OVERHEAD_FACTOR'><filename>IMAGE_OVERHEAD_FACTOR</filename></link>
483 variable to define the multiplier that the build system
484 applies to the initial image size, which is 1.3 by
485 default.</para></listitem>
486 <listitem><para><emphasis>Additional Free Space:</emphasis>
487 Use the
488 <link linkend='var-IMAGE_ROOTFS_EXTRA_SPACE'><filename>IMAGE_ROOTFS_EXTRA_SPACE</filename></link>
489 variable to add additional free space to the image.
490 The build system adds this space to the image after
491 it determines its
492 <filename>IMAGE_ROOTFS_SIZE</filename>.
493 </para></listitem>
494 </itemizedlist>
495 </para>
496 </answer>
497 </qandaentry>
498
499 <qandaentry>
500 <question>
501 <para>
502 Why don't you support directories with spaces in the pathnames?
503 </para>
504 </question>
505 <answer>
506 <para>
507 The Yocto Project team has tried to do this before but too
508 many of the tools the OpenEmbedded build system depends on,
509 such as <filename>autoconf</filename>, break when they find
510 spaces in pathnames.
511 Until that situation changes, the team will not support spaces
512 in pathnames.
513 </para>
514 </answer>
515 </qandaentry>
516
517 <qandaentry>
518 <question>
519 <para>
520 How do I use an external toolchain?
521 </para>
522 </question>
523 <answer>
524 <para>
525 The toolchain configuration is very flexible and customizable.
526 It is primarily controlled with the
527 <filename><link linkend='var-TCMODE'>TCMODE</link></filename>
528 variable.
529 This variable controls which <filename>tcmode-*.inc</filename>
530 file to include from the
531 <filename>meta/conf/distro/include</filename> directory within
532 the
533 <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>.
534 </para>
535
536 <para>
537 The default value of <filename>TCMODE</filename> is "default",
538 which tells the OpenEmbedded build system to use its internally
539 built toolchain (i.e. <filename>tcmode-default.inc</filename>).
540 However, other patterns are accepted.
541 In particular, "external-*" refers to external toolchains.
542 One example is the Sourcery G++ Toolchain.
543 The support for this toolchain resides in the separate
544 <filename>meta-sourcery</filename> layer at
545 <ulink url='http://github.com/MentorEmbedded/meta-sourcery/'></ulink>.
546 </para>
547
548 <para>
549 In addition to the toolchain configuration, you also need a
550 corresponding toolchain recipe file.
551 This recipe file needs to package up any pre-built objects in
552 the toolchain such as <filename>libgcc</filename>,
553 <filename>libstdcc++</filename>, any locales, and
554 <filename>libc</filename>.
555 </para>
556 </answer>
557 </qandaentry>
558
559 <qandaentry>
560 <question>
561 <para id='how-does-the-yocto-project-obtain-source-code-and-will-it-work-behind-my-firewall-or-proxy-server'>
562 How does the OpenEmbedded build system obtain source code and
563 will it work behind my firewall or proxy server?
564 </para>
565 </question>
566 <answer>
567 <para>
568 The way the build system obtains source code is highly
569 configurable.
570 You can setup the build system to get source code in most
571 environments if HTTP transport is available.
572 </para>
573 <para>
574 When the build system searches for source code, it first
575 tries the local download directory.
576 If that location fails, Poky tries
577 <link linkend='var-PREMIRRORS'><filename>PREMIRRORS</filename></link>,
578 the upstream source, and then
579 <link linkend='var-MIRRORS'><filename>MIRRORS</filename></link>
580 in that order.
581 </para>
582 <para>
583 Assuming your distribution is "poky", the OpenEmbedded build
584 system uses the Yocto Project source
585 <filename>PREMIRRORS</filename> by default for SCM-based
586 sources, upstreams for normal tarballs, and then falls back
587 to a number of other mirrors including the Yocto Project
588 source mirror if those fail.
589 </para>
590 <para>
591 As an example, you could add a specific server for the
592 build system to attempt before any others by adding something
593 like the following to the <filename>local.conf</filename>
594 configuration file:
595 <literallayout class='monospaced'>
596 PREMIRRORS_prepend = "\
597 git://.*/.* http://www.yoctoproject.org/sources/ \n \
598 ftp://.*/.* http://www.yoctoproject.org/sources/ \n \
599 http://.*/.* http://www.yoctoproject.org/sources/ \n \
600 https://.*/.* http://www.yoctoproject.org/sources/ \n"
601 </literallayout>
602 </para>
603 <para>
604 These changes cause the build system to intercept Git, FTP,
605 HTTP, and HTTPS requests and direct them to the
606 <filename>http://</filename> sources mirror.
607 You can use <filename>file://</filename> URLs to point to
608 local directories or network shares as well.
609 </para>
610 <para>
611 Aside from the previous technique, these options also exist:
612 <literallayout class='monospaced'>
613 BB_NO_NETWORK = "1"
614 </literallayout>
615 This statement tells BitBake to issue an error instead of
616 trying to access the Internet.
617 This technique is useful if you want to ensure code builds
618 only from local sources.
619 </para>
620 <para>
621 Here is another technique:
622 <literallayout class='monospaced'>
623 BB_FETCH_PREMIRRORONLY = "1"
624 </literallayout>
625 This statement limits the build system to pulling source
626 from the <filename>PREMIRRORS</filename> only.
627 Again, this technique is useful for reproducing builds.
628 </para>
629 <para>
630 Here is another technique:
631 <literallayout class='monospaced'>
632 BB_GENERATE_MIRROR_TARBALLS = "1"
633 </literallayout>
634 This statement tells the build system to generate mirror
635 tarballs.
636 This technique is useful if you want to create a mirror server.
637 If not, however, the technique can simply waste time during
638 the build.
639 </para>
640 <para>
641 Finally, consider an example where you are behind an
642 HTTP-only firewall.
643 You could make the following changes to the
644 <filename>local.conf</filename> configuration file as long as
645 the <filename>PREMIRRORS</filename> server is current:
646 <literallayout class='monospaced'>
647 PREMIRRORS_prepend = "\
648 ftp://.*/.* http://www.yoctoproject.org/sources/ \n \
649 http://.*/.* http://www.yoctoproject.org/sources/ \n \
650 https://.*/.* http://www.yoctoproject.org/sources/ \n"
651 BB_FETCH_PREMIRRORONLY = "1"
652 </literallayout>
653 These changes would cause the build system to successfully
654 fetch source over HTTP and any network accesses to anything
655 other than the <filename>PREMIRRORS</filename> would fail.
656 </para>
657 <para>
658 The build system also honors the standard shell environment
659 variables <filename>http_proxy</filename>,
660 <filename>ftp_proxy</filename>,
661 <filename>https_proxy</filename>, and
662 <filename>all_proxy</filename> to redirect requests through
663 proxy servers.
664 </para>
665 <note>
666 You can find more information on the
667 "<ulink url='&YOCTO_WIKI_URL;/wiki/Working_Behind_a_Network_Proxy'>Working Behind a Network Proxy</ulink>"
668 Wiki page.
669 </note>
670 </answer>
671 </qandaentry>
672
673 <qandaentry>
674 <question>
675 <para>
676 Can I get rid of build output so I can start over?
677 </para>
678 </question>
679 <answer>
680 <para>
681 Yes - you can easily do this.
682 When you use BitBake to build an image, all the build output
683 goes into the directory created when you run the
684 build environment setup script (i.e.
685 <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>
686 or
687 <link linkend='structure-memres-core-script'><filename>oe-init-build-env-memres</filename></link>).
688 By default, this <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>
689 is named <filename>build</filename> but can be named
690 anything you want.
691 </para>
692
693 <para>
694 Within the Build Directory, is the <filename>tmp</filename>
695 directory.
696 To remove all the build output yet preserve any source code or
697 downloaded files from previous builds, simply remove the
698 <filename>tmp</filename> directory.
699 </para>
700 </answer>
701 </qandaentry>
702
703 <qandaentry>
704 <question>
705 <para>
706 Why do <filename>${bindir}</filename> and <filename>${libdir}</filename> have strange values for <filename>-native</filename> recipes?
707 </para>
708 </question>
709 <answer>
710 <para>
711 Executables and libraries might need to be used from a
712 directory other than the directory into which they were
713 initially installed.
714 Complicating this situation is the fact that sometimes these
715 executables and libraries are compiled with the expectation
716 of being run from that initial installation target directory.
717 If this is the case, moving them causes problems.
718 </para>
719
720 <para>
721 This scenario is a fundamental problem for package maintainers
722 of mainstream Linux distributions as well as for the
723 OpenEmbedded build system.
724 As such, a well-established solution exists.
725 Makefiles, Autotools configuration scripts, and other build
726 systems are expected to respect environment variables such as
727 <filename>bindir</filename>, <filename>libdir</filename>,
728 and <filename>sysconfdir</filename> that indicate where
729 executables, libraries, and data reside when a program is
730 actually run.
731 They are also expected to respect a
732 <filename>DESTDIR</filename> environment variable, which is
733 prepended to all the other variables when the build system
734 actually installs the files.
735 It is understood that the program does not actually run from
736 within <filename>DESTDIR</filename>.
737 </para>
738
739 <para>
740 When the OpenEmbedded build system uses a recipe to build a
741 target-architecture program (i.e. one that is intended for
742 inclusion on the image being built), that program eventually
743 runs from the root file system of that image.
744 Thus, the build system provides a value of "/usr/bin" for
745 <filename>bindir</filename>, a value of "/usr/lib" for
746 <filename>libdir</filename>, and so forth.
747 </para>
748
749 <para>
750 Meanwhile, <filename>DESTDIR</filename> is a path within the
751 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>.
752 However, when the recipe builds a native program (i.e. one
753 that is intended to run on the build machine), that program
754 is never installed directly to the build machine's root
755 file system.
756 Consequently, the build system uses paths within the Build
757 Directory for <filename>DESTDIR</filename>,
758 <filename>bindir</filename> and related variables.
759 To better understand this, consider the following two paths
760 where the first is relatively normal and the second is not:
761 <note>
762 Due to these lengthy examples, the paths are artificially
763 broken across lines for readability.
764 </note>
765 <literallayout class='monospaced'>
766 /home/maxtothemax/poky-bootchart2/build/tmp/work/i586-poky-linux/zlib/
767 1.2.8-r0/sysroot-destdir/usr/bin
768
769 /home/maxtothemax/poky-bootchart2/build/tmp/work/x86_64-linux/
770 zlib-native/1.2.8-r0/sysroot-destdir/home/maxtothemax/poky-bootchart2/
771 build/tmp/sysroots/x86_64-linux/usr/bin
772 </literallayout>
773 Even if the paths look unusual, they both are correct -
774 the first for a target and the second for a native recipe.
775 These paths are a consequence of the
776 <filename>DESTDIR</filename> mechanism and while they
777 appear strange, they are correct and in practice very effective.
778 </para>
779 </answer>
780 </qandaentry>
781
782 <qandaentry>
783 <question>
784 <para>
785 The files provided by my <filename>-native</filename> recipe do
786 not appear to be available to other recipes.
787 Files are missing from the native sysroot, my recipe is
788 installing to the wrong place, or I am getting permissions
789 errors during the do_install task in my recipe! What is wrong?
790 </para>
791 </question>
792 <answer>
793 <para>
794 This situation results when a build system does
795 not recognize the environment variables supplied to it by
796 <ulink url='&YOCTO_DOCS_DEV_URL;#bitbake-term'>BitBake</ulink>.
797 The incident that prompted this FAQ entry involved a Makefile
798 that used an environment variable named
799 <filename>BINDIR</filename> instead of the more standard
800 variable <filename>bindir</filename>.
801 The makefile's hardcoded default value of "/usr/bin" worked
802 most of the time, but not for the recipe's
803 <filename>-native</filename> variant.
804 For another example, permissions errors might be caused
805 by a Makefile that ignores <filename>DESTDIR</filename> or uses
806 a different name for that environment variable.
807 Check the the build system to see if these kinds of
808 issues exist.
809 </para>
810 </answer>
811 </qandaentry>
812
813</qandaset>
814</chapter>
815<!--
816vim: expandtab tw=80 ts=4
817-->