The Wayback Machine - https://web.archive.org/web/20201201005543/https://github.com/microsoft/cpprestsdk/pull/1423
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation errors with Android NDK #1423

Open
wants to merge 1 commit into
base: master
from

Conversation

@xfan1024
Copy link

@xfan1024 xfan1024 commented May 20, 2020

I compiled cpprestsdk with android-ndk-r16b and got some error information. I tried to fix them and it's works for me.

  1. std::to_string not support by Android NDK with gnustl. Using utility::conversions::details::to_string instead of std::to_string when __ANDROID__ was defined.
  2. if BOOST_ASIO_HAS_STD_CHRONO defined, boost::chrono::microseconds cannot cast to boost::asio::steady_timer::duration.

Scanning dependencies of target cpprest
[ 3%] Building CXX object Release/src/CMakeFiles/cpprest.dir/http/client/http_client_asio.cpp.o
/home/xiaofan/workspace/casablanca/Release/src/http/client/http_client_asio.cpp:1873:21: error: no matching member function for call to 'expires_from_now'
m_timer.expires_from_now(m_duration);
~~~~~~~~^~~~~~~~~~~~~~~~
/home/xiaofan/workspace/casablanca/Build_android/build/Boost-for-Android/build/out/x86/include/boost-1_70/boost/asio/basic_waitable_timer.hpp:605:15: note: candidate function not viable: no known conversion from
'boost::chrono::microseconds' (aka 'duration<long long, ratio<1LL, 1000000LL> >') to 'const boost::asio::basic_waitable_timer<std::chrono::_V2::steady_clock,
boost::asio::wait_traitsstd::chrono::_V2::steady_clock, boost::asio::executor>::duration' (aka 'const duration<long long, ratio<1, 1000000000> >') for 1st argument
std::size_t expires_from_now(const duration& expiry_time)
^
/home/xiaofan/workspace/casablanca/Build_android/build/Boost-for-Android/build/out/x86/include/boost-1_70/boost/asio/basic_waitable_timer.hpp:577:12: note: candidate function not viable: requires 0 arguments, but
1 was provided
duration expires_from_now() const
^
/home/xiaofan/workspace/casablanca/Build_android/build/Boost-for-Android/build/out/x86/include/boost-1_70/boost/asio/basic_waitable_timer.hpp:637:15: note: candidate function not viable: requires 2 arguments, but
1 was provided
std::size_t expires_from_now(const duration& expiry_time,
^
/home/xiaofan/workspace/casablanca/Release/src/http/client/http_client_asio.cpp:1884:25: error: no matching member function for call to 'expires_from_now'
if (m_timer.expires_from_now(m_duration) > 0)
~~~~~~~~^~~~~~~~~~~~~~~~
/home/xiaofan/workspace/casablanca/Build_android/build/Boost-for-Android/build/out/x86/include/boost-1_70/boost/asio/basic_waitable_timer.hpp:605:15: note: candidate function not viable: no known conversion from
'boost::chrono::microseconds' (aka 'duration<long long, ratio<1LL, 1000000LL> >') to 'const boost::asio::basic_waitable_timer<std::chrono::_V2::steady_clock,
boost::asio::wait_traitsstd::chrono::_V2::steady_clock, boost::asio::executor>::duration' (aka 'const duration<long long, ratio<1, 1000000000> >') for 1st argument
std::size_t expires_from_now(const duration& expiry_time)
^
/home/xiaofan/workspace/casablanca/Build_android/build/Boost-for-Android/build/out/x86/include/boost-1_70/boost/asio/basic_waitable_timer.hpp:577:12: note: candidate function not viable: requires 0 arguments, but
1 was provided
duration expires_from_now() const
^
/home/xiaofan/workspace/casablanca/Build_android/build/Boost-for-Android/build/out/x86/include/boost-1_70/boost/asio/basic_waitable_timer.hpp:637:15: note: candidate function not viable: requires 2 arguments, but
1 was provided
std::size_t expires_from_now(const duration& expiry_time,
^
2 errors generated.
Release/src/CMakeFiles/cpprest.dir/build.make:335: recipe for target 'Release/src/CMakeFiles/cpprest.dir/http/client/http_client_asio.cpp.o' failed
make[2]: *** [Release/src/CMakeFiles/cpprest.dir/http/client/http_client_asio.cpp.o] Error 1
CMakeFiles/Makefile2:108: recipe for target 'Release/src/CMakeFiles/cpprest.dir/all' failed
make[1]: *** [Release/src/CMakeFiles/cpprest.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

@msftclas
Copy link

@msftclas msftclas commented May 20, 2020

CLA assistant check
All CLA requirements met.

@xfan1024 xfan1024 force-pushed the xfan1024:master branch from 5f5c4fa to e195e4b May 20, 2020
Signed-off-by: xiaofan <[email protected]>
@xfan1024 xfan1024 force-pushed the xfan1024:master branch from 5d2e00b to 4b28755 May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.