简体   繁体   English

传递额外的编译标志来调试 bitbake 配方中的构建

[英]Passing extra compilation flags to debug build in bitbake recipe

As Bitbake builds -dev and -debug for recipes is it possible for defining compilation definitions specific to debug build for a particular recipe.由于 Bitbake 为配方构建 -dev 和 -debug ,因此可以定义特定于特定配方的调试构建的编译定义。 Lets say I have some source code under DEBUG_INFO for some recipe ie,假设我在 DEBUG_INFO 下有一些用于某些配方的源代码,即,

#ifdef DEBUG_INFO

........... do something

#endif /* DEBUG_INFO */

and uses cmake in bitbake environment.并在 bitbake 环境中使用 cmake。

I want this flag be enabled for the debug binaries generated in the.debug folder.我希望为 .debug 文件夹中生成的调试二进制文件启用此标志。 Is this possible?这可能吗? If I use EXTRA_OECMAKE = "-DDEBUG_INFO" it gets enabled to both dev and debug builds.如果我使用EXTRA_OECMAKE = "-DDEBUG_INFO"它会同时启用开发和调试版本。

No, it is not possible.不,这是不可能的。 All packages of a recipe are built in one go, they're just the same files but split somehow.配方的所有包都内置在一个 go 中,它们只是相同的文件,但以某种方式拆分。

The only difference is with "special flavors" of a recipe (native, nativesdk, target, multilib, toolchain-specific recipes, etc...), in that case, you can have different flags but still, all the packages resulting from the build of this "flavor" will be built with the same flag.唯一的区别是配方的“特殊风味”(native、nativesdk、target、multilib、特定于工具链的配方等),在这种情况下,您可以有不同的标志,但仍然是由这种“风味”的构建将使用相同的标志构建。

If you want to build another variant of a package where a certain CMake flag is set in the compilation, you can create a variant of the recipe.如果要构建 package 的另一个变体,其中在编译中设置了某个 CMake 标志,则可以创建配方的变体。 If the main recipe is named my-app_git.bb you can create another recipe file named my-app-tweak_git.bb and a common base, my-app.inc .如果主配方名为my-app_git.bb ,您可以创建另一个名为my-app-tweak_git.bb的配方文件和一个通用基础文件my-app.inc In the bb files, include the inc file:在 bb 文件中,包含 inc 文件:

require my-app.inc

Move most of what's now in my-app_git.bb to my_app.inc , eg SRC_URI , but define different contents for EXTRA_OECMAKE in the.bb files.my-app_git.bb中的大部分内容移动到my_app.inc中,例如SRC_URI ,但在 .bb 文件中为EXTRA_OECMAKE定义不同的内容。

Now you will have to decide which one of my-app and my-app-tweak goes into the image by specifying either my-app or my-app-tweak in an IMAGE_INSTALL definition.现在,您必须通过在IMAGE_INSTALL定义中指定my-appmy-app-tweak来决定my-appmy-app-tweak中的哪一个进入图像。

This is not exactly what you asked for, but as has been stated by qschulz, you cannot change the contents of the -dev and -dbg sub-packages.这不是您所要求的,但正如 qschulz 所述,您无法更改 -dev 和 -dbg 子包的内容。

Also note that dbg and dev can be considered reserved words for variants of the package name, so if you want to use something other than tweak , as in my example, you cannot use any of them.还要注意dbgdev可以被认为是 package 名称变体的保留字,所以如果你想使用除了调整以外的东西,就像我的例子一样,你不能使用它们中的任何一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM