注意:总问题在本文末端以粗体标出。
我正在尝试为基于 Linux i.MX6 的嵌入式系统使用 Yocto(Rocko)构建 PostGIS 2.2.7。首先,我从 OpenEmbedded Layers 安装了 PostgreSQL 9.4.15(https://layers.openembedded.org/layerindex/recipe/5558/),并安装了所有(必需的)依赖项,这些依赖项可以在安装手册(https://download.osgeo.org/postgis/docs/postgis-2.2.7.pdf)中找到:GNU C、Proj4、GEOS、LibXML2 和 JSON-C。将以下软件包添加到我的镜像(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"
然后我尝试在我的目标系统中编译PostGIS,并对一些文件进行了一些更改,最终成功了。
最后,只要我想将PostGIS与Yocto集成到我的镜像中,我就编写了postgis配方(我有一个包含postgis-2.2.7.tar.gz tar的“files”文件夹):
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
}
但是当我运行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)
当然,这个错误是由于可执行文件pg_config没有位于${STAGING_BINDIR_CROSS}中触发的,也不在PostgreSQL的工作文件夹(../image/usr/bin和../package/usr/bin子文件夹)以外的任何其他地方。我的/tmp/sysroots文件夹也是空的。
因此,真正的问题是:我如何从自己的recipe访问其他recipes生成的文件?我需要指定该路径(以及来自其余依赖项的其他路径),以便配置、编译和安装PostGIS到我的image中。
编辑26/07/2018:
在postgresql ${WORKDIR}中可以找到pg_config在以下目录中:
./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