Question

I am trying to compile libupnp 1.6.18 for android system. It seems that the bionic does not implement full posix thread functionality. I am able to configure it but if fails in the build throwing this error

/Volumes/androidSpace/nomad/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: common/tv_ctrlpt-sample_util.o: in function SampleUtil_Initialize:common/sample_util.c:68: error: undefined reference to 'pthread_mutexattr_setkind_np

Does anybody know whats the best way to resolve this issue?

Was it helpful?

Solution

The android libc, bionic, provides built-in support for pthreads, so no additional linking (-lpthreads) is necessary. It does not implement full POSIX threads functionality and leaves out support for read/write locks, pthread_cancel(), process-shared mutexes and condition variables as well as other more advanced features.

"pthread_mutexattr_setkind_np" is deprecated and a non portable function. You should replace this function by

int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);

It should be staright forward since, both of these functions have the same signature.

See below link for more information

http://www.unix.com/man-page/FreeBSD/3/pthread_mutexattr_setkind_np/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top