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. 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. Adding the following packages to my image (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.
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):
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
| 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). My /tmp/sysroots folder is empty also.
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.
EDIT 26/07/2018:
pg_config can be found in the following directories inside the 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
答案 0 :(得分:2)
首先,您需要检查食谱中的几件事:
您不必在gcc上进行DEPEND,因为它会根据BASEDEPENDS自动添加,并且实际上会添加正确的CROSS编译器,在这种情况下,您将依赖于本机编译器(这可能会帮助您检查bitbake -e)的输出。
另外,您可能不必重写do_configure()/ do compile()
现在,回答您的问题:
您真正想要的是有权访问由其他配方安装的文件,在这种情况下,您说文件pg_config是由postgresql配方生成的,那么通常您需要做的就是将postgresql添加到DEPENDS中,这种方式,在编译postgis配方之前,bibtake将执行一个名为prepare_recipe_sysroot的任务,该任务将从DEPENDS上列出的软件包中安装的所有文件都提取并添加到配方sysroot / ...或配方-sysroot-native / ...中,以此类推。编译您的软件包,它将可以访问它所需要的所有内容(或至少列出您所需要的所有内容)。
由于您已经在DEPENDS上列出了postgresql,因此我只能假设postgresql配方未安装pg_config文件,为此,您需要确保已从postgresql配方中将其安装在do_install()上通过FILES _ $ {PN}变量打包(同样在postgresql食谱上)。
要检查postgresql食谱是否提供了该文件,可以在popstgresql目录下的sysroot-providers目录(位于TMPDIR内)内查找文件。
希望有帮助
答案 1 :(得分:1)
sysroots是用于在各个配方之间共享文件的方法。
如果pg_config位于$ {D} $ {bindir}中(即您在工作文件夹的图像/ usr / bin中看到它),则可以将其添加到postgres_x.x.x.bbappend文件中:
SYSROOT_DIRS + =“ $ {bindir}”
这会将所有文件从postgresql的bindir复制到postgis的recipe-sysroots文件夹中。这不是一个好主意,因为pg_config是二进制文件并且经过交叉编译,因此它将无法在您的系统上运行。这就是为什么默认情况下不会将映像目录中的/ usr / bin /复制到sysroots的原因。
除了目录,您还可以修改登台:
sysroot_stage_all_append() {
install -d ${SYSROOT_DESTDIR}${bindir}/crossscripts
install -m 0755 ${D}${bindir}/pg-config ${SYSROOT_DESTDIR}${bindir}/crossscripts/pg-config
}
答案 2 :(得分:0)
“生成”的文件不是很清楚。如果您希望其他配方“部署”文件,请在这里查看:https://yoctoproject.blogspot.com/2020/09/yocto-bitbake-and-dependencies-eg-one.html