在其他环境中使用二进制文件时,OpenSSL版本存在问题。当我运行
cmake .. 我看到了这个输出
Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.0.2g")
并且当我在其他环境中使用OpenSSL版本不同(例如1.0.2d)时,会收到此错误
/lib/x86_64-linux-gnu/libcrypto.so.1.0.2: version `OPENSSL_1.0.2g' not found.
如何解决此问题
编辑:这是CMakeList.txt文件
cmake_minimum_required(VERSION 3.1)
project(cryptomagic)
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
set(MBED_TLS_VERSION 2.12.0)
ExternalProject_Add(mbed_tls URL https://github.com/ARMmbed/mbedtls/archive/mbedtls-${MBED_TLS_VERSION}.tar.gz
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mbed_tls
CMAKE_ARGS -
DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/mbed_tls/build
)
ExternalProject_Get_Property(mbed_tls install_dir)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(OPENSSL_ROOT_DIR /usr/local/opt/openssl/)
find_package(OpenSSL REQUIRED)
if(OPENSSL_FOUND)
set(OPENSSL_USE_STATIC_LIBS TRUE)
endif()
include_directories(${OPENSSL_INCLUDE_DIR} src src/include
${install_dir}/build/include include)