Git Product home page Git Product logo

Comments (7)

COM8 avatar COM8 commented on August 27, 2024

Could you please try disabling zlib for curl via -DCURL_ZLIB=OFF?

Could you provide a bit if information on how to install NDK on Linux? Then I can have a look at it.
But be aware, I do not have any android dev experience.

from cpr.

Nathan-M-code avatar Nathan-M-code commented on August 27, 2024

With -DCURL_ZLIB=OFF it builded.
I have to say that I had to manually do that : eb2d418
Or I got this error:

[100%] Linking CXX shared library ../lib/libcpr.so
ld.lld: error: unable to find library -lstdc++fs
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [cpr/CMakeFiles/cpr.dir/build.make:530: lib/libcpr.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:229: cpr/CMakeFiles/cpr.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

To use ndk, it is quite easy, manually download it at : https://developer.android.com/ndk/downloads
And add -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK="$ndkPath" -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a as parametre for your cmake cmd.
It will compile for android with the specified ndk

I didn't test the compiled libcpr yet, I'll let you know if everything is ok

from cpr.

COM8 avatar COM8 commented on August 27, 2024

Ah, linking to stdc++fs was broken and is already fixed with the latest version on master. Could you please try master instead of the 1.10.5 release?

from cpr.

COM8 avatar COM8 commented on August 27, 2024

Ref: #987

from cpr.

Nathan-M-code avatar Nathan-M-code commented on August 27, 2024

It worked without any error with ndk r25c (didn't try with r26b) ! Also I needed to set OFF SSL or I got

-- Detecting SSL backend...
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) 
-- Could NOT find MbedTLS (missing: MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY) 
CMake Error at CMakeLists.txt:139 (message):
  No valid SSL backend found! Please install OpenSSL, Mbed TLS or disable SSL
  by setting CPR_ENABLE_SSL to OFF.

Same as #333
Why OpenSSL is not found the same way as if we build cpr without ndk ?

from cpr.

Nathan-M-code avatar Nathan-M-code commented on August 27, 2024

With this command on master:
cmake -S .. -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK="$ndkPath" -DCMAKE_INSTALL_PREFIX="$ndkPath/sources/third_party/cpr" -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DCPR_USE_SYSTEM_CURL=ON -DCURL_INCLUDE_DIR="/usr/include/x86_64-linux-gnu/curl" -DOPENSSL_INCLUDE_DIR="/usr/lib/ssl" ..

-- CXX standard: 17
-- C++ Requests CMake Options
-- =======================================================
--   CPR_GENERATE_COVERAGE: OFF
--   CPR_CURL_NOSIGNAL: OFF
--   CURL_VERBOSE_LOGGING: OFF
--   CPR_USE_SYSTEM_GTEST: OFF
--   CPR_USE_SYSTEM_CURL: ON
--   CPR_ENABLE_CURL_HTTP_ONLY: ON
--   CPR_ENABLE_SSL: ON
--   CPR_FORCE_OPENSSL_BACKEND: OFF
--   CPR_FORCE_WINSSL_BACKEND: OFF
--   CPR_FORCE_DARWINSSL_BACKEND: OFF
--   CPR_FORCE_MBEDTLS_BACKEND: OFF
--   CPR_ENABLE_LINTING: OFF
--   CPR_ENABLE_CPPCHECK: OFF
--   CPR_BUILD_TESTS: OFF
--   CPR_BUILD_TESTS_SSL: OFF
--   CPR_BUILD_TESTS_PROXY: OFF
--   CPR_SKIP_CA_BUNDLE_SEARCH: OFF
--   CPR_USE_BOOST_FILESYSTEM: OFF
--   CPR_DEBUG_SANITIZER_FLAG_THREAD: OFF
--   CPR_DEBUG_SANITIZER_FLAG_ADDR: OFF
--   CPR_DEBUG_SANITIZER_FLAG_LEAK: OFF
--   CPR_DEBUG_SANITIZER_FLAG_UB: OFF
--   CPR_DEBUG_SANITIZER_FLAG_ALL: OFF
-- =======================================================
-- Automatically detecting SSL backend.
-- Detecting SSL backend...
-- SSL auto detect: Using OpenSSL.
-- Curl  found on this system.
-- Configuring done (0.4s)
CMake Error at cpr/CMakeLists.txt:39 (target_link_libraries):
  Target "cpr" links to:

    OpenSSL::SSL

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.



-- Generating done (0.0s)
CMake Generate step failed.  Build files cannot be regenerated correctly.
[  3%] Building CXX object cpr/CMakeFiles/cpr.dir/accept_encoding.cpp.o
In file included from /home/me/Desktop/dev/FactoryCapi/FactoryCapi_game/external_deps/cpr/cpr/accept_encoding.cpp:1:
/home/me/Desktop/dev/FactoryCapi/FactoryCapi_game/external_deps/cpr/include/cpr/accept_encoding.h:4:10: fatal error: 'curl/curlver.h' file not found
#include <curl/curlver.h>
         ^~~~~~~~~~~~~~~~
1 error generated.
gmake[2]: *** [cpr/CMakeFiles/cpr.dir/build.make:76: cpr/CMakeFiles/cpr.dir/accept_encoding.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:116: cpr/CMakeFiles/cpr.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
-- Install configuration: "Release"
CMake Error at cpr/cmake_install.cmake:52 (file):
  file INSTALL cannot find
  "/home/me/Desktop/dev/FactoryCapi/FactoryCapi_game/external_deps/cpr/build_android/lib/libcpr.so":
  No such file or directory.
Call Stack (most recent call first):
  cmake_install.cmake:47 (include)

With -DCPR_USE_SYSTEM_CURL=OFF
I have got another error:

-- Looking for SSL_set0_wbio
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENSSL_SSL_LIBRARY
    linked by target "cmTC_faf7e" in directory /home/me/Desktop/dev/FactoryCapi/FactoryCapi_game/external_deps/cpr/build_android/CMakeFiles/CMakeScratch/TryCompile-9tboxN

CMake Error at /usr/share/cmake-3.27/Modules/CheckSymbolExists.cmake:140 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  /usr/share/cmake-3.27/Modules/CheckSymbolExists.cmake:66 (__CHECK_SYMBOL_EXISTS_IMPL)
  build_android/_deps/curl-src/CMakeLists.txt:646 (check_symbol_exists)
  build_android/_deps/curl-src/CMakeLists.txt:652 (openssl_check_symbol_exists)

from cpr.

COM8 avatar COM8 commented on August 27, 2024

TLDR: OpenSSL Detection is not working correctly. You have to set it manually like we are doing it for macOS inside the CI:

OPENSSL_ROOT_DIR: "/usr/local/opt/openssl@3"
OPENSSL_LIBRARIES: "/usr/local/opt/openssl@3/lib"

from cpr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.