Hi,
I just tried to compile libupnp 1.4.3 on MacOSX 10.4.9/PPC, and needed to perform the following modifications:
- #include <stdlib.h> instead of <malloc.h>
- #define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_NORMAL
- #define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
- #define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK
- #define pthread_mutexattr_setkind_np(attr, kind) pthread_mutexattr_settype(attr, kind)
- in ThreadPool.c: cast (unsigned int)ithread_get_current_thread_id
- use gethostbyname() instead of gethostbyname_r(), because gethostbyname() is thread-safe on OSX
- chmod a+x ./ixml/test/test_document.sh
- declare following global in upnpapi.c instead of upnpapi.h:
virtualDirList *pVirtualDirList;
- in ThreadPool.c, SetPolicyType(): use this:
return setpriority(PRIO_PROCESS, 0, 0);
I have no idea how to set the scheduler policy, though.
Now, at least, it compiles, but make check fails:
Making check in threadutil
...
Intializing UPnP ...
** ERROR UpnpInit(): -208 Unknown Error
FAIL: test_init
I didn't investigate further. I have no upnp device to test, for the moment.
Logged In: YES
user_id=67568
Originator: NO
Hi Stéphane,
Would you mind posting a patch? If you want you can download the subversion trunk like this:
$ svn co https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk pupnp
And then after copying your files to the right place, produce the patch like this:
$ svn diff > macos.patch
Regards,
Marcelo.
Logged In: YES
user_id=301306
Originator: YES
I can't rebuild it from sources - I have no idea how to get a 'configure'.
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Logged In: YES
user_id=67568
Originator: NO
Stéphane,
I have attached a configure file for you, please test and report.
Regards,
Marcelo.
File Added: configure.bz2
Logged In: YES
user_id=301306
Originator: YES
/tmp/pupnp> ./configure --disable-dependency-tracking
configure: error: cannot find install-sh or install.sh in config.aux "."/config.aux
Logged In: YES
user_id=67568
Originator: NO
Hi Stéphane,
Were there any progress here? You see, we need a patch to go on, otherwise I will have to close this tracker item.
Regards,
Marcelo.
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Logged In: YES
user_id=223358
Originator: NO
I have a patch, and can attach
Run configure for OSX as:
./configure CFLAGS="-D__OSX__=10 -O -g -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" CPPFLAGS="-D__OSX__=10 -O -g -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" LDFLAGS="-framework Carbon -framework IOKit" enable_dependency_tracking=no
Logged In: YES
user_id=223358
Originator: NO
diff -ur libupnp-1.4.6/threadutil/src/LinkedList.c libupnp-1.4.6-new/threadutil/src/LinkedList.c
--- libupnp-1.4.6/threadutil/src/LinkedList.c 2006-10-05 01:19:35.000000000 -0500
+++ libupnp-1.4.6-new/threadutil/src/LinkedList.c 2007-06-07 20:57:56.000000000 -0500
@@ -30,7 +30,7 @@
///////////////////////////////////////////////////////////////////////////
#include "LinkedList.h"
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__OSX__)
#include <stdlib.h>
#else
#include <malloc.h>
diff -ur libupnp-1.4.6/threadutil/src/ThreadPool.c libupnp-1.4.6-new/threadutil/src/ThreadPool.c
--- libupnp-1.4.6/threadutil/src/ThreadPool.c 2007-03-12 22:19:24.000000000 -0500
+++ libupnp-1.4.6-new/threadutil/src/ThreadPool.c 2007-06-08 20:54:26.000000000 -0500
@@ -97,6 +97,10 @@
#ifdef WIN32
return sched_setscheduler( 0, in);
#else
+ #ifdef __OSX__
+ setpriority(PRIO_PROCESS, 0, 0);
+ return 0;
+ #endif
struct sched_param current;
sched_getparam( 0, ¤t );
diff -ur libupnp-1.4.6/threadutil/src/iasnprintf.c libupnp-1.4.6-new/threadutil/src/iasnprintf.c
--- libupnp-1.4.6/threadutil/src/iasnprintf.c 2006-10-05 01:19:35.000000000 -0500
+++ libupnp-1.4.6-new/threadutil/src/iasnprintf.c 2007-06-07 20:58:50.000000000 -0500
@@ -31,7 +31,7 @@
#include <stdarg.h>
#include <assert.h>
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__OSX__)
#include <stdlib.h>
#else
#include <malloc.h>
diff -ur libupnp-1.4.6/upnp/src/api/upnpapi.c libupnp-1.4.6-new/upnp/src/api/upnpapi.c
--- libupnp-1.4.6/upnp/src/api/upnpapi.c 2007-03-12 22:19:24.000000000 -0500
+++ libupnp-1.4.6-new/upnp/src/api/upnpapi.c 2007-06-07 23:09:08.000000000 -0500
@@ -79,6 +79,8 @@
/*
****************** */
+virtualDirList *pVirtualDirList;
+
//Mutex to synchronize the subscription handling at the client side
CLIENTONLY( ithread_mutex_t GlobalClientSubscribeMutex;
)
diff -ur libupnp-1.4.6/upnp/src/genlib/net/uri/uri.c libupnp-1.4.6-new/upnp/src/genlib/net/uri/uri.c
--- libupnp-1.4.6/upnp/src/genlib/net/uri/uri.c 2007-04-28 07:02:33.000000000 -0500
+++ libupnp-1.4.6-new/upnp/src/genlib/net/uri/uri.c 2007-06-07 22:52:45.000000000 -0500
@@ -631,6 +631,8 @@
if ( h == NULL ) {
errCode = 1;
}
+#elif defined(__OSX__)
+ errCode = gethostbyname(temp_host_name);
#else
errCode = gethostbyname_r( temp_host_name,
&h_buf,
diff -ur libupnp-1.4.6/upnp/src/inc/upnpapi.h libupnp-1.4.6-new/upnp/src/inc/upnpapi.h
--- libupnp-1.4.6/upnp/src/inc/upnpapi.h 2006-10-05 01:19:26.000000000 -0500
+++ libupnp-1.4.6-new/upnp/src/inc/upnpapi.h 2007-06-07 20:47:43.000000000 -0500
@@ -163,7 +163,6 @@
void AutoAdvertise(void *input);
int getlocalhostname(char *out);
-virtualDirList *pVirtualDirList;
extern WebServerState bWebServerState;
#endif
Logged In: YES
user_id=301306
Originator: YES
Hi,
I tried to recompile 1.4.6, and brought (most of) my modifications again.
Attached is a patch against 1.4.6 sources. Sources have been configured using:
./configure --enable-debug --disable-dependency-tracking CPPFLAGS="-D__OSX=10" CFLAGS="-D__OSX__=10"
Now it compiles fine, but tests still don't pass: I found out that in get_ssdp_sockets(), I got a EADDRNOTAVAIL for the setsockopt(..., IP_ADD_MEMBERSHIP, ...) call, though I added the route to my system (10.0.0.4 is my machine's IP):
sudo route -v add -net 239.0.0.0 10.0.0.4 255.0.0.0
netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
...
239.0.0/8 10.0.0.4 UGS 0 32 en0
I known nothing about routes and sockets - I can't help more.
Jeff: I can't use your configure: I miss install-sh or install.sh in config.aux
File Added: macos.patch
Patch for MacOSX 10.4.9/libupnp 1.4.6
Logged In: NO
Dave-
Your patch works for me, as well. Thanks for posting that. And have tested the resulting libupnp with both VLC and djmount.
Not sure why that configure line I put doesn't work for you. Seems to work perfectly for me. Looks
like in your configure below you may be missing ending __ in CPPFLAGS for -D__OSX__.
-jeffrey
Logged In: YES
user_id=67568
Originator: NO
I have merged this patch into the current subversion code, I would appreciate if someone with Mac Os X would test it.
Regards,
Marcelo.
Logged In: NO
Recent release compiles fine on osx with these changes in it.
However bind() in ssdp_server.c fails with EADDRNOTAVAIL every time UPnpInit tries to initialize. Only mitigation get it to run so far is to bind sockaddr_in struct to LOCAL_HOST rather than having it listing to any available address (INADDR_ANY):
In ssdp_server.c:
934 ssdpAddr.sin_addr.s_addr = inet_addr(LOCAL_HOST);
935 //ssdpAddr.sin_addr.s_addr = htonl( INADDR_ANY );
936 ssdpAddr.sin_port = htons( SSDP_PORT );
937 if( bind
No idea why it fails as sockaddr_in seems to been properly wiped out with the memset operation a few lines before. Unfortunately not an expert on BSDish socket operation and multicast behaviour.
Kai
elwertk@gmx.net