如何从 VCPKG 运行的 cmake 中删除 ninja 的 c++ 编译标志?

问题描述

我正在尝试使用 boost-containerRaspBerry Pi 4 上构建 VCPKG package manager。 问题是编译标志 -m64 之一对于 rpi 上的编译器无效(但对于 PC 是可以的),所以我需要删除该标志。这非常困难,因为 VCPKG 使用 cmake,使用 ninja 进行构建,而 ninja 使用 b2 构建 boost。

我需要 VCPKG 的版本:ebe505081b667a9f9a56596057f63ed20be237a5。所以要在 RPI 上重现问题:

git clone https://github.com/microsoft/vcpkg.git
cd vcpkg/
git checkout ebe505081b667a9f9a56596057f63ed20be237a5
./bootstrap-vcpkg.sh -useSystemBinaries # for that version it is necessairy for RPI
./vcpkg install boost-container

运行上面的命令后,我发现 -m64 标志有问题:

Starting package 17/17: boost-container:x64-linux
Building package boost-container[core]:x64-linux...
-- Downloading https://github.com/boostorg/container/archive/boost-1.71.0.tar.gz...
-- Extracting source /home/agh/vcpkg/downloads/boostorg-container-boost-1.71.0.tar.gz
-- Using source at /home/agh/vcpkg/buildtrees/boost-container/src/ost-1.71.0-aa14783b9a
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
-- Building x64-linux-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:136 (message):
    Command Failed: /usr/bin/cmake --build . --config Debug --target install -- -v
    Working Directory: /home/agh/vcpkg/buildtrees/boost-container/x64-linux-dbg
    See logs for more information:
      /home/agh/vcpkg/buildtrees/boost-container/install-x64-linux-dbg-out.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_build_cmake.cmake:91 (vcpkg_execute_build_process)
  scripts/cmake/vcpkg_install_cmake.cmake:24 (vcpkg_build_cmake)
  installed/x64-linux/share/boost-build/boost-modular-build.cmake:90 (vcpkg_install_cmake)
  ports/boost-container/portfile.cmake:14 (boost_modular_build)
  scripts/ports.cmake:94 (include)


Error: Building package boost-container:x64-linux Failed with: BUILD_Failed
Please ensure you're using the latest portfiles with `.\vcpkg update`,then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: boost-container:x64-linux
  Vcpkg version: 2019.09.12-unkNownhash

Additionally,attach any relevant sections from the log files above.

But the problem was:
gcc.compile.c /home/agh/vcpkg/buildtrees/boost-container/x64-linux-dbg/boost/build/e3cde813a01d557174a1b469417f2150/alloc_lib.o
c++: error: unrecognized command-line option ‘-m64’

    "/usr/bin/c++" -x c -m64 -pthread -O0 -fno-inline -Wall -g  -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTAINER_STATIC_LINK=1  -I"../include" -I"/home/agh/vcpkg/installed/x64-linux/include" -c -o "/home/agh/vcpkg/buildtrees/boost-container/x64-linux-dbg/boost/build/e3cde813a01d557174a1b469417f2150/alloc_lib.o" "../src/alloc_lib.c"

...Failed gcc.compile.c /home/agh/vcpkg/buildtrees/boost-container/x64-linux-dbg/boost/build/e3cde813a01d557174a1b469417f2150/alloc_lib.o...
...Failed updating 1 target...
...updated 5 targets...
ninja: build stopped: subcommand Failed.

我检查了工作目录:

find /home/agh/vcpkg/buildtrees/boost-container/x64-linux-dbg -type f | xargs grep m64

但是没有什么可以删除我注意到的标志。

我发现的唯一解决方案是创建编译器包装二进制文件,它只忽略那个标志 -m64 - 但我希望这是为 boost-contaier 的 CMake 创建补丁的更好解决方案?

解决方法

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

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

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