使用bitbake构建OpenDDS

时间:2019-03-26 12:00:17

标签: yocto bitbake openembedded opendds

我需要为Yocto项目使用bitbake构建OpenDDS-3.13.1。目前仅目标是QEMU。

但是,我下载了源代码(它们很好地在主机系统上进行了配置,编译和链接),并将它们链接到我的配方中。 继承“ autoconf”会在配置步骤中导致错误,无法以某种方式扩展默认参数(已经是奇数)。

经过一番搜索,我发现了一个关于该主题的非常古老的讨论:https://lists.yoctoproject.org/pipermail/yocto/2011-July/002126.html

我的食谱当前如下所示:

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
}

当前配置步骤已成功运行,但编译失败,因为找不到头文件。如上面邮件列表中所述,我尝试将CXXFLAGS添加到配置步骤。这将跳过第一个缺少的包含(“功能”),但停在下一个缺少的包含(“功能”)。这两个标头分别在$ {S}和$ {B}中可用,因此也是$ {STAGING_DIR_HOST}的一部分。

我在这里想念什么?我实际上希望继承自动工具会隐式覆盖所有步骤。

编辑:

此处要求的是日志输出:

DEBUG: Executing shell function do_compile
make[1]: Entering directory '/media/work/10_Projects/Yocto/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/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/florida_ref/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/temp/log.do_compile.15963)

2 个答案:

答案 0 :(得分:0)

  

我实际上希望继承可以隐式覆盖所有步骤   自动工具。

但是您不会inherit autotools。无论如何,这将无济于事,因为OpenDDS不使用自动工具。

首先进行一些清理:应该删除FILESEXTRAPATH,调用配方name_version.bb,然后可以删除PV,这些SB的值是默认值。您的do_compile基本上与默认设置相同。 SRC_URI应该是https://github.com/objectcomputing/OpenDDS/releases/download/DDS-3.13.1/OpenDDS-3.13.1.tar.gz

重要的是do_configure任务的输出是什么。 OpenDDS具有手动编码的一次性configure,您需要仔细调用它。从脚本看一看,似乎传递--target是一个好的开始。

答案 1 :(得分:0)

对于openDDS,通常的交叉编译方法无法立即使用。在这里,您需要在主机上下文上和内部运行编译过程,并引用交叉编译器,该编译器将由openDDS的构建系统使用。

这是如何使其运行:

openDDS源代码中的configure脚本不接受bitbake所需的交叉编译器附加参数。因此,我将它们包装在脚本中,以替换对CC,CXX,LD和AR的最终调用:

在do_unpack执行以下操作之后创建新任务

  • 从变量(CC,CXX和AR)中提取二进制名称,并创建一个具有相同名称的本地脚本
  • 将shebang插入刚刚创建的包装器脚本中
  • 将变量(此处为$ CC)的整个值附加到包装脚本中
  • 使包装器可执行
cc_wrapper=`echo ${CC} | cut -f 1 -d\  `
echo '#!/bin/sh' > ${S}/${cc_wrapper}
echo "${CC} \"\$@\"" >> ${S}/${cc_wrapper}
chmod +x ${S}/${cc_wrapper}
  • 对CXX和AR做同样的事情

覆盖配置步骤

  • 提取目标交叉编译器的完整路径
target_compiler="${S}/`echo ${CXX} | cut -f 1 -d\  `"
  • 并用宿主本机变量替换指向bitbake交叉编译器的CC变量:
export CC=$BUILD_CC
  • 对CXX和AR也做同样的事情
  • 使用预期的交叉编译选项对配置脚本进行最终调用
./configure --target=linux-cross --target-compiler=$target_compiler
     

(请注意上面对$ target_compiler的引用)

覆盖编译步骤

  • 再次导出CC,CXX,AR和LD,以指向主机本机实例
export CC=$BUILD_CC
  • 最后,只需在编译步骤中调用make即可,使之实现!