Cocos2dx 3.17 Android Studio curl linker error

Environment:
Windows 10
Cocos2dx 3.17.2
Android Studio 3.5.3

Hello I am using a roughly new cocos2dx project android studio project and everything works fine until i add in #include <curl/curl.h> and then i get the following error.

  vtls/openssl.c:(.text.ossl_connect_common+0xbac): undefined reference to `PKCS12_parse'
  vtls/openssl.c:(.text.ossl_connect_common+0x15a8): undefined reference to `BIO_f_ssl'
  ../../../../../../cocos2d/external/curl/prebuilt/android/arm64-v8a/libcurl.a(libcurl_la-openssl.o): In function `Curl_ossl_version':
  vtls/openssl.c:(.text.Curl_ossl_version+0x1c): undefined reference to `OpenSSL_version_num'
  ../../../../../../cocos2d/external/curl/prebuilt/android/arm64-v8a/libcurl.a(libcurl_la-openssl.o): In function `Curl_ossl_seed':
  vtls/openssl.c:(.text.Curl_ossl_seed+0x88): undefined reference to `RAND_load_file'
  vtls/openssl.c:(.text.Curl_ossl_seed+0xe0): undefined reference to `RAND_file_name'
  vtls/openssl.c:(.text.Curl_ossl_seed+0xf4): undefined reference to `RAND_load_file'
  ../../../../../../cocos2d/external/curl/prebuilt/android/arm64-v8a/libcurl.a(libcurl_la-openssl.o): In function `ossl_send':
  vtls/openssl.c:(.text.ossl_send+0x120): undefined reference to `OpenSSL_version_num'
  ../../../../../../cocos2d/external/curl/prebuilt/android/arm64-v8a/libcurl.a(libcurl_la-openssl.o): In function `servercert':
  vtls/openssl.c:(.text.servercert+0x1b5c): undefined reference to `OCSP_response_status_str'
  vtls/openssl.c:(.text.servercert+0x1bf8): undefined reference to `OCSP_basic_verify'
  vtls/openssl.c:(.text.servercert+0x1c64): undefined reference to `OCSP_cert_status_str'
  vtls/openssl.c:(.text.servercert+0x1ec0): undefined reference to `OCSP_crl_reason_str'

it seems like a linker error but i am confused because doesn’t the android.mk in the external/curl/android folder already link curl and the respective openssl?

1 Like