Issues with adding OpenSSL support to my project

Issues with adding OpenSSL support to my project
0.0 0

#1

Hey,

As far as i know it should be possible to use the existing external OpenSSL library from cocos.
I’ve tried to add it to my CMake project:

#==================================================
#OpenSSL

if(ANDROID)
	set(OPENSSL_PLATFORM_DIR android)
elseif(IOS)
	set(OPENSSL_PLATFORM_DIR ios)
elseif(MACOSX)
	set(OPENSSL_PLATFORM_DIR mac)
elseif(WINDOWS)
	set(OPENSSL_PLATFORM_DIR win32)
elseif(LINUX)
	set(OPENSSL_PLATFORM_DIR linux/64-bit)
else()
	message(FATAL_ERROR "OpenSSL platform not specified or supported")
endif()

set(OPENSSL_PATH ${COCOS2DX_ROOT_PATH}/external/openssl)

include_directories(
	${OPENSSL_PATH}/include/${OPENSSL_PLATFORM_DIR}
)

cocos_find_package(openssl OPENSSL REQUIRED)
cocos_use_pkg(${APP_NAME} openssl)

#set_target_properties(OpenSSL
#PROPERTIES IMPORTED_LOCATION ${OPENSSL_PATH}/prebuilt/${OPENSSL_PLATFORM_DIR}/libssl.a
			#IMPORTED_LOCATION ${OPENSSL_PATH}/prebuilt/${OPENSSL_PLATFORM_DIR}/libcrypto.a)

#==================================================

But there are some strange linker issues

I’m trying to use the OpenSSL library and somehow it works fine except when I try to use AES_Encrypt and AES_Decrypt together. When I use one of them everything is fine, but both of them together generates following issue which i’ve never encountered before:

the 32-bit linker (C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\link.exe) failed to do memory mapped file I/O on lib\Debug\cocos2d.lib' and is going to restart linking with a 64-bit linker for better throughput 8> LINK : restarting link with 64-bit linkerC:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64\link.exe’
8> libtiff.lib(tif_win32.obj) : warning LNK4075: ignoring ‘/EDITANDCONTINUE’ due to ‘/INCREMENTAL:NO’ specification
8> LINK : fatal error C1905: Front end and back end not compatible (must target same processor).
8> LINK : fatal error LNK1257: code generation failed

There is this libtiff.lib in the middle but not sure why this would create issues when using the openssl functions.

VS info to this error: https://msdn.microsoft.com/en-us/library/414e6214.aspx

Maybe i’ve added the lib incorrectly to cmake?


#2

has anyone ever used the openssl lib shipped with cocos?
Many solutions would be to setup the libarary correctly and build it from scratch, but it would be suprising of the lib was built incorrectly.