安装程序包时编译失败时,VCPKG如何编辑软件包文件?

发布于 2025-02-06 14:13:04 字数 2332 浏览 2 评论 0原文

我正在为某些项目安装依赖项,这些项目以vcpkg下载依赖项(该项目是Hyperledger Iroha,但没关系)。不幸的是,当使用我的编译器(G ++ 12.1.0)编译依赖项时,包装(Abseil)之一并未编译。

它不进行编译的原因很容易修复代码 - 只需更改的一行。

该行由cmake

CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:146 (message):
    Command failed: /usr/bin/cmake --build . --config Debug --target install -- -v -j13
    Working Directory: /home/agh/Pulpit/blockchain/internship2022/iroha/vcpkg-build/buildtrees/abseil/x64-linux-dbg
    See logs for more information:
      /home/agh/Pulpit/blockchain/internship2022/iroha/vcpkg-build/buildtrees/abseil/install-x64-linux-dbg-out.log

错误是:

/home/agh/Pulpit/blockchain/internship2022/iroha/vcpkg-build/buildtrees/abseil/src/ca9688e9f6-e4cda1d679.clean/absl/debugging/failure_signal_handler.cc:139:32: error: no matching function for call to ‘max(long int, int)’
  139 |   size_t stack_size = (std::max(SIGSTKSZ, 65536) + page_mask) & ~page_mask;
      |                        ~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/12.1.0/algorithm:60,

原因很容易修复 - 我只需要更改一行即可解决此问题。 不幸的是,当我更改代码行,然后在重新启动之后:

vcpkg install abseil

我的更改在编译之前被删除。我找到了应该有帮助的选项: - 可编辑,但它再次发生。

我想问什么是更专业(但仍然很快)更改文件的方法,这些文件是用vcpkg构建的,并包含错误?


我发现我可以编辑软件包的一种解决方案: -- Using cached /home/agh/Pulpit/blockchain/internship2022/iroha/vcpkg-build/downloads/abseil-abseil-cpp-997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz 当我编辑软件包时,我会看到错误:

          File path: [ /home/agh/Pulpit/blockchain/internship2022/iroha/vcpkg-build/downloads/abseil-abseil-cpp-997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz ]
      Expected hash: [ bdd80a2278eef121e8837791fdebca06e87bfff4adc438c123e0ce11efc42a8bd461edcbbe18c0eee05be2cd6100f9acf8eab3db58ac73322b5852e6ffe7c85b ]
        Actual hash: [ cf8bb1676d2fcba8bdd4bc30e2060bc5552a348d6e192561aec2763460120b10dcb86e29efe60d972d4b241783563bc8067381c48209daee4ecc429786ef6bba ]

因此我可以编辑包含哈希的文件:ports/abseil/portfile.cmake


另一个解决方案是运行Abseil Project的正确cmake使用verbose = 1,然后在编辑文件和重新命令之后复制失败的构建命令。


我知道我的解决方案很脏,所以我想知道是否有更清洁的方法来解决问题 - 当我们使用vcpkg软件包管理器时,如何编辑库的源代码?

I'm installing dependencies for some project which downloads dependencies with vcpkg (the project is Hyperledger Iroha, but it does not matter). Unfortunately when compiling dependencies with my compiler (g++ 12.1.0) one of packages (abseil) is not compiling.

The reason why it is not compiling is easy to fix in code - just one line to change.

The line is pointed by cmake:

CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:146 (message):
    Command failed: /usr/bin/cmake --build . --config Debug --target install -- -v -j13
    Working Directory: /home/agh/Pulpit/blockchain/internship2022/iroha/vcpkg-build/buildtrees/abseil/x64-linux-dbg
    See logs for more information:
      /home/agh/Pulpit/blockchain/internship2022/iroha/vcpkg-build/buildtrees/abseil/install-x64-linux-dbg-out.log

and the error is:

/home/agh/Pulpit/blockchain/internship2022/iroha/vcpkg-build/buildtrees/abseil/src/ca9688e9f6-e4cda1d679.clean/absl/debugging/failure_signal_handler.cc:139:32: error: no matching function for call to ‘max(long int, int)’
  139 |   size_t stack_size = (std::max(SIGSTKSZ, 65536) + page_mask) & ~page_mask;
      |                        ~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/12.1.0/algorithm:60,

The reason is easy to fix - I just need to change one line to fix this.
Unfortunately when I'm changing the line of code and then after rerunning:

vcpkg install abseil

my changes are being removed before compilation. I found option which should help:
--editable, but it is happening again.

I would like to ask what is more professional (but still fast) way to change files, which are being build with vcpkg and containing errors?


The one solution which I found is that I can edit package:
-- Using cached /home/agh/Pulpit/blockchain/internship2022/iroha/vcpkg-build/downloads/abseil-abseil-cpp-997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz
when I edit the package I see error:

          File path: [ /home/agh/Pulpit/blockchain/internship2022/iroha/vcpkg-build/downloads/abseil-abseil-cpp-997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz ]
      Expected hash: [ bdd80a2278eef121e8837791fdebca06e87bfff4adc438c123e0ce11efc42a8bd461edcbbe18c0eee05be2cd6100f9acf8eab3db58ac73322b5852e6ffe7c85b ]
        Actual hash: [ cf8bb1676d2fcba8bdd4bc30e2060bc5552a348d6e192561aec2763460120b10dcb86e29efe60d972d4b241783563bc8067381c48209daee4ecc429786ef6bba ]

so I can edit file containing the hash: ports/abseil/portfile.cmake


Another solution is to run proper cmake of the abseil project with VERBOSE=1, then copy failing build commands after that edit files and rerun commands.


I know that my solutions are quite dirty so I would like to know if there is cleaner way to solve problem - how to edit source code of a library when it is not compiling when we use vcpkg package manager?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无需解释 2025-02-13 14:13:04

这就是我的操作方式:

  1. 使用运行安装 - 可编辑
vcpkg install abseil --editable
  1. 在源dir中初始化git repo:
cd buildtrees/abseil/src/_random_string_/
git init .
git add .
git commit -m "init"
  1. 修补库
  2. 通过使用- 可编辑再次
vcpkg install abseil --editable
  1. 创建 来验证库的构建。更改(或提交)的修补程序
git diff > fix_build.patch
  1. 将补丁复制到端口dir中,并调整portfile.cmake
vcpkg_from_github(
    REPO google/abseil
    ...
    PATCHES fix_build.patch # <-- this is our patch
)
  1. 将端口目录复制到项目的覆盖端口dir中。 - 或 - 更新端口版本,将其提交到您的自定义注册表中。
  2. (可选,但赞赏)在上游和VCPKG主仓库中创建PR。

This is how I do it:

  1. Run install with --editable
vcpkg install abseil --editable
  1. Initialize git repo in source dir:
cd buildtrees/abseil/src/_random_string_/
git init .
git add .
git commit -m "init"
  1. Patch the library
  2. Verify the library builds by calling install with --editable again
vcpkg install abseil --editable
  1. Create patch from changes (or commits)
git diff > fix_build.patch
  1. Copy patch into port dir and adjust portfile.cmake
vcpkg_from_github(
    REPO google/abseil
    ...
    PATCHES fix_build.patch # <-- this is our patch
)
  1. Copy the port directory into your project's overlay-ports dir. -OR- Update port version, submit it into your custom registry.
  2. (optional, but appreciated) Create PR in upstream and vcpkg main repo.
复古式 2025-02-13 14:13:04

在这里,您有更多的方式。 IM用于自定义代码,用于使用FFMPEG,然后使用VCPKG构建。

重建VCPKG而不再次安装

Here u have more simply way. Im used for custom code changed for ffmpeg using and then build with vcpkg.

Rebuild vcpkg without installing again

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文