2

I have 2 yocto pkgs that can be successfully compiled with gcc 5.4, cmake 3.6.1 on yocto 2.0.2 but I'm facing the following issue with: gcc 6.3, cmake 3.6.1 on yocto 2.4 .

After some research, I observed that yocto changed the sysroot structure (sysroot per package instead of a common sysroot). The error looks like this:

CMake Warning at src/mytest/CMakeLists.txt:71 (add_executable):
  Cannot generate a safe linker search path for target mytest because
  files in some directories may conflict with libraries in implicit
  directories:

link library [libpthread.so] in /local/build2/tmp/work/corei7-64-poky-linux/mytest/recipe-sysroot/usr/lib may be hidden by files in:
  /local/build2/tmp/work/corei7-64-poky-linux/mylib/recipe-sysroot/usr/lib


  Some of these libraries may not be found correctly.

Leading to linking error: ld: cannot find /lib/libpthread.so.0

I observed in some cmake generated files that mylib package exports its libraries with hardcoded pkg name, that will be later used by test pkg:

set_target_properties(mylib PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "/usr/include/;/{_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "-lpthread; mylib; /local/build2/tmp/work/corei7-64-poky-linux/mylib/recipe-sysroot/usr/lib/libpthread.so;"
)

Is there any way to avoid this kind of duplication? Or to remove the full paths from cmake generated files?

  • Could you show your `target_link_libraries()` command for mylib? Why is `pthread` mentioned twice (once with relative, once with absolute path)? – Nibor Jan 20 '18 at 18:28
  • Please be informed that from 2.4 Yocto release, shared tmp/sysroots is not exist any more [docs](http://www.yoctoproject.org/docs/2.4/ref-manual/ref-manual.html#structure-build-tmp-sysroots) – lukaszgard Jan 22 '18 at 09:18

0 Answers0