0

在 open-embedded 中构建 grpc 时,我在查找 c-ares 依赖项时遇到问题。在配置期间查找依赖项 c-ares 时,日志中的错误在日志中显示为 -

--

Found ZLIB: ....../poky/build/tmp-glibc/sysroots/arm7/usr/lib/libz.so (found version "1.2.8")
CMake Error at ....../poky/build/tmp-glibc/sysroots/arm7/usr/lib/cmake/c-ares/c-ares-targets.cmake:70 (message):
   The imported target "c-ares::cares" references the file
      "/usr/lib/libcares.so.2.2.0"

but this file does not exist.  Possible reasons include:

   * The file was deleted, renamed, or moved to another location.

   * An install or uninstall procedure did not complete successfully.

   * The installation package was faulty and contained

    "/home/...../poky/build/tmp-glibc/sysroots/arm7/usr/lib/cmake/c-ares/c-ares-targets.cmake"
   but not all the files it references.

--

问题似乎是 cmake 如何为 c-ares 配置导入前缀,在文件中配置如下 - poky/build/tmp-glibc/sysroots/arm7/usr/lib/cmake/c-ares/c-ares-目标.cmake。我相信它应该是进入目标暂存目录的路径

设置(_IMPORT_PREFIX“/usr”)

有人可以帮我确定这里的问题吗?为了获得正确的 _IMPORT_PREFIX 需要在 c-ares 配方中配置什么?任何帮助深表感谢。谢谢

4

1 回答 1

1

我今天在旧的(菊花)BitBake 环境中构建新的 gRPC 时遇到了这个问题。我找到的解决方案要么将此上游更改反向移植到 cmake.bbclass ,要么通过变量将 .bbappend 中更新的变量定义修改为 cmake 调用EXTRA_OECMAKE

我选择了后者,因为我似乎只对 c-ares 需要这个,并且想限制我的影响。我最终没有深入研究 c-ares 和其他 gRPC 依赖项(例如 gflags)如何生成 CMake 导出目标文件之间的区别。我假设最终目标路径是在各个项目的 CMakeLists.txt 文件中生成的。

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index b18152a8ed..5203d8aca1 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -108,15 +108,15 @@ cmake_do_configure() {
      ${OECMAKE_SITEFILE} \
      ${OECMAKE_SOURCEPATH} \
      -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
-     -DCMAKE_INSTALL_BINDIR:PATH=${bindir} \
-     -DCMAKE_INSTALL_SBINDIR:PATH=${sbindir} \
-     -DCMAKE_INSTALL_LIBEXECDIR:PATH=${libexecdir} \
+     -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir', True), d.getVar('prefix', True))} \
+     -DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir', True), d.getVar('prefix', True))} \
+     -DCMAKE_INSTALL_LIBEXECDIR:PATH=${@os.path.relpath(d.getVar('libexecdir', True), d.getVar('prefix', True))} \
      -DCMAKE_INSTALL_SYSCONFDIR:PATH=${sysconfdir} \
-     -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=${sharedstatedir} \
+     -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=${@os.path.relpath(d.getVar('sharedstatedir', True), d.  getVar('prefix', True))} \
      -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=${localstatedir} \
-     -DCMAKE_INSTALL_LIBDIR:PATH=${libdir} \
-     -DCMAKE_INSTALL_INCLUDEDIR:PATH=${includedir} \
-     -DCMAKE_INSTALL_DATAROOTDIR:PATH=${datadir} \
+     -DCMAKE_INSTALL_LIBDIR:PATH=${@os.path.relpath(d.getVar('libdir', True), d.getVar('prefix', True))} \
+     -DCMAKE_INSTALL_INCLUDEDIR:PATH=${@os.path.relpath(d.getVar('includedir', True), d.getVar('prefix', True))} \
+     -DCMAKE_INSTALL_DATAROOTDIR:PATH=${@os.path.relpath(d.getVar('datadir', True), d.getVar('prefix', True))} \
      -DCMAKE_INSTALL_SO_NO_EXE=0 \
      -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
      -DCMAKE_VERBOSE_MAKEFILE=1 \
于 2019-05-30T23:14:40.733 回答