Open TSC21 opened 1 year ago
But, for some reason,
libdatachannel
when callingfind_package(OpenSSL REQUIRED)
, fails to findOPENSSL_CRYPTO_LIBRARY
as it can be seen above. Note thatOPENSSL_INCLUDE_DIR
had to also be passed as aCMAKE_ARG
to buildlidatachannel
becauseFindOpenSSL()
is was also not able to findopenssl/ssl.h
, although it is installed in${CMAKE_INSTALL_PREFIX}/include
.
OPENSSL_INCLUDE_DIR
is actually an output variable of FindOpenSSL()
, so you must not set it yourself. Instead, you should set OPENSSL_ROOT_DIR
, and OPENSSL_USE_STATIC_LIBS
to TRUE
since the OpenSSL build is static.
But, for some reason,
libdatachannel
when callingfind_package(OpenSSL REQUIRED)
, fails to findOPENSSL_CRYPTO_LIBRARY
as it can be seen above. Note thatOPENSSL_INCLUDE_DIR
had to also be passed as aCMAKE_ARG
to buildlidatachannel
becauseFindOpenSSL()
is was also not able to findopenssl/ssl.h
, although it is installed in${CMAKE_INSTALL_PREFIX}/include
.
OPENSSL_INCLUDE_DIR
is actually an output variable ofFindOpenSSL()
, so you must not set it yourself. Instead, you should setOPENSSL_ROOT_DIR
, andOPENSSL_USE_STATIC_LIBS
toTRUE
since the OpenSSL build is static.
@paullouisageneau yes I know the above and the only reason I set OPENSSL_INCLUDE_DIR
is because I saw it at least allowed to find the include dirs - it was just something I tried. It doesn't matter if I set OPENSSL_USE_STATIC_LIBS
- it's still not able to find it. It seems to be though this might be a problem with libsrtp
, since the error is coming from there (still, it uses find_package(OpenSSL REQUIRED)
as in libdatachannel
).
One more tip:
After installing openssl (in my case I set environment variables: OPENSSL_CONF, OPENSSL_HOME in this link).
Then open the last version of Visual Studio Community and use "Open local folder" to specify the libdatachannel project.
Visual Studio Community automatically builds the project without any problems. I was getting multiple link errors with nmake & Makefiles but Visual Studio fixed them all at once.
I guess the issue is already solved, if not, try setting OPENSSL_ROOT_DIR and force -D CMAKE_POLICY_DEFAULT_CMP0074=NEW (had a smilar issue when compiling libdatachannel for windows with mbedtls instead of openssl in https://gitlab.com/Tim-S/libdatachannel-win32-builds)
I am trying to cross-compile
libdatachannel
to Windows using dockcross (more specifically, https://github.com/dockcross/dockcross/tree/master/windows-static-x64) in Ubuntu 20.04. This container image in specific uses MXE together with thex86_64-w64-mingw32
compiler.OpenSSL is also built through this container using the following configuration and build command: (note this is being called from CMake, and so the usage of CMake variables)
The command above runs properly and
libcrypto.a
andlibssl.a
are both installed in${CMAKE_INSTALL_PREFIX}/lib
, besides the headers on the${CMAKE_INSTALL_PREFIX}/include
folder. Here's theinstall
tree structure:But, for some reason,
libdatachannel
when callingfind_package(OpenSSL REQUIRED)
, fails to findOPENSSL_CRYPTO_LIBRARY
as it can be seen above. Note thatOPENSSL_INCLUDE_DIR
had to also be passed as aCMAKE_ARG
to buildlidatachannel
becauseFindOpenSSL()
is was also not able to findopenssl/ssl.h
, although it is installed in${CMAKE_INSTALL_PREFIX}/include
. OpenSSL is marked as a dependency oflibdatachannel
while building through CMake, so I don't necessarily understand why this fails. One thing to note is that MXE setsMSYS
to 1, and also since we are using mingw32 to cross-compile,WIN32
andMINGW
are also set to 1. If I try to manually setMINGW
andWIN32
to 0, thenfind_package(OpenSSL)
succeeds and the build process continues, until the linker fails because the architecture is of course wrong.This is the error seen:
Is this potentially a problem with the OpenSSL build or even with the default
FindOpenSSL.cmake
module? Or is this something that can be addressed onlibdatachannel
CMakeLists.txt
? Any help with this would be appreciated.Thanks in advance!