diff options
Diffstat (limited to 'documentation/dev-manual')
| -rw-r--r-- | documentation/dev-manual/dev-manual-common-tasks.xml | 241 |
1 files changed, 241 insertions, 0 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index 3922c8f0f4..70cf6adf33 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml | |||
| @@ -7302,6 +7302,247 @@ Gateways via their Web Interfaces</ulink>"</emphasis> | |||
| 7302 | </section> | 7302 | </section> |
| 7303 | </section> | 7303 | </section> |
| 7304 | 7304 | ||
| 7305 | <section id='debugging-parallel-make-races'> | ||
| 7306 | <title>Debugging Parallel Make Races</title> | ||
| 7307 | |||
| 7308 | <para> | ||
| 7309 | A parallel <filename>make</filename> race occurs when the build | ||
| 7310 | consists of several parts that are run simultaneously and | ||
| 7311 | a situation occurs when the output or result of one | ||
| 7312 | part is not ready for use with a different part of the build that | ||
| 7313 | depends on that output. | ||
| 7314 | Parallel make races are annoying and can sometimes be difficult | ||
| 7315 | to reproduce and fix. | ||
| 7316 | However, some simple tips and tricks exist that can help | ||
| 7317 | you debug and fix them. | ||
| 7318 | This section presents a real-world example of an error encountered | ||
| 7319 | on the Yocto Project autobuilder and the process used to fix it. | ||
| 7320 | </para> | ||
| 7321 | |||
| 7322 | <section id='the-failure'> | ||
| 7323 | <title>The Failure</title> | ||
| 7324 | |||
| 7325 | <para> | ||
| 7326 | For this example, assume that you are building an image that | ||
| 7327 | depends on the "neard" package. | ||
| 7328 | And, during the build, BitBake runs into problems and | ||
| 7329 | creates the following output. | ||
| 7330 | <note> | ||
| 7331 | This example log file has longer lines artifically | ||
| 7332 | broken to make the listing easier to read. | ||
| 7333 | </note> | ||
| 7334 | If you examine the output or the log file, you see the | ||
| 7335 | failure during the | ||
| 7336 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-compile'><filename>do_compile</filename></ulink> | ||
| 7337 | task for "neard": | ||
| 7338 | <literallayout class='monospaced'> | ||
| 7339 | | DEBUG: SITE files ['endian-little', 'bit-32', 'ix86-common', 'common-linux', 'common-glibc', 'i586-linux', 'common'] | ||
| 7340 | | DEBUG: Executing shell function do_compile | ||
| 7341 | | NOTE: make -j 16 | ||
| 7342 | | make --no-print-directory all-am | ||
| 7343 | | /bin/mkdir -p include/near | ||
| 7344 | | /bin/mkdir -p include/near | ||
| 7345 | | /bin/mkdir -p include/near | ||
| 7346 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7347 | 0.14-r0/neard-0.14/include/types.h include/near/types.h | ||
| 7348 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7349 | 0.14-r0/neard-0.14/include/log.h include/near/log.h | ||
| 7350 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7351 | 0.14-r0/neard-0.14/include/plugin.h include/near/plugin.h | ||
| 7352 | | /bin/mkdir -p include/near | ||
| 7353 | | /bin/mkdir -p include/near | ||
| 7354 | | /bin/mkdir -p include/near | ||
| 7355 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7356 | 0.14-r0/neard-0.14/include/tag.h include/near/tag.h | ||
| 7357 | | /bin/mkdir -p include/near | ||
| 7358 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7359 | 0.14-r0/neard-0.14/include/adapter.h include/near/adapter.h | ||
| 7360 | | /bin/mkdir -p include/near | ||
| 7361 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7362 | 0.14-r0/neard-0.14/include/ndef.h include/near/ndef.h | ||
| 7363 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7364 | 0.14-r0/neard-0.14/include/tlv.h include/near/tlv.h | ||
| 7365 | | /bin/mkdir -p include/near | ||
| 7366 | | /bin/mkdir -p include/near | ||
| 7367 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7368 | 0.14-r0/neard-0.14/include/setting.h include/near/setting.h | ||
| 7369 | | /bin/mkdir -p include/near | ||
| 7370 | | /bin/mkdir -p include/near | ||
| 7371 | | /bin/mkdir -p include/near | ||
| 7372 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7373 | 0.14-r0/neard-0.14/include/device.h include/near/device.h | ||
| 7374 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7375 | 0.14-r0/neard-0.14/include/nfc_copy.h include/near/nfc_copy.h | ||
| 7376 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7377 | 0.14-r0/neard-0.14/include/snep.h include/near/snep.h | ||
| 7378 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7379 | 0.14-r0/neard-0.14/include/version.h include/near/version.h | ||
| 7380 | | ln -s /home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ | ||
| 7381 | 0.14-r0/neard-0.14/include/dbus.h include/near/dbus.h | ||
| 7382 | | ./src/genbuiltin nfctype1 nfctype2 nfctype3 nfctype4 p2p > src/builtin.h | ||
| 7383 | | i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/ | ||
| 7384 | build/build/tmp/sysroots/qemux86 -DHAVE_CONFIG_H -I. -I./include -I./src -I./gdbus -I/home/pokybuild/ | ||
| 7385 | yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/sysroots/qemux86/usr/include/glib-2.0 | ||
| 7386 | -I/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/tmp/sysroots/qemux86/usr/ | ||
| 7387 | lib/glib-2.0/include -I/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86/build/build/ | ||
| 7388 | tmp/sysroots/qemux86/usr/include/dbus-1.0 -I/home/pokybuild/yocto-autobuilder/yocto-slave/ | ||
| 7389 | nightly-x86/build/build/tmp/sysroots/qemux86/usr/lib/dbus-1.0/include -I/home/pokybuild/yocto-autobuilder/ | ||
| 7390 | yocto-slave/nightly-x86/build/build/tmp/sysroots/qemux86/usr/include/libnl3 | ||
| 7391 | -DNEAR_PLUGIN_BUILTIN -DPLUGINDIR=\""/usr/lib/near/plugins"\" | ||
| 7392 | -DCONFIGDIR=\""/etc/neard\"" -O2 -pipe -g -feliminate-unused-debug-types -c | ||
| 7393 | -o tools/snep-send.o tools/snep-send.c | ||
| 7394 | | In file included from tools/snep-send.c:16:0: | ||
| 7395 | | tools/../src/near.h:41:23: fatal error: near/dbus.h: No such file or directory | ||
| 7396 | | #include <near/dbus.h> | ||
| 7397 | | ^ | ||
| 7398 | | compilation terminated. | ||
| 7399 | | make[1]: *** [tools/snep-send.o] Error 1 | ||
| 7400 | | make[1]: *** Waiting for unfinished jobs.... | ||
| 7401 | | make: *** [all] Error 2 | ||
| 7402 | | ERROR: oe_runmake failed | ||
| 7403 | </literallayout> | ||
| 7404 | </para> | ||
| 7405 | </section> | ||
| 7406 | |||
| 7407 | <section id='reproducing-the-error'> | ||
| 7408 | <title>Reproducing the Error</title> | ||
| 7409 | |||
| 7410 | <para> | ||
| 7411 | Because race conditions are intermittent, they do not | ||
| 7412 | manifest themselves every time you do the build. | ||
| 7413 | In fact, most times the build will complete without problems | ||
| 7414 | even though the potential race condition exists. | ||
| 7415 | Thus, once the error surfaces, you need a way to reproduce it. | ||
| 7416 | </para> | ||
| 7417 | |||
| 7418 | <para> | ||
| 7419 | In this example, compiling the "neard" package is causing the | ||
| 7420 | problem. | ||
| 7421 | So the first thing to do is build "neard" locally. | ||
| 7422 | Before you start the build, set the | ||
| 7423 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKE'><filename>PARALLEL_MAKE</filename></ulink> | ||
| 7424 | variable in your <filename>local.conf</filename> file to | ||
| 7425 | a high number (e.g. 20). | ||
| 7426 | Using a high value for <filename>PARALLEL_MAKE</filename> | ||
| 7427 | increases the chances of the race condition showing up: | ||
| 7428 | <literallayout class='monospaced'> | ||
| 7429 | $ bitbake neard | ||
| 7430 | </literallayout> | ||
| 7431 | </para> | ||
| 7432 | |||
| 7433 | <para> | ||
| 7434 | Once the local build for "neard" completes, start a | ||
| 7435 | <filename>devshell</filename> build: | ||
| 7436 | <literallayout class='monospaced'> | ||
| 7437 | $ bitbake neard -c devshell | ||
| 7438 | </literallayout> | ||
| 7439 | For information on how to use a | ||
| 7440 | <filename>devshell</filename>, see the | ||
| 7441 | "<link linkend='platdev-appdev-devshell'>Using a Development Shell</link>" | ||
| 7442 | section. | ||
| 7443 | </para> | ||
| 7444 | |||
| 7445 | <para> | ||
| 7446 | In the <filename>devshell</filename>, do the following: | ||
| 7447 | <literallayout class='monospaced'> | ||
| 7448 | $ make clean | ||
| 7449 | $ make tools/snep-send.o | ||
| 7450 | </literallayout> | ||
| 7451 | The <filename>devshell</filename> commands cause the failure | ||
| 7452 | to clearly be visible. | ||
| 7453 | In this case, a missing dependency exists for the "neard" | ||
| 7454 | Makefile target. | ||
| 7455 | </para> | ||
| 7456 | </section> | ||
| 7457 | |||
| 7458 | <section id='creating-a-patch-for-the-fix'> | ||
| 7459 | <title>Creating a Patch for the Fix</title> | ||
| 7460 | |||
| 7461 | <para> | ||
| 7462 | Because there is a missing dependency for the Makefile | ||
| 7463 | target, you need to patch the | ||
| 7464 | <filename>Makefile.am</filename> file, which is generated | ||
| 7465 | from <filename>Makefile.in</filename>. | ||
| 7466 | You can use Quilt to create the patch: | ||
| 7467 | <literallayout class='monospaced'> | ||
| 7468 | $ quilt new parallelmake.patch | ||
| 7469 | $ quilt add Makefile.am | ||
| 7470 | </literallayout> | ||
| 7471 | For more information on using Quilt, see the | ||
| 7472 | "<link linkend='using-a-quilt-workflow'>Using a Quilt Workflow</link>" | ||
| 7473 | section. | ||
| 7474 | </para> | ||
| 7475 | |||
| 7476 | <para> | ||
| 7477 | At this point you need to make the edits to | ||
| 7478 | <filename>Makefile.am</filename> to add the missing | ||
| 7479 | dependency. | ||
| 7480 | For our example, you have to add the a | ||
| 7481 | <filename>"tools/snep-send.$(OBJEXT): include/near/dbus.h"</filename> | ||
| 7482 | line. | ||
| 7483 | </para> | ||
| 7484 | |||
| 7485 | <para> | ||
| 7486 | Once you have edited the file, use the | ||
| 7487 | <filename>refresh</filename> command to create the patch: | ||
| 7488 | <literallayout class='monospaced'> | ||
| 7489 | $ quilt refresh | ||
| 7490 | </literallayout> | ||
| 7491 | Once the patch file exists, you need to add it back to the | ||
| 7492 | originating recipe folder: | ||
| 7493 | <literallayout class='monospaced'> | ||
| 7494 | $ cp patches/parallemake.patch <location-of-neard-0.14-recipe-folder> | ||
| 7495 | </literallayout> | ||
| 7496 | The final thing you need to do to implement the fix in the | ||
| 7497 | build is to add the patch to the | ||
| 7498 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> | ||
| 7499 | statement in the "neard" recipe | ||
| 7500 | (<filename>neard-0.14.bb</filename>). | ||
| 7501 | </para> | ||
| 7502 | |||
| 7503 | <para> | ||
| 7504 | With the patch complete and moved to the correct folder and | ||
| 7505 | the <filename>SRC_URI</filename> statement updated, you can | ||
| 7506 | exit the <filename>devshell</filename>: | ||
| 7507 | <literallayout class='monospaced'> | ||
| 7508 | $ exit | ||
| 7509 | </literallayout> | ||
| 7510 | </para> | ||
| 7511 | </section> | ||
| 7512 | |||
| 7513 | <section id='testing-the-build'> | ||
| 7514 | <title>Testing the Build</title> | ||
| 7515 | |||
| 7516 | <para> | ||
| 7517 | With everything in place, you can get back to trying the | ||
| 7518 | build again locally: | ||
| 7519 | <literallayout class='monospaced'> | ||
| 7520 | $ bitbake neard | ||
| 7521 | </literallayout> | ||
| 7522 | This build should succeed. | ||
| 7523 | </para> | ||
| 7524 | |||
| 7525 | <para> | ||
| 7526 | Now you can open up a <filename>devshell</filename> again | ||
| 7527 | and repeat the clean and make operations as follows: | ||
| 7528 | <literallayout class='monospaced'> | ||
| 7529 | $ make clean | ||
| 7530 | $ make tools/snep-send.o | ||
| 7531 | </literallayout> | ||
| 7532 | The build should work without issue. | ||
| 7533 | </para> | ||
| 7534 | |||
| 7535 | <para> | ||
| 7536 | As with all solved problems, if they originated upstream, you | ||
| 7537 | need to submit the fix for the recipe in OE-Core and upstream | ||
| 7538 | so that the problem is taken care of at its source. | ||
| 7539 | See the | ||
| 7540 | "<link linkend='how-to-submit-a-change'>How to Submit a Change</link>" | ||
| 7541 | section for more information. | ||
| 7542 | </para> | ||
| 7543 | </section> | ||
| 7544 | </section> | ||
| 7545 | |||
| 7305 | <section id="examining-builds-using-toaster"> | 7546 | <section id="examining-builds-using-toaster"> |
| 7306 | <title>Examining Builds Using the Toaster API</title> | 7547 | <title>Examining Builds Using the Toaster API</title> |
| 7307 | 7548 | ||
