Closed gjasny closed 6 years ago
Hi,
for completion, could you add the compiler error?
Yes, please, could you provide a PR?
Compile error:
build 11-Apr-2018 07:46:57 clang-linux.compile.c++.without-pth /home/bamboo/bamboo-agent-home/xml-data/build-dir/EL-BOOST7-AC/_output/Applications_Android_armeabi-v7a_cxx14/boost/bin.v2/libs/type_erasure/build/clang-linux-android/debug/link-static/pch-off/target-os-android/threadapi-pthread/threading-multi/dynamic_binding.o
build 11-Apr-2018 07:46:57 In file included from libs/type_erasure/src/dynamic_binding.cpp:14:
build 11-Apr-2018 07:46:57 In file included from ./boost/thread/shared_mutex.hpp:28:
build 11-Apr-2018 07:46:57 In file included from ./boost/thread/pthread/shared_mutex.hpp:14:
build 11-Apr-2018 07:46:57 In file included from ./boost/thread/mutex.hpp:16:
build 11-Apr-2018 07:46:57 In file included from ./boost/thread/pthread/mutex.hpp:26:
build 11-Apr-2018 07:46:57 ./boost/thread/pthread/pthread_helpers.hpp:28:15: error: use of undeclared identifier 'pthread_condattr_setclock'; did you mean 'pthread_condattr_setpshared'?
build 11-Apr-2018 07:46:57 pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
build 11-Apr-2018 07:46:57 ^~~~~~~~~~~~~~~~~~~~~~~~~
build 11-Apr-2018 07:46:57 pthread_condattr_setpshared
build 11-Apr-2018 07:46:57 /home/bamboo/bamboo-agent-home/xml-data/build-dir/EL-BOOST7-AC/_toolchain_arm_android-14/bin/../sysroot/usr/include/pthread.h:122:5: note: 'pthread_condattr_setpshared' declared here
build 11-Apr-2018 07:46:57 int pthread_condattr_setpshared(pthread_condattr_t* __attr, int __shared);
build 11-Apr-2018 07:46:57 ^
build 11-Apr-2018 07:46:57 1 error generated.
In pthread.h
:
#if __ANDROID_API__ >= 21
int pthread_condattr_setclock(pthread_condattr_t* __attr, clockid_t __clock) __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */
in chromium build, there is a build config for android called config.gni try to get it and refresh the value of android api level.
Hello,
the
pthread_condattr_setclock
function is only available for__ANDROID_API__ >= 21
. The unconditional use in pthread_helpers.hpp leads to an compile error.What would be the proper way to handle it? Should the preprocessor condition in
boost::pthread::cond_init
be tightened orBOOST_THREAD_INTERNAL_CLOCK_IS_MONO
not be defined on Android < 21?Would the following patch make sense?
Thanks, Gregor