簡體   English   中英

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

[英]Using files generated by other recipes in Yocto

注意:一般問題在本文末尾以粗體顯示。

我正在嘗試為我的基於 Linux i.MX6 的嵌入式系統使用 Yocto (Rocko) 構建 PostGIS 2.2.7。 首先,我已經從 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。 將以下包添加到我的圖像 (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,並對幾個文件進行了一些更改,我成功了。

最后,只要我想用 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
}

但是當我運行 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 文件夾也是空的。

所以,真正的問題是:如何從我自己的食譜訪問其他食譜生成的文件? 我需要指定該路徑(以及其他路徑,來自其余的依賴項)以便配置、編譯和安裝 PostGIS 到我的圖像中。

編輯 26/07/2018:

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

首先,您需要檢查您的食譜:

  • 您不必依賴 gcc,因為它會自動添加為 BASEDEPENDS ,並且它實際上會添加正確的 CROSS 編譯器,在這種情況下,您將依賴於本機編譯器(它可能會幫助您檢查 bitbake 的輸出-e)。

  • 此外,您可能不必覆蓋 do_configure() / do compile()

現在,回答你的問題:

您真正想要的是訪問其他配方安裝的文件,在這種特定情況下,您說文件 pg_config 是由 postgresql 配方生成的,那么通常您需要做的是將 postgresql 添加到 DEPENDS ,這樣,在編譯之前postgis 配方,bibtake 將執行一個名為 prepare_recipe_sysroot 的任務,它獲取從 DEPENDS 上列出的包中安裝的所有文件,並將它們添加到 recipe-sysroot/... 或 recipe-sysroot-native/... ,這樣在交叉編譯你的包時它將可以訪問它需要的所有內容(或至少您列出的所有內容)。

由於您已經在 DEPENDS 上列出了 postgresql,我只能假設 postgresql 配方沒有安裝 pg_config 文件,為此您需要確保它是安裝在 postgresql 配方中的 do_install() 上並且它是通過以下方式打包的FILES_${PN} 變量(再次在 postgresql 配方中)。

要檢查該文件是否由 postgresql 配方提供,您可以在 sysroot-providers 目錄(位於您的 TMPDIR 內)中的 popstgresql 目錄下查找該文件。

希望有幫助

sysroots 是跨配方共享文件的方法。

如果 pg_config 在 ${D}${bindir} 中(即您在工作文件夾的 image/usr/bin 中看到它),您可以添加到 postgres_x.xxbbappend 文件:

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
}

“生成”的文件不太清楚。 如果您希望其他配方“部署”文件,請查看此處: 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