简体   繁体   English

使用 bitbake 构建 OpenDDS

[英]Building OpenDDS with bitbake

I need to build OpenDDS-3.13.1 with bitbake for my Yocto project.我需要为我的 Yocto 项目使用 bitbake 构建 OpenDDS-3.13.1。 Target is for now only QEMU. Target 目前只有 QEMU。

However, I downloaded the sources (they configure, compile and link on the host system quite well) and linked them into my recipe.但是,我下载了源代码(它们在主机系统上配置、编译和链接得很好)并将它们链接到我的配方中。 Inheriting "autoconf" causes an error in the configuration step, it can somehow not expand the default arguments (which is already odd).继承“autoconf”会导致配置步骤出错,它无法以某种方式扩展默认参数(这已经很奇怪了)。

After some searching I found a pretty old discussion about this topic: https://lists.yoctoproject.org/pipermail/yocto/2011-July/002126.html经过一番搜索,我发现了一个关于这个话题的古老讨论: https : //lists.yoctoproject.org/pipermail/yocto/2011-July/002126.html

My recipe currently looks as follows:我的食谱目前如下所示:

FILESEXTRAPATHS_prepend := "[PATH_TO_SOURCE]:"

PV = "3.13.1"

SRC_URI = "file://${PN}-${PV}.tar.gz"

S = "${WORKDIR}/${PN}-${PV}"
B = "${S}"

do_configure() {
    ./configure
}

do_compile() {
    make
}

At the moment the configuration step runs successfully, but compiling fails as it cannot find header files.目前配置步骤运行成功,但编译失败,因为找不到头文件。 As mentioned in the mailing list post above, I tried to add the CXXFLAGS to the configuration step.正如上面邮件列表帖子中提到的,我尝试将 CXXFLAGS 添加到配置步骤。 This will step over the first missing include ("features") but stops at the next one ("sting").这将跳过第一个缺少的包含(“功能”),但在下一个(“刺痛”)处停止。 Both headers are available in ${S} and ${B} respectivly, therefor are also part of ${STAGING_DIR_HOST}.两个标头分别在 ${S} 和 ${B} 中可用,因此也是 ${STAGING_DIR_HOST} 的一部分。

What am I missing here?我在这里缺少什么? I actually expected all step are implicitly covered by inheriting autotools.我实际上期望所有步骤都被继承 autotools 隐式覆盖。

Edit:编辑:

as requested here is the log output:按照这里的要求是日志输出:

DEBUG: Executing shell function do_compile
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ace'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ace/GNUmakefile.ACE MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ace'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/common'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/common/GNUmakefile.ACEXML MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/common'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/parser/parser'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/parser/parser/GNUmakefile.ACEXML_Parser MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/parser/parser'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_FE MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_A MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_C MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_E MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_I MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_O MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_S MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_U MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_V MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/apps/gperf/src'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/apps/gperf/src/GNUmakefile.gperf MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/apps/gperf/src'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_EXE MAKEFLAGS=w

x86_64-poky-linux-g++  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/recipe-sysroot -fvisibility=hidden -fvisibility-inlines-hidden -Wnon-virtual-dtor -ggdb -pthread -fno-strict-aliasing -Wall -W -Wpointer-arith -pipe  -D_GNU_SOURCE   -I/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers -D__ACE_INLINE__ -I../.. -I../TAO_IDL/fe -I../TAO_IDL/include -I.. -Iinclude -Ibe_include -Ife -I.. -DTAO_IDL_PREPROCESSOR=\"x86_64-poky-linux-g++ -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/recipe-sysroot\"  -c -o .obj/driver/drv_args.o driver/drv_args.cpp
<command-line>:0:22: warning: missing terminating " character
driver/drv_args.cpp:69:10: fatal error: string: No such file or directory
 #include <string>
          ^~~~~~~~
compilation terminated.
/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/include/makeinclude/rules.local.GNU:134: recipe for target '.obj/driver/drv_args.o' failed
make[1]: *** [.obj/driver/drv_args.o] Error 1
make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
GNUmakefile.dist:568: recipe for target 'TAO_IDL_EXE' failed
make: *** [TAO_IDL_EXE] Error 2
WARNING: exit code 2 from a shell command.
ERROR: Function failed: do_compile (log file is located at /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/temp/log.do_compile.15963)

For openDDS the usual cross-compiling approach does not work out of the box.对于 openDDS,通常的交叉编译方法不能开箱即用。 Here you need to run the compile process on and within your host machines context and reference your cross compiler which will than be used by the build system of openDDS.在这里,您需要在您的主机上下文中运行编译过程,并引用您的交叉编译器,它将被 openDDS 的构建系统使用。

Here is how to get it run:这是让它运行的方法:

The configure script from the openDDS sources does not accept additional arguments to the cross-compilers which are needed by bitbake.来自 openDDS 源的配置脚本不接受 bitbake 所需的交叉编译器的附加参数。 Therefore I wrapped them into scripts which replace the final calls to the CC, CXX, LD and AR:因此,我将它们包装成脚本,替换对 CC、CXX、LD 和 AR 的最终调用:

Create a new task after do_unpack doing the following在 do_unpack 执行以下操作后创建一个新任务

  • extract the binary names from the variables (CC, CXX and AR) and create a local script with the same name从变量(CC、CXX 和 AR)中提取二进制名称并创建一个具有相同名称的本地脚本
  • insert shebang into the just created wrapper script将shebang插入刚刚创建的包装脚本
  • append the whole value of the variable (here $CC) into the wrapper script将变量的整个值(此处为 $CC)附加到包装器脚本中
  • make wrapper executable使包装器可执行
cc_wrapper=`echo ${CC} | cut -f 1 -d\\ ` echo '#!/bin/sh' > ${S}/${cc_wrapper} echo "${CC} \\"\\$@\\"" >> ${S}/${cc_wrapper} chmod +x ${S}/${cc_wrapper}
  • do the same for CXX and AR对 CXX 和 AR 做同样的事情

Override the configure step覆盖配置步骤

  • extract the full path to the target cross compiler提取目标交叉编译器的完整路径
target_compiler="${S}/`echo ${CXX} | cut -f 1 -d\\ `"
  • and replace CC variable which points to the bitbake cross-compiler with the host native ones:并将指向 bitbake 交叉编译器的 CC 变量替换为主机本机变量:
 export CC=$BUILD_CC
  • do the same for CXX and AR too对 CXX 和 AR 也做同样的事情
  • do the final call to the configure script with the expected cross compile options使用预期的交叉编译选项对配置脚本进行最后调用
./configure --target=linux-cross --target-compiler=$target_compiler

(Note the reference to $target_compiler set above) (注意上面设置的对 $target_compiler 的引用)

Override the compile step覆盖编译步骤

  • export again CC, CXX, AR and in addition LD to point to the hosts native instances再次导出 CC、CXX、AR 和另外的 LD 以指向主机本机实例
export CC=$BUILD_CC
  • finally just call make within the compile step, that should make it happen!最后只是在编译步骤中调用 make ,这应该让它发生!

I actually expected all step are implicitly covered by inheriting autotools.我实际上期望所有步骤都被继承 autotools 隐式覆盖。

But you don't inherit autotools .但是您没有inherit autotools Anyway that won't help because OpenDDS doesn't use autotools.无论如何这无济于事,因为 OpenDDS 不使用自动工具。

First some cleanup: FILESEXTRAPATH should be removed, call the recipe name_version.bb and you can remove PV , those S and B values are the defaults.首先进行一些清理: FILESEXTRAPATH应该被删除,调用配方name_version.bb并且你可以删除PV ,那些SB值是默认值。 Your do_compile is basically doing the same as the default.您的do_compile基本上与默认值相同。 SRC_URI should be https://github.com/objectcomputing/OpenDDS/releases/download/DDS-3.13.1/OpenDDS-3.13.1.tar.gz surely. SRC_URI应该是https://github.com/objectcomputing/OpenDDS/releases/download/DDS-3.13.1/OpenDDS-3.13.1.tar.gz

The important thing is what is the output of the do_configure task.重要的是do_configure任务的输出是什么。 OpenDDS has a hand-coded and one-off configure which you'll need to carefully call. OpenDDS 有一个手动编码的一次性configure ,您需要仔细调用。 From glancing at the script, it looks like passing --target is a good start.从脚本--target ,似乎传递--target是一个好的开始。

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

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