Installing openssl 3.0.5 in windows 10 using CMake externalproject failing due to config.com file

597 Views Asked by At

I was trying to install openssl in external project using CMake in ubuntu , android and Windows. Its working fine in ubuntu . but in windows , Its failing with the following line

  Performing configure step for 'openssl_external'
  This version of D:\17-6-2022\main\src\external\openssl\config.com is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

Looks like the issue is with the config.com file is not supported in windows 10. Not sure how to fix it since the above error might come with architecture change . my system is windows 64 and this openssl 3.0.5 is creating lib64 folders in my ubuntu.

I have added the CMake command for configure and install below:

set(OPENSSL_INSTALL_DIR ${CMAKE_BINARY_DIR}/install)
set(OPENSSL_INCLUDE_DIR ${OPENSSL_INSTALL_DIR}/include)
set(OPENSSL_LIB_DIR ${OPENSSL_INSTALL_DIR}/lib)
set(OPENSSL_DATA_DIR ${OPENSSL_INCLUDE_DIR}/openssl-data)
set(OPENSSL_CONFIGURE_COMMAND ${CMAKE_CURRENT_LIST_DIR}/config)

 ExternalProject_Add(
      openssl_external
      PREFIX openssl
      SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}"
      CONFIGURE_COMMAND ${OPENSSL_CONFIGURE_COMMAND}
      --prefix=${OPENSSL_INSTALL_DIR}
      --openssldir=${OPENSSL_DATA_DIR}
      --libdir=${OPENSSL_LIB_DIR}
      no-shared
      BUILD_COMMAND make
      TEST_COMMAND ""
      INSTALL_COMMAND make install
      INSTALL_DIR ${OPENSSL_INSTALL_DIR}
      BUILD_IN_SOURCE 0)
   
1

There are 1 best solutions below

0
On

I have used config as configure command in the above example. but ./config script is a legacy script by Openssl team which is used on 1.x versions. This only supports Unix based OS. because of that its not working well with windows OS for mycase. (IDK why Openssl team is still keeping it.)

For latest versions its recommended to use Configure script . this works fine in both windows(perl Configure) and unix(./Configure)