无法构建cpprestsdk
Unable to build cpprestsdk
本文关键字:cpprestsdk 构建 更新时间:2023-10-16
当我尝试构建cpprestsdk(https://github.com/microsoft/cpprestsdk(时,我会得到一个很长的错误列表。在这里我的环境:
- Windows 10
- MSYS2与i686-W64-MingW32工具链
- GCC 6.3.0
- 制作4.2.1
- cmake 3.8.0
cmake
$ cmake -G "MSYS Makefiles" .. -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: C:/dev/msys32/mingw32/bin/gcc.exe
-- Check for working C compiler: C:/dev/msys32/mingw32/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/dev/msys32/mingw32/bin/g++.exe
-- Check for working CXX compiler: C:/dev/msys32/mingw32/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Setting gcc options
-- websocketpp not found, using the embedded version
-- Boost version: 1.63.0
-- Found the following Boost libraries:
-- system
-- date_time
-- regex
-- Found OpenSSL: C:/dev/msys32/mingw32/lib/libssl.dll.a (found suitable version "1.0.2k", minimum required is "1.0.0")
-- Performing Test _SSL_LEAK_SUPPRESS_AVAILABLE
-- Performing Test _SSL_LEAK_SUPPRESS_AVAILABLE - Success
-- Found ZLIB: C:/dev/msys32/mingw32/lib/libz.dll.a (found version "1.2.11")
-- Added test library httpclient_test
-- Added test library httplistener_test
-- Added test library json_test
-- Added test library pplx_test
-- Added test library streams_test
-- Added test library uri_test
-- Added test library utils_test
-- Added test library websocketclient_test
-- Configuring done
-- Generating done
-- Build files have been written to: C:/cpprestsdk/Release/build.release
这里似乎还可以。
make
$ make
Scanning dependencies of target cpprest
[ 0%] Building CXX object src/CMakeFiles/cpprest.dir/http/client/http_client.cpp.obj
In file included from C:/cpprestsdk/Release/src/http/client/http_client.cpp:16:0:
C:/cpprestsdk/Release/src/pch/stdafx.h:43:0: error: "NOMINMAX" redefined [-Werror]
#define NOMINMAX
In file included from C:/dev/msys32/mingw32/include/c++/6.3.0/i686-w64-mingw32/bits/c++config.h:507:0,
from C:/dev/msys32/mingw32/include/c++/6.3.0/string:38,
from C:/cpprestsdk/Release/include/cpprest/details/basic_types.h:16,
from C:/cpprestsdk/Release/src/pch/stdafx.h:23,
from C:/cpprestsdk/Release/src/http/client/http_client.cpp:16:
C:/dev/msys32/mingw32/include/c++/6.3.0/i686-w64-mingw32/bits/os_defines.h:45:0: note: this is the location of the previous definition
#define NOMINMAX 1
In file included from C:/cpprestsdk/Release/src/pch/stdafx.h:104:0,
from C:/cpprestsdk/Release/src/http/client/http_client.cpp:16:
C:/cpprestsdk/Release/include/cpprest/interopstream.h:20:0: error: ignoring #pragma warning [-Werror=unknown-pragmas]
#pragma warning(push)
C:/cpprestsdk/Release/include/cpprest/interopstream.h:21:0: error: ignoring #pragma warning [-Werror=unknown-pragmas]
#pragma warning(disable : 4250)
In file included from C:/cpprestsdk/Release/src/pch/stdafx.h:104:0,
from C:/cpprestsdk/Release/src/http/client/http_client.cpp:16:
C:/cpprestsdk/Release/include/cpprest/interopstream.h:523:0: error: ignoring #pragma warning [-Werror=unknown-pragmas]
#pragma warning(pop)
In file included from C:/cpprestsdk/Release/src/pch/stdafx.h:143:0,
from C:/cpprestsdk/Release/src/http/client/http_client.cpp:16:
C:/cpprestsdk/Release/include/cpprest/details/http_server_httpsys.h:19:0: error: ignoring #pragma warning [-Werror=unknown-pragmas]
#pragma warning(push)
C:/cpprestsdk/Release/include/cpprest/details/http_server_httpsys.h:20:0: error: ignoring #pragma warning [-Werror=unknown-pragmas]
#pragma warning(disable : 6386)
In file included from C:/cpprestsdk/Release/src/pch/stdafx.h:143:0,
from C:/cpprestsdk/Release/src/http/client/http_client.cpp:16:
C:/cpprestsdk/Release/include/cpprest/details/http_server_httpsys.h:22:0: error: ignoring #pragma warning [-Werror=unknown-pragmas]
#pragma warning(pop)
In file included from C:/cpprestsdk/Release/include/pplx/pplxwin.h:19:0,
from C:/cpprestsdk/Release/include/pplx/pplx.h:43,
from C:/cpprestsdk/Release/include/pplx/pplxtasks.h:42,
from C:/cpprestsdk/Release/src/pch/stdafx.h:97,
from C:/cpprestsdk/Release/src/http/client/http_client.cpp:16:
C:/cpprestsdk/Release/include/pplx/pplxinterface.h:52:29: error: 'novtable' attribute directive ignored [-Werror=attributes]
struct __declspec(novtable) scheduler_interface
^~~~~~~~~~~~~~~~~~~
In file included from C:/cpprestsdk/Release/include/pplx/pplx.h:43:0,
from C:/cpprestsdk/Release/include/pplx/pplxtasks.h:42,
from C:/cpprestsdk/Release/src/pch/stdafx.h:97,
from C:/cpprestsdk/Release/src/http/client/http_client.cpp:16:
C:/cpprestsdk/Release/include/pplx/pplxwin.h:175:14: error: extra qualification 'pplx::details::recursive_lock_impl::' on member 'lock' [-fpermissive]
void recursive_lock_impl::lock()
^~~~~~~~~~~~~~~~~~~
C:/cpprestsdk/Release/include/pplx/pplxwin.h:191:14: error: extra qualification 'pplx::details::recursive_lock_impl::' on member 'unlock' [-fpermissive]
void recursive_lock_impl::unlock()
^~~~~~~~~~~~~~~~~~~
C:/cpprestsdk/Release/include/pplx/pplxwin.h: In constructor 'pplx::details::recursive_lock_impl::recursive_lock_impl()':
C:/cpprestsdk/Release/include/pplx/pplxwin.h:208:23: error: 'pplx::details::recursive_lock_impl::_M_owner' will be initialized after [-Werror=reorder]
volatile long _M_owner;
...
输出非常长。这些只是第一个错误。这里发生了什么?
cpprestsdk开发人员的官方位置如下:
https://github.com/microsoft/cpprestsdk/issues/202
我们不正式支持Windows上的Mingw;如果您能够使此工作工作,请发布您的结果。
现在,make命令的输出包含264个错误,其中大多数是:
- 错误:在此范围中未声明'_asserte'
- 错误:...
- 覆盖'虚拟const char* std :: exception :: what what((
- 没有任何论点...取决于模板参数,因此必须提供...
- 静态断言失败:不支持从流中提取的类型
- ...不是类型
- 需要"打字"之前...因为...是一个依赖范围
- 期望';'之前...
- "*"令牌之前的预期主表达
- ...
我想修复它们将需要深入编辑代码。
所有这些错误似乎都被视为错误。几乎所有的人都是无害的(除了重新订购除外(。您可能有 -Werror
"警告作为错误"选项打开某个地方是cmake文件。
在使用vcpkg进行cpprestsdk安装websocketpp之前vcpkg安装 - X64-Windows zlib openssl boost-system boost-date-time boost-regex boost-regex boost-interprocess websocketpp brotli
完整的RESTCPPSDK构建指南&源代码https://sageai.blogspot.com/2020/12/how-to-build-cpprestsdk-using-using-vcpkg-in.html
相关文章:
- C++为构建时间获取QDateTime的可靠方法
- 无法在 CLion 中构建 C++ 项目
- 函数向量_指针有不同的原型,我可以构建一个吗
- 如何使用ndk-build.cmd构建Android.so文件
- libssh 的函数在构建 libssh 时无法在 Qt 和 cmake 错误中找到
- 使用cmake从源代码构建MySQL连接器/C++失败(与以前的声明冲突)
- VSCode-有一个红色下划线,但程序构建和运行正确,并且出现配音错误
- 构建可组合有向图(扫描仪生成器的汤普森构造算法)
- 无法使用Qt Creator在Windows中构建yaml-cpp
- 构建一个由C和C++文件组成的库
- llvm构建器向基本块添加终止符
- FLTK 2.0构建和演示,适用于VS2019的2011年左右的代码库
- 如何跨平台将二进制资源构建到程序中?
- 将 OpenCV 与 CMAKE 中的项目一起构建为第三方库的正确方法
- 如何解决 Ninja c++ 构建和执行问题
- 使用 cmake 的 LLVM 构建在 tsan_libdispatch_mac.cc 期间失败; "Error: conflicting types for ..."
- CMake WxWidgets项目成功地在Linux上构建,但没有在Windows上构建
- 更改命令行 qt5 源代码构建配置的正确/快速方法
- 无法构建cpprestsdk
- 构建cpprestsdk时的cmake错误