1

I am using Yocto and I just would like to integrate a new library in my project.

I create a new recipe name "libxerces" which contains a file "libxerces-3.1.1.bb". The bb file is quite simple because it is based on autotools :

DESCRIPTION = "Xerces-c is a validating xml parser written in C++"
HOMEPAGE = "http://xerces.apache.org/xerces-c/"
PRIORITY = "optional"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

PR = "r1"

SRC_URI = "http://mirror.bit.edu.cn/apache//xerces/c/3/sources/xerces-c-${PV}.tar.gz"

s="${WORKDIR}/xerces-c-${PV}"

inherit autotools pkgconfig

SRC_URI[md5sum] = "6a8ec45d83c8cfb1584c5a5345cb51ae"
SRC_URI[sha256sum] = "a42785f71e0b91d5fd273831c87410ce60a73ccfdd207de1b805d26d44968736"

PACKAGES =+ "${PN}-utils"

FILES_${PN} = "${libdir}/*.so"
FILES_${PN}-utils = "${bindir}/*"
FILES_${PN}-staticdev = "${libdir}/*.a"*

BBCLASSEXTEND += "native"

I added "libxerces" to my bb image by using IMAGE_INSTALL += " libxerces". Then, I try to build my image thru bitbake my-image-test and eveything is done correctly but libxerces returns an error because it can not be installed. Howerver, I note that libxerces-dbg, libxerces-utils, libxerces-samples are visible under /tmp/work/deploy/ipk. I know that libxml2 is integrated by default into poky layer but I have to use xerces..

4

3 回答 3

3

我解决了错误

ERROR: Unable to install packages.
Collected errors:
 * opkg_install_cmd: Cannot install package libxerces.

覆盖 PACKAGES 变量。

在你的情况下:

PACKAGES = "${PN} ${PN}-utils ${PN}-staticdev"

我认为这是因为 .so 文件默认转到 ${PN}-dev 包。

我希望有一个更聪明的解决方案,但现在我以这种方式修复。

于 2015-04-29T08:16:10.753 回答
1

如果您正在构建一个库并且该库提供静态链接,您可以控制哪些静态库文件(*.a 文件)包含在构建的库中。

meta/conf/bitbake.conf 配置文件中的 PACKAGES 和 FILES_* 变量定义了 do_install 任务安装的文件是如何打包的。默认情况下,PACKAGES 变量包括 ${PN}-staticdev,它代表所有静态库文件。

于 2015-03-01T10:43:25.167 回答
1
FILES_${PN}-staticdev =""    # for static libs

FILES_${PN}-dev =""          # for dynamic libs

FILES_${PN}-dbg =""          # for debug options

您需要将以上行添加到您的食谱中

于 2017-04-06T06:51:23.950 回答