ref-qa-checks.rst 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. *****************************
  3. QA Error and Warning Messages
  4. *****************************
  5. .. _qa-introduction:
  6. Introduction
  7. ============
  8. When building a recipe, the OpenEmbedded build system performs various
  9. QA checks on the output to ensure that common issues are detected and
  10. reported. Sometimes when you create a new recipe to build new software,
  11. it will build with no problems. When this is not the case, or when you
  12. have QA issues building any software, it could take a little time to
  13. resolve them.
  14. While it is tempting to ignore a QA message or even to disable QA
  15. checks, it is best to try and resolve any reported QA issues. This
  16. chapter provides a list of the QA messages and brief explanations of the
  17. issues you could encounter so that you can properly resolve problems.
  18. The next section provides a list of all QA error and warning messages
  19. based on a default configuration. Each entry provides the message or
  20. error form along with an explanation.
  21. .. note::
  22. - At the end of each message, the name of the associated QA test (as
  23. listed in the ":ref:`insane.bbclass <ref-classes-insane>`"
  24. section) appears within square brackets.
  25. - As mentioned, this list of error and warning messages is for QA
  26. checks only. The list does not cover all possible build errors or
  27. warnings you could encounter.
  28. - Because some QA checks are disabled by default, this list does not
  29. include all possible QA check errors and warnings.
  30. .. _qa-errors-and-warnings:
  31. Errors and Warnings
  32. ===================
  33. - ``<packagename>: <path> is using libexec please relocate to <libexecdir> [libexec]``
  34. The specified package contains files in ``/usr/libexec`` when the
  35. distro configuration uses a different path for ``<libexecdir>`` By
  36. default, ``<libexecdir>`` is ``$prefix/libexec``. However, this
  37. default can be changed (e.g. ``${libdir}``).
  38.  
  39. - ``package <packagename> contains bad RPATH <rpath> in file <file> [rpaths]``
  40. The specified binary produced by the recipe contains dynamic library
  41. load paths (rpaths) that contain build system paths such as
  42. :term:`TMPDIR`, which are incorrect for the target and
  43. could potentially be a security issue. Check for bad ``-rpath``
  44. options being passed to the linker in your
  45. :ref:`ref-tasks-compile` log. Depending on the build
  46. system used by the software being built, there might be a configure
  47. option to disable rpath usage completely within the build of the
  48. software.
  49.  
  50. - ``<packagename>: <file> contains probably-redundant RPATH <rpath> [useless-rpaths]``
  51. The specified binary produced by the recipe contains dynamic library
  52. load paths (rpaths) that on a standard system are searched by default
  53. by the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths
  54. will not cause any breakage, they do waste space and are unnecessary.
  55. Depending on the build system used by the software being built, there
  56. might be a configure option to disable rpath usage completely within
  57. the build of the software.
  58.  
  59. - ``<packagename> requires <files>, but no providers in its RDEPENDS [file-rdeps]``
  60. A file-level dependency has been identified from the specified
  61. package on the specified files, but there is no explicit
  62. corresponding entry in :term:`RDEPENDS`. If
  63. particular files are required at runtime then ``RDEPENDS`` should be
  64. declared in the recipe to ensure the packages providing them are
  65. built.
  66.  
  67. - ``<packagename1> rdepends on <packagename2>, but it isn't a build dependency? [build-deps]``
  68. A runtime dependency exists between the two specified packages, but
  69. there is nothing explicit within the recipe to enable the
  70. OpenEmbedded build system to ensure that dependency is satisfied.
  71. This condition is usually triggered by an
  72. :term:`RDEPENDS` value being added at the packaging
  73. stage rather than up front, which is usually automatic based on the
  74. contents of the package. In most cases, you should change the recipe
  75. to add an explicit ``RDEPENDS`` for the dependency.
  76.  
  77. - ``non -dev/-dbg/nativesdk- package contains symlink .so: <packagename> path '<path>' [dev-so]``
  78. Symlink ``.so`` files are for development only, and should therefore
  79. go into the ``-dev`` package. This situation might occur if you add
  80. ``*.so*`` rather than ``*.so.*`` to a non-dev package. Change
  81. :term:`FILES` (and possibly
  82. :term:`PACKAGES`) such that the specified ``.so``
  83. file goes into an appropriate ``-dev`` package.
  84.  
  85. - ``non -staticdev package contains static .a library: <packagename> path '<path>' [staticdev]``
  86. Static ``.a`` library files should go into a ``-staticdev`` package.
  87. Change :term:`FILES` (and possibly
  88. :term:`PACKAGES`) such that the specified ``.a`` file
  89. goes into an appropriate ``-staticdev`` package.
  90.  
  91. - ``<packagename>: found library in wrong location [libdir]``
  92. The specified file may have been installed into an incorrect
  93. (possibly hardcoded) installation path. For example, this test will
  94. catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
  95. "lib32". Another example is when recipes install
  96. ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib". False
  97. positives occasionally exist. For these cases add "libdir" to
  98. :term:`INSANE_SKIP` for the package.
  99.  
  100. - ``non debug package contains .debug directory: <packagename> path <path> [debug-files]``
  101. The specified package contains a ``.debug`` directory, which should
  102. not appear in anything but the ``-dbg`` package. This situation might
  103. occur if you add a path which contains a ``.debug`` directory and do
  104. not explicitly add the ``.debug`` directory to the ``-dbg`` package.
  105. If this is the case, add the ``.debug`` directory explicitly to
  106. ``FILES_${PN}-dbg``. See :term:`FILES` for additional
  107. information on ``FILES``.
  108.  
  109. - ``Architecture did not match (<machine_arch> to <file_arch>) on <file> [arch]``
  110. By default, the OpenEmbedded build system checks the Executable and
  111. Linkable Format (ELF) type, bit size, and endianness of any binaries
  112. to ensure they match the target architecture. This test fails if any
  113. binaries do not match the type since there would be an
  114. incompatibility. The test could indicate that the wrong compiler or
  115. compiler options have been used. Sometimes software, like
  116. bootloaders, might need to bypass this check. If the file you receive
  117. the error for is firmware that is not intended to be executed within
  118. the target operating system or is intended to run on a separate
  119. processor within the device, you can add "arch" to
  120. :term:`INSANE_SKIP` for the package. Another
  121. option is to check the :ref:`ref-tasks-compile` log
  122. and verify that the compiler options being used are correct.
  123.  
  124. - ``Bit size did not match (<machine_bits> to <file_bits>) <recipe> on <file> [arch]``
  125. By default, the OpenEmbedded build system checks the Executable and
  126. Linkable Format (ELF) type, bit size, and endianness of any binaries
  127. to ensure they match the target architecture. This test fails if any
  128. binaries do not match the type since there would be an
  129. incompatibility. The test could indicate that the wrong compiler or
  130. compiler options have been used. Sometimes software, like
  131. bootloaders, might need to bypass this check. If the file you receive
  132. the error for is firmware that is not intended to be executed within
  133. the target operating system or is intended to run on a separate
  134. processor within the device, you can add "arch" to
  135. :term:`INSANE_SKIP` for the package. Another
  136. option is to check the :ref:`ref-tasks-compile` log
  137. and verify that the compiler options being used are correct.
  138.  
  139. - ``Endianness did not match (<machine_endianness> to <file_endianness>) on <file> [arch]``
  140. By default, the OpenEmbedded build system checks the Executable and
  141. Linkable Format (ELF) type, bit size, and endianness of any binaries
  142. to ensure they match the target architecture. This test fails if any
  143. binaries do not match the type since there would be an
  144. incompatibility. The test could indicate that the wrong compiler or
  145. compiler options have been used. Sometimes software, like
  146. bootloaders, might need to bypass this check. If the file you receive
  147. the error for is firmware that is not intended to be executed within
  148. the target operating system or is intended to run on a separate
  149. processor within the device, you can add "arch" to
  150. :term:`INSANE_SKIP` for the package. Another
  151. option is to check the :ref:`ref-tasks-compile` log
  152. and verify that the compiler options being used are correct.
  153.  
  154. - ``ELF binary '<file>' has relocations in .text [textrel]``
  155. The specified ELF binary contains relocations in its ``.text``
  156. sections. This situation can result in a performance impact at
  157. runtime.
  158. Typically, the way to solve this performance issue is to add "-fPIC"
  159. or "-fpic" to the compiler command-line options. For example, given
  160. software that reads :term:`CFLAGS` when you build it,
  161. you could add the following to your recipe:
  162. ::
  163. CFLAGS_append = " -fPIC "
  164. For more information on text relocations at runtime, see
  165. http://www.akkadia.org/drepper/textrelocs.html.
  166.  
  167. - ``No GNU_HASH in the elf binary: '<file>' [ldflags]``
  168. This indicates that binaries produced when building the recipe have
  169. not been linked with the :term:`LDFLAGS` options
  170. provided by the build system. Check to be sure that the ``LDFLAGS``
  171. variable is being passed to the linker command. A common workaround
  172. for this situation is to pass in ``LDFLAGS`` using
  173. :term:`TARGET_CC_ARCH` within the recipe as
  174. follows:
  175. ::
  176. TARGET_CC_ARCH += "${LDFLAGS}"
  177.  
  178. - ``Package <packagename> contains Xorg driver (<driver>) but no xorg-abi- dependencies [xorg-driver-abi]``
  179. The specified package contains an Xorg driver, but does not have a
  180. corresponding ABI package dependency. The xserver-xorg recipe
  181. provides driver ABI names. All drivers should depend on the ABI
  182. versions that they have been built against. Driver recipes that
  183. include ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
  184. automatically get these versions. Consequently, you should only need
  185. to explicitly add dependencies to binary driver recipes.
  186.  
  187. - ``The /usr/share/info/dir file is not meant to be shipped in a particular package. [infodir]``
  188. The ``/usr/share/info/dir`` should not be packaged. Add the following
  189. line to your :ref:`ref-tasks-install` task or to your
  190. ``do_install_append`` within the recipe as follows:
  191. ::
  192. rm ${D}${infodir}/dir
  193.  
  194. - ``Symlink <path> in <packagename> points to TMPDIR [symlink-to-sysroot]``
  195. The specified symlink points into :term:`TMPDIR` on the
  196. host. Such symlinks will work on the host. However, they are clearly
  197. invalid when running on the target. You should either correct the
  198. symlink to use a relative path or remove the symlink.
  199.  
  200. - ``<file> failed sanity test (workdir) in path <path> [la]``
  201. The specified ``.la`` file contains :term:`TMPDIR`
  202. paths. Any ``.la`` file containing these paths is incorrect since
  203. ``libtool`` adds the correct sysroot prefix when using the files
  204. automatically itself.
  205.  
  206. - ``<file> failed sanity test (tmpdir) in path <path> [pkgconfig]``
  207. The specified ``.pc`` file contains
  208. :term:`TMPDIR`\ ``/``\ :term:`WORKDIR`
  209. paths. Any ``.pc`` file containing these paths is incorrect since
  210. ``pkg-config`` itself adds the correct sysroot prefix when the files
  211. are accessed.
  212.  
  213. - ``<packagename> rdepends on <debug_packagename> [debug-deps]``
  214. A dependency exists between the specified non-dbg package (i.e. a
  215. package whose name does not end in ``-dbg``) and a package that is a
  216. ``dbg`` package. The ``dbg`` packages contain debug symbols and are
  217. brought in using several different methods:
  218. - Using the ``dbg-pkgs``
  219. :term:`IMAGE_FEATURES` value.
  220. - Using :term:`IMAGE_INSTALL`.
  221. - As a dependency of another ``dbg`` package that was brought in
  222. using one of the above methods.
  223. The dependency might have been automatically added because the
  224. ``dbg`` package erroneously contains files that it should not contain
  225. (e.g. a non-symlink ``.so`` file) or it might have been added
  226. manually (e.g. by adding to :term:`RDEPENDS`).
  227.  
  228. - ``<packagename> rdepends on <dev_packagename> [dev-deps]``
  229. A dependency exists between the specified non-dev package (a package
  230. whose name does not end in ``-dev``) and a package that is a ``dev``
  231. package. The ``dev`` packages contain development headers and are
  232. usually brought in using several different methods:
  233. - Using the ``dev-pkgs``
  234. :term:`IMAGE_FEATURES` value.
  235. - Using :term:`IMAGE_INSTALL`.
  236. - As a dependency of another ``dev`` package that was brought in
  237. using one of the above methods.
  238. The dependency might have been automatically added (because the
  239. ``dev`` package erroneously contains files that it should not have
  240. (e.g. a non-symlink ``.so`` file) or it might have been added
  241. manually (e.g. by adding to :term:`RDEPENDS`).
  242.  
  243. - ``<var>_<packagename> is invalid: <comparison> (<value>) only comparisons <, =, >, <=, and >= are allowed [dep-cmp]``
  244. If you are adding a versioned dependency relationship to one of the
  245. dependency variables (:term:`RDEPENDS`,
  246. :term:`RRECOMMENDS`,
  247. :term:`RSUGGESTS`,
  248. :term:`RPROVIDES`,
  249. :term:`RREPLACES`, or
  250. :term:`RCONFLICTS`), you must only use the named
  251. comparison operators. Change the versioned dependency values you are
  252. adding to match those listed in the message.
  253.  
  254. - ``<recipename>: The compile log indicates that host include and/or library paths were used. Please check the log '<logfile>' for more information. [compile-host-path]``
  255. The log for the :ref:`ref-tasks-compile` task
  256. indicates that paths on the host were searched for files, which is
  257. not appropriate when cross-compiling. Look for "is unsafe for
  258. cross-compilation" or "CROSS COMPILE Badness" in the specified log
  259. file.
  260.  
  261. - ``<recipename>: The install log indicates that host include and/or library paths were used. Please check the log '<logfile>' for more information. [install-host-path]``
  262. The log for the :ref:`ref-tasks-install` task
  263. indicates that paths on the host were searched for files, which is
  264. not appropriate when cross-compiling. Look for "is unsafe for
  265. cross-compilation" or "CROSS COMPILE Badness" in the specified log
  266. file.
  267.  
  268. - ``This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities. Rerun configure task after fixing this. The path was '<path>'``
  269. The log for the :ref:`ref-tasks-configure` task
  270. indicates that paths on the host were searched for files, which is
  271. not appropriate when cross-compiling. Look for "is unsafe for
  272. cross-compilation" or "CROSS COMPILE Badness" in the specified log
  273. file.
  274.  
  275. - ``<packagename> doesn't match the [a-z0-9.+-]+ regex [pkgname]``
  276. The convention within the OpenEmbedded build system (sometimes
  277. enforced by the package manager itself) is to require that package
  278. names are all lower case and to allow a restricted set of characters.
  279. If your recipe name does not match this, or you add packages to
  280. :term:`PACKAGES` that do not conform to the
  281. convention, then you will receive this error. Rename your recipe. Or,
  282. if you have added a non-conforming package name to ``PACKAGES``,
  283. change the package name appropriately.
  284.  
  285. - ``<recipe>: configure was passed unrecognized options: <options> [unknown-configure-option]``
  286. The configure script is reporting that the specified options are
  287. unrecognized. This situation could be because the options were
  288. previously valid but have been removed from the configure script. Or,
  289. there was a mistake when the options were added and there is another
  290. option that should be used instead. If you are unsure, consult the
  291. upstream build documentation, the ``./configure --help`` output, and
  292. the upstream change log or release notes. Once you have worked out
  293. what the appropriate change is, you can update
  294. :term:`EXTRA_OECONF`,
  295. :term:`PACKAGECONFIG_CONFARGS`, or the
  296. individual :term:`PACKAGECONFIG` option values
  297. accordingly.
  298.  
  299. - ``Recipe <recipefile> has PN of "<recipename>" which is in OVERRIDES, this can result in unexpected behavior. [pn-overrides]``
  300. The specified recipe has a name (:term:`PN`) value that
  301. appears in :term:`OVERRIDES`. If a recipe is named
  302. such that its ``PN`` value matches something already in ``OVERRIDES``
  303. (e.g. ``PN`` happens to be the same as :term:`MACHINE`
  304. or :term:`DISTRO`), it can have unexpected
  305. consequences. For example, assignments such as
  306. ``FILES_${PN} = "xyz"`` effectively turn into ``FILES = "xyz"``.
  307. Rename your recipe (or if ``PN`` is being set explicitly, change the
  308. ``PN`` value) so that the conflict does not occur. See
  309. :term:`FILES` for additional information.
  310.  
  311. - ``<recipefile>: Variable <variable> is set as not being package specific, please fix this. [pkgvarcheck]``
  312. Certain variables (:term:`RDEPENDS`,
  313. :term:`RRECOMMENDS`,
  314. :term:`RSUGGESTS`,
  315. :term:`RCONFLICTS`,
  316. :term:`RPROVIDES`,
  317. :term:`RREPLACES`, :term:`FILES`,
  318. ``pkg_preinst``, ``pkg_postinst``, ``pkg_prerm``, ``pkg_postrm``, and
  319. :term:`ALLOW_EMPTY`) should always be set specific
  320. to a package (i.e. they should be set with a package name override
  321. such as ``RDEPENDS_${PN} = "value"`` rather than
  322. ``RDEPENDS = "value"``). If you receive this error, correct any
  323. assignments to these variables within your recipe.
  324.  
  325. - ``File '<file>' from <recipename> was already stripped, this will prevent future debugging! [already-stripped]``
  326. Produced binaries have already been stripped prior to the build
  327. system extracting debug symbols. It is common for upstream software
  328. projects to default to stripping debug symbols for output binaries.
  329. In order for debugging to work on the target using ``-dbg`` packages,
  330. this stripping must be disabled.
  331. Depending on the build system used by the software being built,
  332. disabling this stripping could be as easy as specifying an additional
  333. configure option. If not, disabling stripping might involve patching
  334. the build scripts. In the latter case, look for references to "strip"
  335. or "STRIP", or the "-s" or "-S" command-line options being specified
  336. on the linker command line (possibly through the compiler command
  337. line if preceded with "-Wl,").
  338. .. note::
  339. Disabling stripping here does not mean that the final packaged
  340. binaries will be unstripped. Once the OpenEmbedded build system
  341. splits out debug symbols to the
  342. -dbg
  343. package, it will then strip the symbols from the binaries.
  344.  
  345. - ``<packagename> is listed in PACKAGES multiple times, this leads to packaging errors. [packages-list]``
  346. Package names must appear only once in the
  347. :term:`PACKAGES` variable. You might receive this
  348. error if you are attempting to add a package to ``PACKAGES`` that is
  349. already in the variable's value.
  350.  
  351. - ``FILES variable for package <packagename> contains '//' which is invalid. Attempting to fix this but you should correct the metadata. [files-invalid]``
  352. The string "//" is invalid in a Unix path. Correct all occurrences
  353. where this string appears in a :term:`FILES` variable so
  354. that there is only a single "/".
  355.  
  356. - ``<recipename>: Files/directories were installed but not shipped in any package [installed-vs-shipped]``
  357. Files have been installed within the
  358. :ref:`ref-tasks-install` task but have not been
  359. included in any package by way of the :term:`FILES`
  360. variable. Files that do not appear in any package cannot be present
  361. in an image later on in the build process. You need to do one of the
  362. following:
  363. - Add the files to ``FILES`` for the package you want them to appear
  364. in (e.g. ``FILES_${``\ :term:`PN`\ ``}`` for the main
  365. package).
  366. - Delete the files at the end of the ``do_install`` task if the
  367. files are not needed in any package.
  368.  
  369. - ``<oldpackage>-<oldpkgversion> was registered as shlib provider for <library>, changing it to <newpackage>-<newpkgversion> because it was built later``
  370. This message means that both ``<oldpackage>`` and ``<newpackage>``
  371. provide the specified shared library. You can expect this message
  372. when a recipe has been renamed. However, if that is not the case, the
  373. message might indicate that a private version of a library is being
  374. erroneously picked up as the provider for a common library. If that
  375. is the case, you should add the library's ``.so`` file name to
  376. :term:`PRIVATE_LIBS` in the recipe that provides
  377. the private version of the library.
  378. - ``LICENSE_<packagename> includes licenses (<licenses>) that are not listed in LICENSE [unlisted-pkg-lics]``
  379. The :term:`LICENSE` of the recipe should be a superset
  380. of all the licenses of all packages produced by this recipe. In other
  381. words, any license in ``LICENSE_*`` should also appear in
  382. :term:`LICENSE`.
  383.  
  384. Configuring and Disabling QA Checks
  385. ===================================
  386. You can configure the QA checks globally so that specific check failures
  387. either raise a warning or an error message, using the
  388. :term:`WARN_QA` and :term:`ERROR_QA`
  389. variables, respectively. You can also disable checks within a particular
  390. recipe using :term:`INSANE_SKIP`. For information on
  391. how to work with the QA checks, see the
  392. ":ref:`insane.bbclass <ref-classes-insane>`" section.
  393. .. note::
  394. Please keep in mind that the QA checks exist in order to detect real
  395. or potential problems in the packaged output. So exercise caution
  396. when disabling these checks.