删除OpenSSL 3.0 Devel SO C++在Linux上编译

发布于 2025-02-10 21:51:43 字数 353 浏览 1 评论 0原文

我在Ubuntu 22.04上,并编译此C ++ github拉力请求:

https://github.com/ ftexchange/ftx/pull/13

但是,PR包含编译错误。

有人发布以修复错误OpenSSL 3.0 Devel版本必须“删除”:

似乎编译器正在使用OpenSSL 3.0 Devel版本,我有 删除该

如何实现?

I'm on Ubuntu 22.04 and compiling this C++ Github pull request:

https://github.com/ftexchange/ftx/pull/13

However, the PR contains a compile error.

Somebody posted to fix the error OpenSSL 3.0 devel version must be "removed":

It seems like the compiler was using OpenSSL 3.0 devel version, I had
to remove that

How do I achieve this?

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

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

发布评论

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

评论(1

旧伤慢歌 2025-02-17 21:51:43

这就是我在Ubuntu 22.04 Lts上所做的。

$ sudo apt install libboost-dev libssl-dev
$ git clone --recursive --branch openssl-1.1 https://github.com/arf-labs-ou/ftx.git
$ cmake -G Ninja -S ftx/cpp -B build -DCMAKE_BUILD_TYPE=Release
$ cmake --build build

在此时尝试构建时,将在针对系统编译时将弃用警告3。 -编码-werror在其构建中,这将促进到虚假错误。弃用并不意味着“今天不起作用”;这意味着“上游必须修复”。您不是上游,所以这不应影响您,但是,低质量的构建代码并不令人惊讶。

我们将通过用shell脚本将编译器包裹起来,该脚本从命令行中删除警告标志。创建一个称为no-warnings.sh的文件:

#!/bin/bash

ARGS=()

for arg in "$@"; do
  if [[ ! "$arg" =~ ^-W ]]; then
    ARGS+=("$arg")
  fi
done

"${ARGS[@]}"

构建中

$ chmod +x no-warnings.sh
$ rm -rf build
$ cmake -G Ninja -S ftx/cpp/ -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=$PWD/no-warnings.sh
$ cmake --build build/

现在让我们通过cmake_cxx_compiler_launcher钩子将其注入 即使这还不足以成功建立。代码本身具有类型错误!我想知道提升1.71和1.74之间是否发生了变化。无论如何,我应用了以下补丁程序:

diff --git a/cpp/src/util/HTTP.cc b/cpp/src/util/HTTP.cc
index 30e0277..2d043f2 100644
--- a/cpp/src/util/HTTP.cc
+++ b/cpp/src/util/HTTP.cc
@@ -100,8 +100,8 @@ void HTTPSession::authenticate(http::request<http::string_body>& req)
     std::string path(req.target());
     std::string body(req.body());
 
-    long ts = get_ms_timestamp(current_time()).count();
-    std::string data = std::to_string(ts) + method + path;
+    auto ts = std::to_string(get_ms_timestamp(current_time()).count());
+    std::string data = ts + method + path;
     if (!body.empty()) {
         data += body;
     }

现在上面的命令成功构建。示例程序也运行并产生合理的输出。

This is what I did on Ubuntu 22.04 LTS.

$ sudo apt install libboost-dev libssl-dev
$ git clone --recursive --branch openssl-1.1 https://github.com/arf-labs-ou/ftx.git
$ cmake -G Ninja -S ftx/cpp -B build -DCMAKE_BUILD_TYPE=Release
$ cmake --build build

Trying to build at this point will trip deprecation warnings when compiling against the system OpenSSL 3. But because ftx has done the extremely inadvisable thing of hard-coding -Werror in their build, this is promoted to a spurious error. Deprecated doesn't mean "won't work today"; it means "upstream must fix". You are not upstream, so this ought not affect you, but, alas, low-quality build code is not a great surprise.

We will hack around this by wrapping the compiler with a shell script that deletes warning flags from the command line. Create a file called no-warnings.sh:

#!/bin/bash

ARGS=()

for arg in "$@"; do
  if [[ ! "$arg" =~ ^-W ]]; then
    ARGS+=("$arg")
  fi
done

"${ARGS[@]}"

Now let's inject it into the build via the CMAKE_CXX_COMPILER_LAUNCHER hook:

$ chmod +x no-warnings.sh
$ rm -rf build
$ cmake -G Ninja -S ftx/cpp/ -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=$PWD/no-warnings.sh
$ cmake --build build/

This should work but, unfortunately, even this wasn't enough to build successfully. The code itself has a type error! I wonder if something changed between Boost 1.71 and 1.74. Anyway, I applied the following patch:

diff --git a/cpp/src/util/HTTP.cc b/cpp/src/util/HTTP.cc
index 30e0277..2d043f2 100644
--- a/cpp/src/util/HTTP.cc
+++ b/cpp/src/util/HTTP.cc
@@ -100,8 +100,8 @@ void HTTPSession::authenticate(http::request<http::string_body>& req)
     std::string path(req.target());
     std::string body(req.body());
 
-    long ts = get_ms_timestamp(current_time()).count();
-    std::string data = std::to_string(ts) + method + path;
+    auto ts = std::to_string(get_ms_timestamp(current_time()).count());
+    std::string data = ts + method + path;
     if (!body.empty()) {
         data += body;
     }

And now the above commands produce a successful build. The example programs run and produce reasonable output, as well.

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