CMake无法生成安全的链接器搜索路径 - yocto 2.4

时间:2018-01-17 13:33:38

标签: c++ gcc cmake linker yocto

我有2个yocto pkgs,可以使用gcc 5.4,cmake 3.6.1在yocto 2.0.2上成功编译,但我面临以下问题:gcc 6.3,cmake 3.6.1 on yocto 2.4。< / p>

经过一些研究,我观察到yocto改变了sysroot结构(每个包的sysroot而不是常见的sysroot)。 错误如下所示:

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.

导致链接错误:ld: cannot find /lib/libpthread.so.0

我在一些cmake生成的文件中观察到mylib包使用硬编码的pkg名称导出其库,稍后将由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;"
)

有没有办法避免这种重复?或者从cmake生成的文件中删除完整路径?

0 个答案:

没有答案