bugmldonkey, a multi-networks file-sharing client - Bugs: bug #37075, mldonkey fails to compile upnp...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #37075: mldonkey fails to compile upnp libraries on Mac OSX due to pthread_mutex_timedlock()

Submitter:  Thruth Wang <thruth>
Submitted:  Sat 11 Aug 2012 02:34:40 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Compilation problem Status:  Duplicate
Assigned to:  None Open/Closed:  Closed
Release:  3.1.2 Release: 
Operating System:  None Binaries Origin:  CVS / Self compiled
CPU type:  x86_64

Sun 01 Sep 2013 03:52:01 PM UTC, comment #4: 

The other patch was commited to CVS some time ago. Thanks for your input!

ygrek <ygrek>
Group Member
Sun 19 May 2013 07:44:29 AM UTC, comment #3: 
ygrek <ygrek>
Group Member
Mon 15 Apr 2013 07:50:50 PM UTC, comment #2: 

Patch attached. good with mldonkey 3.1.3 & OSX 10.7.x/10.8.x . Should not affect other platforms.

Thruth Wang <thruth>
Sat 20 Oct 2012 12:14:16 PM UTC, comment #1: 

My suggestion of removing the use of "pthread_mutex_timedlock()" is problematic, causing mlnet to consume 100% CPU after enabling upnp port forwarding.

So by briefly implementing pthread_mutex_timedlock(), in my project I got it to work on Mac 10.8.2. Compiled good, got uPNP forwarding success and fairly normal CPU usage. After some more testing & cleanup I'll provide the patch.

Thruth Wang <thruth>
Sat 11 Aug 2012 02:34:40 PM UTC, original submission:  

With '--enable-force-upnp-natpmp' present when ./configure, mldonkey will report no error in the configure phase but will fail in building mlnet binary:

{{{
Compile time error:
Undefined symbols for architecture x86_64:
  "_pthread_mutex_timedlock", referenced from:
      _upnpNatpmpThread in upnp_stubs.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking
make: * [mlnet] Error 2
}}}

This is because of the use of pthread_mutex_timedlock() in src/utils/net/upnp_stubs.c line 874, plus that Mac OSX has not implemented pthread_mutex_timedlock() from 10.4 (or even earlier) to the latest 10.8. Here is a somewhat complete explanation of the situation: http://lists.apple.com/archives/Unix-porting/2008/Jan/msg00014.html

What mldonkey might want to do is that:

Detecting support for pthread_mutex_timedlock() in configure scripts, when the support is not available, removing the only call for pthread_mutex_timedlock() in "src/utils/net/upnp_stubs.c".

Specifically from LINE 871:
  if ( g_running ){
deltatime.tv_sec = time(NULL) + 30;
deltatime.tv_nsec = 0;
dbg_printf("%d seconds timedlock, running...\n", deltatime.tv_sec);

I am not even a developer so I have no idea how to achieve above logic... But in such a way, Mac OSX users get a build success for mldonkey with upnp libs. The only compromise is the absence of a number in debug log.

If there is anything I can do please let me know. Thanks.

btw. Seems that Android has no  pthread_mutex_timedlock() implementation either.

Thruth Wang <thruth>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #27884:  macosx_pthread_mutex_timedlock_fix_mlnet313.patch added by thruth (1KiB - application/octet-stream - Here comes the patch. Compiled and tested good with OSX 10.7.x and 10.8.2 - 10.8.3. And survived thousands of beta users using SpeedTao as GUI of mlnet.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ygrek (Posted a comment)
  • -email is unavailable- added by thruth (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-09-01 ygrek StatusNone Duplicate
        Open/ClosedOpen Closed
    2013-04-15 thruth Attached File- Added macosx_pthread_mutex_timedlock_fix_mlnet313.patch, #27884

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code