[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple compile errors on MacOS X (Lion)



On Nov 21, 2012, at 3:37 PM, ZXID.User@xxxxxxxxxxxxx wrote:

> Michael Dondrup <michael.dondrup@xxxxxx> said:
>> On Nov 21, 2012, at 1:04 PM, ZXID.User@xxxxxxxxxxxxx wrote:
>> 
>>> Thanks for this analysis. So in fact it is not the assignment but one
>>> of the printf expansions. Casting to long and using %lx seems like
>>> the right fix.
>> Might be, but maybe not on every platform? Found this:
>> http://stackoverflow.com/q/5701450/326156
>> Maybe something like intptr_t might be more portable?
>> 
>>> 
>>> I just put out 1.12 release at http://zxid.org/zxid-1.12.tgz so you can test.
>>> In order to test the zxbusd compile you should say
>>> 
>> 
>> Just tried the new code, but there still seems to be a problem.
>> 
>> 

...

>> 
>> Before, I had just added
>> #define PTHREAD_MUTEX_ERRORCHECK_NP 1
>> directly before. Inserting this, solves this error, then leads to more errors:
> 
> It works around the compile error, but it is not a solution.
> That constant is supposed to come
> from <pthread.h> which clearly is included as it should.
> 
> Can you hunt for the constant, e.g.
> 
> grep -r PTHREAD_MUTEX_ERRORCHECK_NP /usr/include

That doesn't exist, but almost. The most similar entries are:

/*
 * Mutex type attributes
 */
#define PTHREAD_MUTEX_NORMAL            0
#define PTHREAD_MUTEX_ERRORCHECK        1
#define PTHREAD_MUTEX_RECURSIVE         2
#define PTHREAD_MUTEX_DEFAULT           PTHREAD_MUTEX_NORMAL

maybe it is not supported or smth? Maybe it is safe to use PTHREAD_MUTEX_ERRORCHECK 
instead?


http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/pthread.3.html

unfortunately, the defines are not documented.






> 
>> Confucius:zxid-1.12 mdondrup$  make zxbus  TARGET=macosx 
>> gcc -g -fPIC -fmessage-length=0 -Wno-unused-label -Wno-unknown-pragmas -fno-strict-aliasing -DMAYBE_UNUSED='' -DUSE_CURL -DUSE_OPENSSL -DUSE_PTHREAD -pthread -DMACOSX -D_REENTRANT -DDEBUG -DMUTEX_DEBUG=1 -I. -I/Users/mdondrup/Downloads/zxid-1.12 -I/opt/local/include -I/usr/local/include -I/include -I/Developer/SDKs/MacOSX10.6.sdk/usr/include/apache2 -I/Developer/SDKs/MacOSX10.6.sdk/usr/include/apr-1   -c -o hiios.o hiios.c
>> hiios.c: In function hi_in_out:
>> hiios.c:204: error: EPOLLHUP undeclared (first use in this function)
>> hiios.c:204: error: (Each undeclared identifier is reported only once
>> hiios.c:204: error: for each function it appears in.)
>> hiios.c:204: error: EPOLLERR undeclared (first use in this function)
>> hiios.c:218: error: EPOLLOUT undeclared (first use in this function)
>> hiios.c:260: error: EPOLLIN undeclared (first use in this function)
> 
> Sorry about that. Of course you need someting similar to SUNOS:
> 
> diff -u bak/platform.h platform.h
> --- bak/platform.h      2012-11-21 14:50:30.000000000 +0000
> +++ platform.h  2012-11-21 14:52:53.000000000 +0000
> @@ -5,6 +5,8 @@
> #ifndef _platform_h
> #define _platform_h
> 
> +#include <stdlib.h>
> +
> #ifdef MINGW
> 
> #include <windows.h>
> @@ -145,6 +147,10 @@
> 
> #if defined(MACOSX) || defined(FREEBSD)
> #include <sys/event.h>      /* for kqueue used by zxbusd */
> +#define EPOLLHUP (0)        /* *** Need to find better constant */
> +#define EPOLLERR (0)        /* *** Need to find better constant */
> +#define EPOLLOUT (EVFILT_WRITE)
> +#define EPOLLIN  (EVFILT_READ)
> #endif
> 
> #ifdef LINUX
> 
> Please hunt for the POLLHUP and POLLERR in Mac headers:
> 

It is in poll.h

This site should have all the Macos (BSD) manpages for different versions:

http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/poll.2.html





> grep -r POLLHUP /usr/include
> 
> Cheers,
> --Sampo
> 
>> make: *** [hiios.o] Error 1