在使用 CMake

问题描述

问题:

我正在尝试在我的 Ubuntu 18.04 PC 的 yocto 构建系统中构建 ot-br-posix。我从一开始就解决了许多错误,现在卡在与“Boost”文件夹相关的错误中。

说明:

我正在 Yocto 环境中从 GitHub 构建 OpenThread 源代码。 在 Yocto 环境中为我们的自定义板编译需要 OpenThread。因此,我为编译所需的所有信息创建了一个配方文件 (.bb)。 最近版本的 OpenThread 使用 CMake,它对我来说有点新。我从来没有更早地遇到过“Boost”。所以,“Boost”也是新的。所以我无法清楚地找出问题所在。

我在编译 ot-br-posix (OpenThread) 时遇到以下错误

| CMake Error at /home/pandurang/projects/git/CustomBoard/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0/recipe-sysroot-native/usr/share/cmake-3.14/Modules/FindBoost.cmake:2132 (message):
|   Unable to find the requested Boost libraries.
| 
|   Boost version: 1.65.1
| 
|   Boost include path: /usr/include
| 
|   Could not find the following static Boost libraries:
| 
|           boost_filesystem
|           boost_system
| 
|   No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
|   directory containing Boost libraries or BOOST_ROOT to the location of
|   Boost.
| Call Stack (most recent call first):
|   etc/cmake/options.cmake:78 (find_package)
|   CMakeLists.txt:37 (include)
| 
| 
| -- *** (OTBR_VERSION) *** Version: 0.3.0-b9565b4c-dirty

CMake 版本:3.14

我已经浏览了几个小时的其他人的解决方案,但找不到完全正确的答案来解决我的问题。我已经应用了以下链接中的一些解决方案,但没有帮助。

当我搜索 Boost 文件夹时,它在 recipe-sysroot 路径中,但不在 recipe-sysroot-native 路径中,我认为它是在 recipe-sysroot-native 路径中搜索。请参阅下面的 FIND 命令的输出

pandurang@pandurang-desktop:~/projects/git/CustomBoard/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0$ find ./recipe-sysroot -name "boost"
./recipe-sysroot/sysroot-providers/boost
./recipe-sysroot/usr/include/boost
./recipe-sysroot/usr/include/boost/chrono/typeof/boost
./recipe-sysroot/usr/include/boost/hana/ext/boost

pandurang@pandurang-desktop:~/projects/git/CustomBoard/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0$ find ./recipe-sysroot-native/ -name "boost"
./recipe-sysroot-native/installeddeps/boost

pandurang@pandurang-desktop:~/projects/git/CustomBoard/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0$

编辑: 我已更新 _otbr 脚本如下: otbr_install() “-DCMAKE_INSTALL_PREFIX=/usr”更新为 “-DCMAKE_INSTALL_PREFIX=/home/pandurang/projects/git/Gateway/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0/recipe-sysroot/usr”。

通过上述更改,解决了与“Boost”文件夹相关的错误,现在出现了一个错误

| [1/342] 链接 CXX 可执行文件第三方/openthread/repo/src/posix/ot-ctl |失败:第三方/openthread/repo/src/posix/ot-ctl | : && /home/pandurang/projects/git/Gateway/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0/recipe-sysroot-native/usr/bin/arm-poky-linux -gnueabi/arm-poky-linux-gnueabi-g++ -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/pandurang/projects/git/Gateway/build/tmp/work /cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/pandurang/projects/git/网关/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0=/usr/src/debug/otbr/git-r0 -fdebug-prefix-map=/home/pandurang/projects/ git/Gateway/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0=/usr/src/debug/otbr/git-r0 -fdebug-prefix-map=/home/pandurang/项目/git/Gateway/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0/recipe-sysroot= -fdebug-prefix-map=/home/pandurang/projects/git/Gateway/ build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0/recipe-sysroot-native= -fvisibility-inline s-hidden -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/pandurang/projects/git/Gateway/build/tmp/work/cortexa7t2hf-neon-poky-linux- gnueabI/Otbr/git-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-neededthird_party/openthread/repo/src/posix/CMakeFiles/ot-ctl。 dir/client.cpp.o -o third_party/openthread/repo/src/posix/ot-ctl -L/home/pandurang/projects/git/Gateway/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi /otbr/git-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/home/pandurang/projects/git/Gateway/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr /git-r0/recipe-sysroot-native/usr/lib: /home/pandurang/projects/git/Gateway/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0/recipe- sysroot/usr/lib/libreadline.so -lncurses && : | /home/pandurang/projects/git/Gateway/build/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabI/Otbr/git-r0/recipe-sysroot-native/usr/lib/libncurses.so.5:文件无法识别:无法识别文件格式 | collect2:错误:ld 返回 1 个退出状态

请帮助我解决上述错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)