- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试让 SSL 与 boost ASIO 一起工作。我在 Windows 上使用 MingW 6.3。
我用 MingW 构建了 OpenSSL 1.1、1.0 和 0.8,当我尝试将它们链接到项目时,我总是会遇到不同的错误(取决于缺少什么)。现在我正在尝试使 OpenSSL 1.1.0g 工作,但即使我使用 CMAKE 手动提供库的路径,我也会遇到这些错误:
如果我使用 OpenSSL 1.1.0g 构建我的项目,这是错误:
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" --build C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug --target AuthServer -- -j 2
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -HC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer -BC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug --check-build-system CMakeFiles\Makefile.cmake 0
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 AuthServer
mingw32-make.exe[1]: Entering directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug'
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -HC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer -BC:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -E cmake_progress_start C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug\CMakeFiles 6
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 CMakeFiles/AuthServer.dir/all
mingw32-make.exe[2]: Entering directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug'
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\AuthServer.dir\build.make CMakeFiles/AuthServer.dir/depend
mingw32-make.exe[3]: Entering directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug'
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug C:\Users\myuser\Documents\MagesBattleAuthServerCPP\AuthServer\cmake-build-debug\CMakeFiles\AuthServer.dir\DependInfo.cmake --color=
mingw32-make.exe[3]: Leaving directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug'
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\AuthServer.dir\build.make CMakeFiles/AuthServer.dir/build
mingw32-make.exe[3]: Entering directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug'
[ 16%] Linking CXX executable bin\Windows\AuthServer.exe
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -E cmake_link_script CMakeFiles\AuthServer.dir\link.txt --verbose=1
"C:\Program Files\JetBrains\CLion 2017.2.3\bin\cmake\bin\cmake.exe" -E remove -f CMakeFiles\AuthServer.dir/objects.a
C:\MinGW\bin\ar.exe cr CMakeFiles\AuthServer.dir/objects.a @CMakeFiles\AuthServer.dir\objects1.rsp
C:\MinGW\bin\g++.exe -g -Wl,--whole-archive CMakeFiles\AuthServer.dir/objects.a -Wl,--no-whole-archive -o bin\Windows\AuthServer.exe -Wl,--out-implib,lib\libAuthServer.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\AuthServer.dir\linklibs.rsp
CMakeFiles\AuthServer.dir/objects.a(main.cpp.obj): In function `ZN5boost4asio3ssl6detail17openssl_init_base7do_initD1Ev':
c:/users/myuser/documents/magesbattleauthservercpp/include/boost/asio/ssl/detail/impl/openssl_init.ipp:89: undefined reference to `CONF_modules_unload'
CMakeFiles\AuthServer.dir/objects.a(main.cpp.obj): In function `ZNK5boost4asio5error6detail12ssl_category7messageB5cxx11Ei':
c:/users/myuser/documents/magesbattleauthservercpp/include/boost/asio/ssl/impl/error.ipp:39: undefined reference to `ERR_reason_error_string'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\AuthServer.dir\build.make:217: recipe for target 'bin/Windows/AuthServer.exe' failed
mingw32-make.exe[3]: Leaving directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug'
CMakeFiles\Makefile2:69: recipe for target 'CMakeFiles/AuthServer.dir/all' failed
mingw32-make.exe[2]: Leaving directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug'
mingw32-make.exe[3]: *** [bin/Windows/AuthServer.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles/AuthServer.dir/all] Error 2
CMakeFiles\Makefile2:81: recipe for target 'CMakeFiles/AuthServer.dir/rule' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/myuser/Documents/MagesBattleAuthServerCPP/AuthServer/cmake-build-debug'
Makefile:120: recipe for target 'AuthServer' failed
mingw32-make.exe[1]: *** [CMakeFiles/AuthServer.dir/rule] Error 2
mingw32-make.exe: *** [AuthServer] Error 2
制作:
cmake_minimum_required(VERSION 3.8)
project(AuthServer)
#----------------- MACROS -----------------------------
#FIND THE CORRECT VERSION OF WINNT
macro(get_WIN32_WINNT version)
if (CMAKE_SYSTEM_VERSION)
set(ver ${CMAKE_SYSTEM_VERSION})
string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
string(REGEX MATCH "^([0-9]+)" verMajor ${ver})
# Check for Windows 10, b/c we'll need to convert to hex 'A'.
if ("${verMajor}" MATCHES "10")
set(verMajor "A")
string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
endif ("${verMajor}" MATCHES "10")
# Remove all remaining '.' characters.
string(REPLACE "." "" ver ${ver})
# Prepend each digit with a zero.
string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver})
set(${version} "0x${ver}")
endif(CMAKE_SYSTEM_VERSION)
endmacro(get_WIN32_WINNT)
#----------------- MACROS -----------------------------
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_STANDARD 14)
SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
add_definitions(-DBOOST_NETWORK_ENABLE_HTTPS)
set(SOURCE_FILES
AuthServer/Client.cpp
AuthServer/Client.h
AuthServer/main.cpp
AuthServer/NetworkManager.cpp
AuthServer/NetworkManager.h
AuthServer/Message.cpp
AuthServer/Message.h
AuthServer/JsonSerializable.h
AuthServer/JsonDeserializerFactory.cpp
AuthServer/JsonDeserializerFactory.h)
if (WIN32) #windows
#set the correct WINNET version
get_WIN32_WINNT(ver)
add_definitions(-D_WIN32_WINNT=${ver})
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32 -lwsock32 -lmswsock")
#set the correct lib build type .a because we are using mingw
if(${CMAKE_BUILD_TYPE} MATCHES "debug")
SET(CMAKE_FIND_LIBRARY_SUFFIXES "-mgw63-mt-d-1_65_1.a" ".a")
ELSEIF(${CMAKE_BUILD_TYPE} MATCHES "release")
SET(CMAKE_FIND_LIBRARY_SUFFIXES "-mgw63-mt-1_65_1.a" ".a")
ENDIF()
#find all the libs
find_library(BOOST_LIBRARY_atomic
NAMES boost_atomic
PATHS ${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_chrono
NAMES boost_chrono
PATHS ${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_date_time
NAMES boost_date_time
PATHS ${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_regex
NAMES boost_regex
PATHS ${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_thread
NAMES boost_thread
PATHS ${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_system
NAMES boost_system
PATHS ${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_iostreams
NAMES boost_iostreams
PATHS ${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_zlib
NAMES boost_zlib
PATHS ${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(LIBRARY_ossl_ssl
NAMES ssl
PATHS ${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(LIBRARY_ossl_crypto
NAMES crypto
PATHS ${CMAKE_SOURCE_DIR}/../Lib/win/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
add_executable(AuthServer ${SOURCE_FILES})
ELSEif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") #osx
SET(CMAKE_OSX_ARCHITECTURES x86_64)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".dylib")
find_library(BOOST_LIBRARY_atomic
NAMES boost_atomic
PATHS ${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_chrono
NAMES boost_chrono
PATHS ${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_date_time
NAMES boost_date_time
PATHS ${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_regex
NAMES boost_regex
PATHS ${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_thread
NAMES boost_thread
PATHS ${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_system
NAMES boost_system
PATHS ${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_iostreams
NAMES boost_iostreams
PATHS ${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
find_library(BOOST_LIBRARY_zlib
NAMES boost_zlib
PATHS ${CMAKE_SOURCE_DIR}/../Lib/osx/x64/${CMAKE_BUILD_TYPE}
NO_DEFAULT_PATH)
add_executable(AuthServer ${SOURCE_FILES})
endif()
target_include_directories(AuthServer PUBLIC ${CMAKE_SOURCE_DIR}/../Include)
target_link_libraries(AuthServer
PUBLIC
${BOOST_LIBRARY_chrono}
${BOOST_LIBRARY_atomic}
${BOOST_LIBRARY_date_time}
${BOOST_LIBRARY_regex}
${BOOST_LIBRARY_thread}
${BOOST_LIBRARY_system}
${BOOST_LIBRARY_iostreams}
${BOOST_LIBRARY_zlib}
${LIBRARY_ossl_ssl}
${LIBRARY_ossl_crypto}
)
set_target_properties(AuthServer
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME}"
)
构建 OpenSSL 的命令 (mingw msys2)
$ ./Configure mingw64 no-shared no-asm --prefix=/C/OpenSSL-x64
$ make && make install
链接库.rsp
C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_chrono-mgw63-mt-d-1_65_1.a
C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_atomic-mgw63-mt-d-1_65_1.a
C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_date_time-mgw63-mt-d-1_65_1.a
C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_regex-mgw63-mt-d-1_65_1.a
C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_thread-mgw63-mt-d-1_65_1.a
C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_system-mgw63-mt-d-1_65_1.a
C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_iostreams-mgw63-mt-d-1_65_1.a
C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libboost_zlib-mgw63-mt-d-1_65_1.a
C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libssl.a
C:/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libcrypto.a
-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid
-lcomdlg32 -ladvapi32 -lws2_32 -lwsock32 -lmswsock -ldl -lpthread
我编译的 OpenSSL 库的 nm :
myuser@LHCFB203 MINGW64 ~
$ nm /C/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libcrypto.a | grep 'CONF_modules_unload'
00000000000005c0 T CONF_modules_unload
myuser@LHCFB203 MINGW64 ~
$ nm /C/Users/myuser/Documents/MagesBattleAuthServerCPP/Lib/win/x64/debug/libcrypto.a | grep 'ERR_reason_error_string'
0000000000004de0 T ERR_reason_error_string
我是否使用了错误版本的 OpenSSL?我不应该使用 OpenSSL 吗?我构建错了吗?
编辑:添加了 -ldl 和 -lpthread 但这没有帮助。
最佳答案
我遇到这个问题是因为我不小心使用了 x86(32 位)版本的 openssl(来自 https://www.nuget.org/packages/openssl-vc141/ 没有说明机器)并将它与 x64 boost asio 链接到我的 x64 项目中。
VS2017 已编译,仅在链接期间提示缺少两个符号:
LNK2001 unresolved external symbol CONF_modules_unload
LNK2001 unresolved external symbol ERR_reason_error_string
Dumpbin 显示这些符号存在,但后来我看到该符号(和整个库)是为 x86 编译的...facepalm;奇怪的是链接器不会提示不同的机器......
我切换到这个版本并且所有编译/链接都正确:
关于c++ - Boost 1_65_1 不使用 OpenSSL 1.1.0g "undefined reference"编译,但使用 "nm"找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47138675/
这个问题在这里已经有了答案: Different ways of loading a file as an InputStream (6 个答案) 关闭 8 年前。 在我的 gradle java
给定一个 User 类: class User end 我想使用 .class_eval 定义一个新常量.所以: User.class_eval { AVOCADO = 'fruit' } 如果我尝试
这可能听起来很奇怪,但我正在开发一个需要查找 div 内的元素或 div 本身的插件。 脚本根据用户选择查找元素,但内容(包括标记)是可变的。因此脚本将按如下方式查找元素: $('.block').f
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 7 年前。 Improve th
我需要在按我自己的函数排序的对的多集中查找并删除一个值。显然, .find 总是将迭代器返回到末尾,而不是返回到搜索到的值。有小费吗?这是函数: struct cmp { bool operato
求助!我将如何通过遍历查看字符并计算有效字符出现之前的下划线数量来查找和删除前导下划线。以及从字符串末尾向后迭代以查找任何尾随下划线。 我可以使用下面的方法来删除下划线,但是如何迭代才能找到下划线。
如果你在 $(xml) 中有下面的 xml,你会变得懒惰: $(xml).find("animal").find("dog").find("beagle").text() 在 jQuery 中是否有类
你如何找到4个文件的交集? 我用了grep -Fx -f 1.txt 2.txt 3.txt 4.txt ,但它似乎只适用于 2 个文件。同样comm -12 1.txt 2.txt无法扩展为 4 个
我已经完成了标记的姿势估计并获得了 rvec 和 tvec 值。我不知道如何找到它的中心,因为我需要绘制一个需要中心值的圆柱体。 我该怎么做? 最佳答案 标记的 tvec 是标记从原点的平移 (x,y
我有一个任务,我需要找到 2 个单链接(单对单)列表的交集。我还必须为 2 个双向链接(双重 vs 双重)列表执行此操作: 对于单链表,我使用 mergeSort() 对两个列表进行排序,然后逐项比较
我是 R 的新手,我有一个 100x100 的方阵。我想找到这个矩阵的最大特征值。我试过了 is.indefinite(x) 但是它写 is.indefinite(x) : argument x is
您好,我是 svg 和 JavaScript 的新手,当鼠标位于 svg 上方时,我试图使一些 svg 元素弹出(通过缩放),反之亦然,当鼠标离开 svg 元素时。 我已经能够通过使用转换使 svg
我正在尝试为 scala 项目编写一个类,但在多个地方使用 class、def、while 等关键字出现此错误。 它发生在这样的地方: var continue = true while (conti
我有两个 pandas 数据框,它们只取自一列并将日期列设置为索引,所以现在我有两个 Series。我需要找到这些系列的相关性。 这里有几行来自dfd: index change 2018-
我正在尝试调整我的 Vagrantfile,因此如果它丢失,它会自动在项目根目录中创建一个文件夹。创建文件夹没问题,但我无法找到创建该文件夹的位置。 我发现此信息可在 Vagrant::Environ
我正在尝试在 jquery 中找到 Test3 的位置,请有人引导我走上正确的道路。 我需要jquery来显示5 Test7 Test2 Test6 Test5 Test3 Test8 谢谢 最佳
大家早上好 我有一个像这样的图像列表: 使用 jQuery 如何查找 ul#preload 中包含特定字符串(例如“green”)的所有图像 src 类似... var new_src = j
我正在开发一个修改 Excel 文件的应用程序。 如何找到任意行中最后使用的单元格? 示例:行号 => 5 中最后使用的单元格 最佳答案 要找到一行中的最后一个单元格,您需要 Range 的 End
我刚刚陷入 react native ,需要一些帮助才能在找到 token 时导航到 protected 屏幕。我应该在哪里寻找应用程序加载时的 token ?如何在不多次调用导航的情况下导航用户一次
非常奇怪...此页面是 protected 内容还是我不知道的内容?我尝试单击下一页 anchor 。 参见this page first. 我试图用这个来抓取元素 var buttonNext =
我是一名优秀的程序员,十分优秀!