首页 > 解决方案 > qpid-cpp-1.39.0 的 Bitbake 构建失败

问题描述

我必须先说我对 Yocto/Bitbake、make、cmake、autoconf 等知之甚少。

我有一个用 C++ 编写的应用程序,但我一直无法构建。我遇到的问题是我无法在 Yocto/Bitbake 中构建一些依赖项。该应用程序依赖于以下库:

Paho-MQTT ( https://github.com/eclipse/paho.mqtt.c.git ) Jansson JSON 解析器 ( http://www.digip.org/jansson/releases/jansson-2.10.tar.gz ) Apache QPID C++ ( https://www-us.apache.org/dist/qpid/cpp/1.39.0/qpid-cpp-1.39.0.tar.gz )

运行 apache qpid 的 bitbake 配方时,我收到以下错误:

CMake Error at src/CMakeLists.txt:84 (message):
|   Can't find amqp 0-10 spec for framing code generation

我不知道如何克服这个错误。

我在 Macbook 上运行 Docker/Yocto,并按照说明安装并运行所有内容。正在为运行 mLinux 版本 4.1.6 的 Multitech Conduit 网关编译应用程序(和相关库)。我按照http://www.multitech.net/developer/software/mlinux/mlinux-building-images/building-a-custom-linux-image/上的说明下载和构建 mLinux 4.0 及更高版本的默认映像。

我找不到用于构建 qpid-cpp-1.39.0 的现有配方。我能够找到 qpid_0.20 的配方(http://git.yoctoproject.org/cgit/cgit.cgi/meta-cloud-services/tree/meta-openstack/recipes-extended/qpid/qpid_0.20。 bb?h=master),我试图修改它以支持 qpid-cpp-1.39.0。对配方运行 bitbake 时,我收到以下输出:

pokyuser@8c538668c625:/workdir/mlinux-4.x/build$ bitbake qpid-cpp
NOTE: Started PRServer with DBfile: /workdir/mlinux-4.x/build/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 41127, PID: 10213
Loading cache: 100% |#############################################################################################################################################| Time: 0:00:01
Loaded 2996 entries from dependency cache.
Parsing recipes: 100% |###########################################################################################################################################| Time: 0:00:01
Parsing of 2213 .bb files complete (2207 cached, 6 parsed). 3001 targets, 177 skipped, 0 masked, 0 errors.
WARNING: No bb files matched BBFILE_PATTERN_user '^/workdir/mlinux-4.x/layers/user-layer/'
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.32.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-16.04"
TARGET_SYS        = "arm-mlinux-linux-gnueabi"
MACHINE           = "mtcdt"
DISTRO            = "mlinux"
DISTRO_VERSION    = "4.1.7"
TUNE_FEATURES     = "arm armv5 thumb dsp arm926ejs"
TARGET_FPU        = "soft"
user-layer        = "master:c9360c9479287f3ba229c9a37142baa5a22cce67"
meta-mlinux       = "HEAD:4a060176a58345749e5907084cf1647f8b8cae23"
meta-multitech    = "HEAD:55db4fd0bb04ccaedb10de0b249151a663b0d916"
meta-mono         = "HEAD:b8e5da7138c61fb9ade87712a2fc28dc6283ab25"
meta-nodejs       = "HEAD:78018dc7dc02b5039a165801d09c00564687a1b6"
meta-java         = "HEAD:a265b31ec7d022be254abdf959360a7624208585"
meta-oe
meta-ruby
meta-perl
meta-python
meta-networking
meta-webserver
meta-multimedia
meta-filesystems  = "HEAD:fe5c83312de11e80b85680ef237f8acb04b4b26e"
meta              = "HEAD:ddf907ca95a19f54785079b4396935273b3747f6"
meta-jansson
meta-paho-mqtt
meta-clearblade-sdk
meta-qpid-cpp     = "master:c9360c9479287f3ba229c9a37142baa5a22cce67"

Initialising tasks: 100% |########################################################################################################################################| Time: 0:00:02
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: qpid-cpp-1.39.0-r0 do_configure: Function failed: do_configure (log file is located at /workdir/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/qpid-cpp/1.39.0-r0/temp/log.do_configure.10486)
ERROR: Logfile of failure stored in: /workdir/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/qpid-cpp/1.39.0-r0/temp/log.do_configure.10486
Log data follows:
| DEBUG: Executing python function sysroot_cleansstate
| DEBUG: Python function sysroot_cleansstate finished
| DEBUG: Executing shell function do_configure
| -- The C compiler identification is GNU 6.2.0
| -- The CXX compiler identification is GNU 6.2.0
| -- Check for working C compiler: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/arm-mlinux-linux-gnueabi/arm-mlinux-linux-gnueabi-gcc
| -- Check for working C compiler: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/arm-mlinux-linux-gnueabi/arm-mlinux-linux-gnueabi-gcc -- works
| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- Check for working CXX compiler: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/arm-mlinux-linux-gnueabi/arm-mlinux-linux-gnueabi-g++
| -- Check for working CXX compiler: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/arm-mlinux-linux-gnueabi/arm-mlinux-linux-gnueabi-g++ -- works
| -- Detecting CXX compiler ABI info
| -- Detecting CXX compiler ABI info - done
| -- Detecting CXX compile features
| -- Detecting CXX compile features - done
| -- Build type is "RelWithDebInfo" (has debug symbols)
| -- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.12", minimum required is "2.7")
| -- Found PythonInterp: /usr/bin/python2.7 (found version "2.7.12")
| -- Found PkgConfig: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/pkg-config (found version "0.29.1")
| -- Found Ruby: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/ruby (found version "2.2.0")
| -- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE)
| -- Could NOT find VALGRIND (missing:  VALGRIND_EXECUTABLE)
| -- Found CyrusSASL: /workdir/mlinux-4.x/build/tmp/sysroots/mtcdt/usr/lib/libsasl2.so
| CMake Error at src/CMakeLists.txt:84 (message):
|   Can't find amqp 0-10 spec for framing code generation
|
|
| -- Configuring incomplete, errors occurred!
| See also "/workdir/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/qpid-cpp/1.39.0-r0/build/CMakeFiles/CMakeOutput.log".
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_configure (log file is located at /workdir/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/qpid-cpp/1.39.0-r0/temp/log.do_configure.10486)
ERROR: Task (/workdir/mlinux-4.x/layers/meta-qpid-cpp/recipes-qpid-cpp/qpid-cpp/qpid-cpp_1.39.0.bb:do_configure) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1273 tasks of which 1267 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /workdir/mlinux-4.x/layers/meta-qpid-cpp/recipes-qpid-cpp/qpid-cpp/qpid-cpp_1.39.0.bb:do_configure
Summary: There was 1 WARNING message shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

我使用的配方如下:

DESCRIPTION = "AMQP message brokers"
HOMEPAGE = "http://qpid.apache.org/"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=b1e01b26bacfc2232046c90a330332b3"
SECTION = "mq"
DEPENDS = "boost perl-native python util-linux cyrus-sasl"
RDEPENDS_${PN} = "cyrus-sasl-bin"

SRC_URI = "git://github.com/apache/qpid-cpp;protocol=https"
SRCREV = "0f5d21861f6935ed2e4eb6e21f1d3cef19e22aa5"

S = "${WORKDIR}/git"
#S = "${WORKDIR}/${PN}-${PV}"

inherit cmake python-dir perlnative cpan-base update-rc.d pkgconfig ruby

OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH"

# Env var which tells perl if it should use host (no) or target (yes) settings
export PERLCONFIGTARGET = "${@is_target(d)}"
export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}/CORE"
export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}"
export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}"
export PERL="${STAGING_BINDIR}/perl"

EXTRA_OECONF += " --without-help2man SASL_PASSWD=/usr/sbin/saslpasswd2"
EXTRA_OEMAKE += " CPPFLAGS=-Wno-unused-function \
        pyexecdir=${PYTHON_SITEPACKAGES_DIR} \
        pythondir=${PYTHON_SITEPACKAGES_DIR} \
"

INITSCRIPT_NAME = "qpidd"
INITSCRIPT_PARAMS = "defaults"

知道三天前我刚刚开始学习 Yocto/Bitbake,我希望那里的人可以帮助我确定问题所在,以便我可以为 mLinux 编译 apache qpid-cpp-1.39.0 库。

标签: bitbakeqpid

解决方案


根据find_file文档:

CMake 变量 CMAKE_FIND_ROOT_PATH 指定一个或多个目录要附加到所有其他搜索目录。这有效地“重新扎根”了给定位置下的整个搜索。作为 CMAKE_STAGING_PREFIX 的后代的路径被排除在此重新生根之外,因为该变量始终是主机系统上的路径。默认情况下 CMAKE_FIND_ROOT_PATH 为空。

并且由于cmake从环境调用bitbake实际上是一个交叉编译,所以这个变量也应该被忽略。我添加了一个对我有用的补丁files/0001-Qpid-cross-compile.patch

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 82141efdb..3ba403a32 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -78,7 +78,7 @@ endif (NOT CMAKE_SYSTEM_NAME STREQUAL Windows AND BUILD_TESTING)
 # rubygen subdir is excluded from stable distributions
 # If the main AMQP spec is present, then check if ruby and python are
 # present, and if any sources have changed, forcing a re-gen of source code.
-find_file(QPID_AMQP_SPEC NAMES amqp.0-10-qpid-errata.stripped.xml PATHS ${qpid-cpp_SOURCE_DIR}/specs ${qpid-cpp_SOURCE_DIR}/../specs NO_DEFAULT_PATH)
+find_file(QPID_AMQP_SPEC NAMES amqp.0-10-qpid-errata.stripped.xml PATHS ${qpid-cpp_SOURCE_DIR}/specs ${qpid-cpp_SOURCE_DIR}/../specs NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
 mark_as_advanced(QPID_AMQP_SPEC)
 if (NOT QPID_AMQP_SPEC)
   message(FATAL_ERROR "Can't find amqp 0-10 spec for framing code generation")
@@ -106,7 +106,7 @@ else (regen_amqp)
   message(STATUS "No need to generate AMQP protocol sources")
 endif (regen_amqp)

-find_file(QPID_BROKER_MANAGEMENT_SPEC NAMES management-schema.xml PATHS ${CMAKE_CURRENT_SOURCE_DIR}/qpid/broker ${qpid-cpp_SOURCE_DIR}/../specs NO_DEFAULT_PATH)
+find_file(QPID_BROKER_MANAGEMENT_SPEC NAMES management-schema.xml PATHS ${CMAKE_CURRENT_SOURCE_DIR}/qpid/broker ${qpid-cpp_SOURCE_DIR}/../specs NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
 mark_as_advanced(QPID_BROKER_MANAGEMENT_SPEC)
 if (NOT QPID_BROKER_MANAGEMENT_SPEC)
   message(FATAL_ERROR "Can't find broker management spec for code generation")

推荐阅读