我在开放式嵌入式中构建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- target.cmake。我相信它应该是目标登台目录的路径
设置(_IMPORT_PREFIX“ / usr”)
有人可以帮我在这里找到问题吗?为了正确使用_IMPORT_PREFIX,需要在c-ares配方中配置什么?
任何帮助深表感谢。
谢谢
最佳答案
我今天在较旧的(雏菊)BitBake环境中构建较新的gRPC时遇到了此问题。我来到的解决方案要么是反向移植this upstream change to the cmake.bbclass,要么是入侵.bb中更新的变量定义,然后通过EXTRA_OECMAKE
变量附加到cmake调用中。
我选择了后者,因为我似乎只需要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 \
关于c++ - bitbake grpc交叉编译/配置失败,并出现错误c-ares::cares引用文件/usr/lib/libcares.so.2.2.0,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51407735/