0

I am having issues with finding c-ares dependencies when building grpc in open-embedded.Error in the log when looking for the dependency c-ares during configure is shown in the log as -

--

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.

--

Issue seem to be how cmake has configured the import prefix for c-ares,which is configured as below in file - poky/build/tmp-glibc/sysroots/arm7/usr/lib/cmake/c-ares/c-ares-targets.cmake. I believe it should be the path into the target staging directory

set(_IMPORT_PREFIX "/usr")

Can someone please help me identify the issue here? what needs to be configured in the c-ares recipe in order to get the _IMPORT_PREFIX right?? Any help is much appreciated. Thanks

CyA
  • 41
  • 6

1 Answers1

1

I came across this issue today when building a newer gRPC in an older (daisy) BitBake environment. The solutions I came to were either backporting this upstream change to the cmake.bbclass or hacking in the updated variable definitions in a .bbappend to the cmake invocation by way of the EXTRA_OECMAKE variable.

I chose the latter, as I only seemed to need this for c-ares, and wanted to limit my impact. I did not end up digging into the difference between how c-ares and other gRPC dependencies (e.g. gflags) generate CMake export targets files. I assume there's some way the ultimate target paths are generated within the respective projects' CMakeLists.txt files.

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 \
opello
  • 3,254
  • 2
  • 23
  • 23
  • Thanks so much for sharing this. seem like my problem is gone now. I took the same approach as you to limit the impact – CyA Jun 01 '19 at 22:08