aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Pages: 1 [2] 3

Author Topic: aMule compiled with UPnP support  (Read 31958 times)

brainnolo

  • Approved Newbie
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 23
Re: aMule compiled with UPnP support
« Reply #15 on: November 17, 2007, 08:26:43 PM »

Yeah I know that isn't good coding at all, but was the fastest non-crashing patch I could output :D (btw: returning a pointer you can either free or not is actually not too bad as long as is documented, is not a leak because the pointer is returned to the caller which can then free it)

I understand now your reluctance at using wxStandardPaths, in that case, I will try to do it differently. Unfortunately DYLD_LIBRARY_PATH does not include the local framework directory, but is possible to add it at runtime instead of determining each library path..although it wouldn't plug-in as easily in the current code.

Linking directly to the UPnP library is probably the best thing to do, this would even allow to simply statically link in upnp and avoid strange binaries hanging around.

This said, I'm working on a better patch right now.
« Last Edit: November 17, 2007, 08:59:04 PM by brainnolo »
Logged

brainnolo

  • Approved Newbie
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 23
Re: aMule compiled with UPnP support
« Reply #16 on: November 17, 2007, 09:47:31 PM »

Ok, here is the third patch, it still has the "leak", but is now documented with a comment. You can change this however you feel it suits, I didn't change it because we might have different view of what a better solution would be :D

Now it doesn't depend anymore on wxMac at all, i used #ifdef __DARWIN__ and a few CoreFoundation functions

PS: No, there is no way to know how long an URL is before actually converting it. The documentation suggests using MAXPATHLEN sized buffer (1024 on OS X). Again, I didn't move it to a smaller buffer (which is probably much better) because I feel you are changing that part as well :D
« Last Edit: November 17, 2007, 09:53:29 PM by brainnolo »
Logged

phoenix

  • Evil respawning bird from aMule Dev Team
  • Developer
  • Hero Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 2503
  • The last shadow you'll ever see
Re: aMule compiled with UPnP support
« Reply #17 on: November 17, 2007, 11:09:22 PM »

Hi brainnolo,

Thank you for your patience. I have applied your patch with some changes, as you have already guessed :)

But unfortunately I am not able to test the changes I made, so I will ask you a favor, please compile tomorrow cvs and report your results.

What I did was to convert the parameter of the function which I turned into a "const char *" to a CFStringRef, with the line

Code: [Select]
CFStringRef libName = CFSTR(name);
If this line is wrong or not compiling, please post the fix.

I have also choosen not to cache the results, once we will only be using them once. Besides, it's less three redundant functions. The leak is avoided by returning an object. The object is destroyed as soon as it gets out of scope, and no memory is lost. I have to say that I like C a lot, but I have to admit that C string handling sucks.

Thanks again for your cooperation!

Cheers!
Logged

brainnolo

  • Approved Newbie
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 23
Re: aMule compiled with UPnP support
« Reply #18 on: November 17, 2007, 11:25:26 PM »

It shouldn't work, CFSTR only accepts literals! CFStringCreateWithCString(NULL, libName, kCFStringEncodingUTF8) will work, but then you have to CFRelease the object created. CFSTR is meant to create the object equivalent of a string literal.
Logged

phoenix

  • Evil respawning bird from aMule Dev Team
  • Developer
  • Hero Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 2503
  • The last shadow you'll ever see
Re: aMule compiled with UPnP support
« Reply #19 on: November 18, 2007, 06:24:08 AM »

Would you mind doing the fix, testing and posting the patch here? Like I said before, I have no Mac here.

Cheers!
Logged

brainnolo

  • Approved Newbie
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 23
Re: aMule compiled with UPnP support
« Reply #20 on: November 18, 2007, 10:24:09 AM »

Now I see why you didn't like the malloc :D My bad, I don't speak C++ (although I don't usually code plain C either, Objective-C is my bread and butter :D)

Attached is the patch to your patch, as I thought, the CFSTR didn't work and needed to be replaced ;)

Maybe you should offer the Frameworks directory with UPnP binaries for download and/or bundle it in your next binary distribution.
Logged

phoenix

  • Evil respawning bird from aMule Dev Team
  • Developer
  • Hero Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 2503
  • The last shadow you'll ever see
Re: aMule compiled with UPnP support
« Reply #21 on: November 18, 2007, 12:44:41 PM »

Ok, your latest patch is committed.

As for the Frameworks directory, are you referring to source or binary? I don't make the Mac binaries, lionel77 or wuischke do them, so I guess this is a suggestion for them :)

Thanks again, and please don't stop contributing!

Cheers!
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: aMule compiled with UPnP support
« Reply #22 on: November 18, 2007, 01:07:32 PM »

Quote
I don't make the Mac binaries, lionel77 or wuischke do them, so I guess this is a suggestion for them
I haven't set up a cross-compiler on my new system yet and there are plenty of people with a Mac and the knowledge to compile around, so I'm not really motivated to do it. ;)

Anyway, it's not a matter of compilation anyway, but of the Mac packager script.

brainnolo, do you know some basic shell scripting? If yes, please have a look at the src/utils/scripts/mac_packager in the tarball and do the necessary changes to include the libraries. I believe there are no problems except warning messages when the files are not found, so integrating it to the script should be fine.
Logged

brainnolo

  • Approved Newbie
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 23
Re: aMule compiled with UPnP support
« Reply #23 on: November 18, 2007, 04:11:50 PM »

I already compiled Universal binary UPnP libraries which work on 10.4 and 10.5 so I have the binaries already. Yes I know shell scripting, I will post a patch here to said script asap.

EDIT: Actually if you bundle said binaries in the current aMule.app skeleton there is nothing else to modify, and if you don't there is no way to get them automagically (except if I implement autodownload, autocompile, auto-edit of said libraries, but it looks like a long and useless process to me).

EDIT2: Or you host said files somewhere and I can just auto-retrieve them in the packaging script, which would then require internet access)

EDIT3: For you convenience, I attached a zip which only contains the libupnp-binaries
« Last Edit: November 18, 2007, 04:26:21 PM by brainnolo »
Logged

phoenix

  • Evil respawning bird from aMule Dev Team
  • Developer
  • Hero Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 2503
  • The last shadow you'll ever see
Re: aMule compiled with UPnP support
« Reply #24 on: November 18, 2007, 05:16:53 PM »

Ok, committed the 3 UPnP library files.

Cheers!
Logged

brainnolo

  • Approved Newbie
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 23
Re: aMule compiled with UPnP support
« Reply #25 on: November 19, 2007, 10:43:00 AM »

I patched /src/utils/scripts/mac_packager to avoid removing libupnp libs during initial cleanup (this would defeat bundling them) . It will now remove only libwx in the Frameworks directory (which are supposed to be from an old build).
Logged

phoenix

  • Evil respawning bird from aMule Dev Team
  • Developer
  • Hero Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 2503
  • The last shadow you'll ever see
Re: aMule compiled with UPnP support
« Reply #26 on: November 19, 2007, 09:12:35 PM »

Ok, committed!

Thanks!
Logged

apo758

  • Guest
Re: aMule compiled with UPnP support
« Reply #27 on: November 20, 2007, 12:04:40 PM »

Sorry but now, if I want to compile the CVS on Mac and have the UPnP support, what do I have to do?
I'm compiling wxMac and then I'll compile aMule CVS from the last tarball (20/11). Then?
Thanks! ;)
Logged

phoenix

  • Evil respawning bird from aMule Dev Team
  • Developer
  • Hero Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 2503
  • The last shadow you'll ever see
Re: aMule compiled with UPnP support
« Reply #28 on: November 20, 2007, 01:40:37 PM »

Hi apo758,

This one I hope brainnolo will answer, I know nothing about Mac compilation environment. :(

Maybe we should have a doc explaining it in the tarball, or maybe some place in the wiki (if there isn't one already).
Logged

jchiar

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 13
Re: aMule compiled with UPnP support
« Reply #29 on: January 02, 2008, 06:30:35 PM »

Hi I just downloaded the current CVS and still having the library issue, any ideas?

008-01-02 12:20:44: Credit file loaded, 2156 clients are known

2008-01-02 12:20:45:  - This is aMule CVS using wxMac v2.7.0 (Snapshot: rev. 6921) based on eMule.
2008-01-02 12:20:45:    Running on MacOS (Darwin 8.7.0 Power Macintosh)
2008-01-02 12:20:45:  - Visit http://www.amule.org to check if a new version is available.

2008-01-02 12:20:45: Loading server.met file: /Users/joe/Library/Application Support/aMule/server.met
2008-01-02 12:20:45: 144 servers in server.met found
2008-01-02 12:20:45: Found 2 part files
2008-01-02 12:20:45: External connections disabled in config file
2008-01-02 12:20:45: MuleUDPSocket: Created Server UDP-Socket at port 4665
2008-01-02 12:20:45: MuleUDPSocket: Created Client UDP-Socket at port 4672
2008-01-02 12:20:45: error(CDynamicLibHandle): Unable to dlopen libixml.so. Check PATH and LD_LIBRARY_PATH.
2008-01-02 12:20:45: The URL to download can't be empty
2008-01-02 12:20:45: CUPnPException: error(CDynamicLibHandle): Unable to dlopen libixml.so. Check PATH and LD_LIBRARY_PATH.
2008-01-02 12:20:45: Universal Plug and Play: CUPnPException: error(CDynamicLibHandle): Unable to dlopen libixml.so. Check PATH and LD_LIBRARY_PATH.
2008-01-02 12:20:45: Found 355 known shared files, 2 unknown
2008-01-02 12:20:45: Connecting
2008-01-02 12:20:45: Servers: Trying to connect
2008-01-02 12:20:45: Connecting to Razorback 3.0 (85.17.52.92 - 85.17.52.92:443)
2008-01-02 12:20:48: Read 200 Kad contacts
2008-01-02 12:20:48: webserver running on pid 948
2008-01-02 12:20:48: Loading IP-filters 'ipfilter.dat' and 'ipfilter_static.dat'.
2008-01-02 12:20:48: Loaded 0 IP-ranges from 'ipfilter.dat'. 0 malformed lines were discarded.
2008-01-02 12:20:48: Loaded 0 IP-ranges from 'ipfilter_static.dat'. 0 malformed lines were discarded.
2008-01-02 12:20:48: ThreadScheduler: Completed task 'Load IPFilter', 2 tasks remaining.
2008-01-02 12:20:48: Hasher: Starting to create MD4 and AICH hash for file: aMule-Mac-1.CVS.2006-08-10.noDebug_UniversalBinary_TigerOnly.zip
2008-01-02 12:20:48: Failed to download the server list from
2008-01-02 12:20:48: Connected to Razorback 3.0 (85.17.52.92:5000)
2008-01-02 12:20:48: Your copy of aMule is up to date.
2008-01-02 12:20:48: ThreadScheduler: Completed task 'Hashing - /Users/joe/downloads/aMule-Mac-1.CVS.2006-08-10.noDebug_UniversalBinary_TigerOnly.zip', 1 tasks remaining.
2008-01-02 12:20:48: Hasher: Starting to create MD4 and AICH hash for file: aMule.zip
2008-01-02 12:20:48: Servers: Connected
2008-01-02 12:20:48: Connection established with: Razorback 3.0
2008-01-02 12:20:48: New client ID is 3359221575
2008-01-02 12:20:49: Received 1 new servers
2008-01-02 12:20:49: ThreadScheduler: Completed task 'Hashing - /Users/joe/downloads/aMule.zip', 0 tasks remaining.
2008-01-02 12:20:49: Saving of server-list completed.
2008-01-02 12:20:50: ThreadScheduler: Completed task 'AICH Syncronizing', 0 tasks remaining.

Logged
Pages: 1 [2] 3