Continuing the discussion from Cocos2dx 3.17 Android Studio curl linker error:
I’m porting over game code to cocos2dx 4.0 from another engine…
…and I’m having the exact same problem here. I’m completely new to android studio… and cmake… and gradle… so figuring out how to diagnose these kind of issues is really tough.
To summarize the other post, as soon as I include curl in my project, I cannot link:
>
> cmd.exe /C "cd . && C:\Android\Sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=i686-none-linux-android16 --gcc-toolchain=C:/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -frtti -fexceptions -fsigned-char -std=c++17 -stdlib=libc++ -Wno-switch -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libMyGame.so -o ..\..\..\..\build\intermediates\cmake\debug\obj\x86\libMyGame.so @CMakeFiles\MyGame.rsp && cd ."
> ../../../../../../cocos2d/external/curl/prebuilt/android/x86/libcurl.a(libcurl_la-openssl.o):vtls/openssl.c:function ossl_connect_common: error: undefined reference to 'PKCS12_parse'
> ../../../../../../cocos2d/external/curl/prebuilt/android/x86/libcurl.a(libcurl_la-openssl.o):vtls/openssl.c:function ossl_connect_common: error: undefined reference to 'BIO_f_ssl'
> ../../../../../../cocos2d/external/curl/prebuilt/android/x86/libcurl.a(libcurl_la-openssl.o):vtls/openssl.c:function Curl_ossl_version: error: undefined reference to 'OpenSSL_version_num'
> ../../../../../../cocos2d/external/curl/prebuilt/android/x86/libcurl.a(libcurl_la-openssl.o):vtls/openssl.c:function Curl_ossl_seed: error: undefined reference to 'RAND_load_file'
> ../../../../../../cocos2d/external/curl/prebuilt/android/x86/libcurl.a(libcurl_la-openssl.o):vtls/openssl.c:function Curl_ossl_seed: error: undefined reference to 'RAND_file_name'
> ../../../../../../cocos2d/external/curl/prebuilt/android/x86/libcurl.a(libcurl_la-openssl.o):vtls/openssl.c:function Curl_ossl_seed: error: undefined reference to 'RAND_load_file'
> ../../../../../../cocos2d/external/curl/prebuilt/android/x86/libcurl.a(libcurl_la-openssl.o):vtls/openssl.c:function ossl_send: error: undefined reference to 'OpenSSL_version_num'
> ../../../../../../cocos2d/external/curl/prebuilt/android/x86/libcurl.a(libcurl_la-openssl.o):vtls/openssl.c:function servercert: error: undefined reference to 'OCSP_response_status_str'
> ../../../../../../cocos2d/external/curl/prebuilt/android/x86/libcurl.a(libcurl_la-openssl.o):vtls/openssl.c:function servercert: error: undefined reference to 'OCSP_basic_verify'
> ../../../../../../cocos2d/external/curl/prebuilt/android/x86/libcurl.a(libcurl_la-openssl.o):vtls/openssl.c:function servercert: error: undefined reference to 'OCSP_cert_status_str'
> ../../../../../../cocos2d/external/curl/prebuilt/android/x86/libcurl.a(libcurl_la-openssl.o):vtls/openssl.c:function servercert: error: undefined reference to 'OCSP_crl_reason_str'
> clang++: error: linker command failed with exit code 1 (use -v to see invocation)
> ninja: build stopped: subcommand failed.
Any ideas or help or advice would be greatly appreciated!
Thank you,
Mark