【问题标题】:How to deal with libraries like Boost when cross compiling for arm?交叉编译arm时如何处理像Boost这样的库?
【发布时间】:2015-06-05 17:25:18
【问题描述】:

我想从我的 AMD64 桌面交叉编译到 Beagleboard Black 的 ARM7。所以我开始安装交叉编译器:

sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf

我还创建了一个 cmake 工具链文件:

set (CMAKE_SYSTEM_NAME Linux)
set (CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set (CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)

当我运行 cmake 时,我发现它确实找到了正确的编译器。但是我该如何处理需要链接的库呢?例如,提升?我假设我需要在我的 x86/amd64 桌面上使用这些库的 arm 版本才能进行编译和链接工作。

这是我在尝试运行 cmake 时看到的错误消息示例:

cmake -DCMAKE_TOOLCHAIN_FILE=Arm_Toolchain ..
CMake Error at /usr/share/cmake-3.0/Modules/FindBoost.cmake:1199 (message):
  Unable to find the requested Boost libraries.
  Boost version: 1.55.0
  Boost include path: /usr/include
  Could not find the following static Boost libraries:
          boost_log_setup
          boost_log
          boost_date_time
          boost_filesystem
          boost_program_options
          boost_regex
          boost_system
          boost_thread
          boost_chrono

【问题讨论】:

    标签: ubuntu cmake g++ cross-compiling beagleboneblack


    【解决方案1】:

    是的,您需要的 boost 库不是仅为 ARM 构建的标头。 这个 SO 问题涵盖:cross compile Boost 1.57.0 on ubuntu for arm

    要使find_package 之类的东西适用于交叉编译,您应该设置CMAKE_FIND_ROOT_PATH

    假设您将CMAKE_FIND_ROOT_PATH 设置为/opt/beagleboard。然后,CMake 将首先在 /opt/beagleboard/lib/opt/beagleboard/usr/lib 查找库,因此在此处安装库,它应该可以工作。

    可以在http://www.vtk.org/Wiki/CMake_Cross_Compiling 找到与交叉编译相关的各种 CMake 设置的详细说明。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多