lxdyy / rfc5766-turn-server

Automatically exported from code.google.com/p/rfc5766-turn-server
0 stars 0 forks source link

Linux and GNU C Library compatibility #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
> What steps will reproduce the problem?

1. compile via "make" or "build.sh"

> What is the expected output? What do you see instead?

src/apps/relay/turnmutex.c: In function ‘turn_mutex_init_recursive’:
src/apps/relay/turnmutex.c:104: warning: implicit declaration of function 
‘pthread_mutexattr_settype’
src/apps/relay/turnmutex.c:104: warning: nested extern declaration of 
‘pthread_mutexattr_settype’
src/apps/relay/turnmutex.c:104: error: ‘PTHREAD_MUTEX_RECURSIVE’ undeclared 
(first use in this function)
src/apps/relay/turnmutex.c:104: error: (Each undeclared identifier is reported 
only once
src/apps/relay/turnmutex.c:104: error: for each function it appears in.)
make: *** [bin/turnserver] Error 1

> What version of the product are you using? On what operating system?

I'm compiling from release 1.3.0.1, on and up-to-date Debian squeeze (libevent2 
from squeeze-backports).

> Please provide any additional information below.

I am not familiar with the topic, but I think that the problem resides in the 
usage of pthread.h from the GNU C Library. Both the warning on 
"pthread_mutexattr_settype" and the missing PTHREAD_MUTEX_RECURSIVE (pthread.h 
from GNU defines only PTHREAD_MUTEX_RECURSIVE_NP by default) suggests that it 
is an extension which is not enabled given the defined macros.

An option may be to modify your build system in build.sh by adding a 
conditional like the one you used for Solaris. I tried adding "-D_GNU_SOURCE" 
to "OSCFLAGS", and it resolves the issue (patch attached). It may not be, 
however, the most fit solution as it enables lots of other definitions.

Original issue reported on code.google.com by gianluca...@gmail.com on 27 Dec 2012 at 2:08

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you for the finding for the patch suggestion ! I'll install a fresh 
debian squeeze and I'll fix it soon. I actually tested it on a debian a while 
ago and it worked just fine, but this is a very interesting finding and I'll 
figure it out.

Original comment by mom040...@gmail.com on 29 Dec 2012 at 3:09

GoogleCodeExporter commented 8 years ago

Original comment by mom040...@gmail.com on 29 Dec 2012 at 3:10

GoogleCodeExporter commented 8 years ago
I fixed the Debian compilation problem. I used the idea that Gianluca provided, 
but I made it more selective: first, not all Linuxes need _GNU_SOURCE, only 
ones with the older-style pthread definitions (Ubuntu and RedHat/CentOS are OK 
without this fix). Second, the fix will work for non-Linux Unixes which use 
older pthread GNU library, too.

Original comment by mom040...@gmail.com on 29 Dec 2012 at 9:49