简体   繁体   English

在 Yocto 中使用其他配方生成的文件

[英]Using files generated by other recipes in Yocto

Note: The general question is in bold at the end of this post.注意:一般问题在本文末尾以粗体显示。

I'm trying to build PostGIS 2.2.7 with Yocto (Rocko) for my Linux i.MX6 based embedded system.我正在尝试为我的基于 Linux i.MX6 的嵌入式系统使用 Yocto (Rocko) 构建 PostGIS 2.2.7。 First of all, I have installed PostgreSQL 9.4.15 from OpenEmbedded Layers ( https://layers.openembedded.org/layerindex/recipe/5558/ ) and all the (mandatory) dependencies I could find in the installation manual ( https://download.osgeo.org/postgis/docs/postgis-2.2.7.pdf ): GNU C, Proj4, GEOS, LibXML2 and JSON-C.首先,我已经从 OpenEmbedded Layers ( https://layers.openembedded.org/layerindex/recipe/5558/ ) 安装了 PostgreSQL 9.4.15 以及我可以在安装手册中找到的所有(强制性)依赖项( https:/ /download.osgeo.org/postgis/docs/postgis-2.2.7.pdf ):GNU C、Proj4、GEOS、LibXML2 和 JSON-C。 Adding the following packages to my image (local.conf):将以下包添加到我的图像 (local.conf) 中:

IMAGE_INSTALL_append += " postgresql postgresql-dev postgresql-server-dev proj proj-dev json-c json-c-dev geos geos-dev libxml2 libxml2-dev"

Then I tried to compile PostGIS inside my target system, and making some changes to a couple of files I succeeded.然后我尝试在我的目标系统中编译 PostGIS,并对几个文件进行了一些更改,我成功了。

Finally, as long as I want to integrate PostGIS into my image with Yocto, I wrote the postgis recipe (I have a "files" folder with the postgis-2.2.7.tar.gz tar):最后,只要我想用 Yocto 将 PostGIS 集成到我的图像中,我写了 postgis 配方(我有一个带有 postgis-2.2.7.ta​​r.gz tar 的“文件”文件夹):

DESCRIPTION = "PostGIS is a spatial database extender for PostgreSQL object-relational database. It adds support for geographic objects allowing location queries to be run in SQL."

SECTION = "devel"

LICENSE = "GPL-3.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-3.0;md5=c79ff39f19dfec6d293b95dea7b07891"

DEPENDS += "gcc postgresql libxml2 geos proj json-c"

RDEPENDS_${PN} = "postgresql-server-dev postgresql-dev"

SRC_URI = "file://postgis-2.2.7.tar.gz"

EXTRA_OECONF +=  "\
    --without-raster \
    --with-pgconfig=${STAGING_BINDIR_CROSS}"

inherit autotools pkgconfig

do_configure () {
    oe_runconf
}

do_compile () {
    oe_runmake
}

But when I run bitbake in order to build my image, I get the following ERROR coming from PostGIS' do_configure function但是当我运行 bitbake 以构建我的图像时,我收到来自 PostGIS 的 do_configure 函数的以下错误

| configure: error: the user-specified pg_config file /home/danlor/yocto-hmcu/build-hmcu/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/postgis/2.2.7-r0/recipe-sysroot/usr/bin/crossscripts does not exist 
| NOTE: The following config.log files may provide further information. 
| NOTE: /home/danlor/yocto-hmcu/build-hmcu/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/postgis/2.2.7-r0/build/config.log 
| ERROR: configure failed | WARNING: exit code 1 from a shell command. 
| ERROR: Function failed: do_configure (log file is located at /home/danlor/yocto-hmcu/build-hmcu/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/postgis/2.2.7-r0/temp/log.do_configure.45983)

Of course, this error is triggered because the executable pg_config is not located in ${STAGING_BINDIR_CROSS} , either nowhere else but in the work folder of PostgreSQL (in ../image/usr/bin and ../package/usr/bin subfolders).当然,触发此错误是因为可执行文件 pg_config 不在${STAGING_BINDIR_CROSS} 中,或者在 PostgreSQL 的工作文件夹中(在 ../image/usr/bin 和 ../package/usr/bin 子文件夹中) )。 My /tmp/sysroots folder is empty also.我的 /tmp/sysroots 文件夹也是空的。

So, the real question is: How can I access to the files generated by other recipes from my own recipe?所以,真正的问题是:如何从我自己的食谱访问其他食谱生成的文件? I need to specify that path (along with others, from the rest of dependencies) in order to configure, compile and install PostGIS into my image.我需要指定该路径(以及其他路径,来自其余的依赖项)以便配置、编译和安装 PostGIS 到我的图像中。

EDIT 26/07/2018:编辑 26/07/2018:

pg_config can be found in the following directories inside the postgresql ${WORKDIR} pg_config 可以在 postgresql ${WORKDIR} 的以下目录中找到

./package/usr/bin/pg_config
./package/usr/bin/.debug/pg_config
./package/usr/src/debug/postgresql/9.4.15-r0/postgresql-9.4.15/src/bin/pg_config
./postgresql-9.4.15/src/bin/pg_config
./build/src/bin/pg_config
./build/src/bin/pg_config/pg_config
./packages-split/postgresql-dbg/usr/bin/.debug/pg_config
./packages-split/postgresql-dbg/usr/src/debug/postgresql/9.4.15-r0/postgresql-9.4.15/src/bin/pg_config
./packages-split/postgresql/usr/bin/pg_config
./image/usr/bin/pg_config

First of all there are a couple of things you need to check on your recipe:首先,您需要检查您的食谱:

  • You dont have to DEPEND on gcc since it will automatically be added thought BASEDEPENDS , and it will actually add the correct CROSS compiler, in this case you are depending on the native compiler instead (It will probably help you out to check the output of bitbake -e).您不必依赖 gcc,因为它会自动添加为 BASEDEPENDS ,并且它实际上会添加正确的 CROSS 编译器,在这种情况下,您将依赖于本机编译器(它可能会帮助您检查 bitbake 的输出-e)。

  • Also it is likely that you don't have to override do_configure() / do compile()此外,您可能不必覆盖 do_configure() / do compile()

Now, to answer your question:现在,回答你的问题:

What you actually want to is to have access to files INSTALLED by other recipes, in this specific case you say the file pg_config is generated by the postgresql recipe, then usually what you need to do is add postgresql to DEPENDS , this way, before compiling the postgis recipe, bibtake will perform a task called prepare_recipe_sysroot which takes all files installed from packages listed on DEPENDS and adds them to recipe-sysroot/... or recipe-sysroot-native/... , this way when cross compiling your package it will have access to all that it requires (or at least all that you listed it requires).您真正想要的是访问其他配方安装的文件,在这种特定情况下,您说文件 pg_config 是由 postgresql 配方生成的,那么通常您需要做的是将 postgresql 添加到 DEPENDS ,这样,在编译之前postgis 配方,bibtake 将执行一个名为 prepare_recipe_sysroot 的任务,它获取从 DEPENDS 上列出的包中安装的所有文件,并将它们添加到 recipe-sysroot/... 或 recipe-sysroot-native/... ,这样在交叉编译你的包时它将可以访问它需要的所有内容(或至少您列出的所有内容)。

Since you already listed postgresql on DEPENDS, I can only assume that the postgresql recipe is not installing the pg_config file, to do this you need to make sure that it is being installed on do_install() from the postgresql recipe and that it is packaged via the FILES_${PN} variable (again on the postgresql recipe).由于您已经在 DEPENDS 上列出了 postgresql,我只能假设 postgresql 配方没有安装 pg_config 文件,为此您需要确保它是安装在 postgresql 配方中的 do_install() 上并且它是通过以下方式打包的FILES_${PN} 变量(再次在 postgresql 配方中)。

To check that the file is being provided by the postgresql recipe, you can look for the file inside the sysroot-providers directory (which is inside your TMPDIR), under the popstgresql directory.要检查该文件是否由 postgresql 配方提供,您可以在 sysroot-providers 目录(位于您的 TMPDIR 内)中的 popstgresql 目录下查找该文件。

Hope that helps希望有帮助

sysroots are the method for sharing files across recipes. sysroots 是跨配方共享文件的方法。

If pg_config is in in ${D}${bindir} (ie you see it in the work folder's image/usr/bin), you can add to a postgres_x.xxbbappend file:如果 pg_config 在 ${D}${bindir} 中(即您在工作文件夹的 image/usr/bin 中看到它),您可以添加到 postgres_x.xxbbappend 文件:

SYSROOT_DIRS += "${bindir}" SYSROOT_DIRS += "${bindir}"

Which will copy all the files from postgresql's bindir into postgis's recipe-sysroots folder.这会将所有文件从 postgresql 的 bindir 复制到 postgis 的 recipe-sysroots 文件夹中。 This isn't a great idea, as pg_config is a binary and cross compiled so it won't run on your system.这不是一个好主意,因为 pg_config 是一个二进制文件并经过交叉编译,因此它不会在您的系统上运行。 This is why /usr/bin/ from your image directory isn't copied to sysroots by default.这就是默认情况下不会将图像目录中的 /usr/bin/ 复制到 sysroots 的原因。

Instead of directories, you can also modify the staging:除了目录,您还可以修改暂存:

sysroot_stage_all_append() {
  install -d ${SYSROOT_DESTDIR}${bindir}/crossscripts
  install -m 0755 ${D}${bindir}/pg-config ${SYSROOT_DESTDIR}${bindir}/crossscripts/pg-config
}

Files "generated" is not quite clear. “生成”的文件不太清楚。 If you want the files "deployed" by another recipe have a look here: https://yoctoproject.blogspot.com/2020/09/yocto-bitbake-and-dependencies-eg-one.html如果您希望其他配方“部署”文件,请查看此处: https : //yoctoproject.blogspot.com/2020/09/yocto-bitbake-and-dependencies-eg-one.html

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

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