Menu

#660 7.16.2 fails to compile against Mac OS 10.2 SDK

closed-fixed
5
2007-06-14
2007-06-14
No

I'm distributing curl for Mac OS X 10.2 and higher, so I'm compiling against the MacOSX10.2.8 SDK on Mac OS X 10.4.9. Compiling bails with the error at the end of this report, with POLLIN, POLLOUT and friends defined both in lib/select.h and <sys/poll.h>.

It looks like the error occurs because HAVE_SYS_POLL_H is set but HAVE_POLL is not, as poll is disabled on OS X. A fix would be only #include'ing <sys/poll.h> if HAVE_POLL is not defined. Or alternatively, just wrap a section of lib/select.h in #ifndef, eg:

#ifndef POLLIN
#define POLLIN 0x01
...
#define POLLRDBAND POLLPRI
#endif

Configure command line:

/Users/vasi/Desktop/xmoto/src/curl-7.16.2/configure --prefix=/Users/vasi/Desktop/xmoto/prefix/10.2

Relevant environment variables:

CC=gcc-3.3
CFLAGS="-Os -isysroot=/Developer/SDKs/MacOSX10.2.8.sdk -arch=ppc -DCURL_DISABLE_NTLM"
LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk"
MACOSX_DEPLOYMENT_TARGET=10.2

Error log:

/bin/sh ../libtool --tag=CC --mode=compile gcc-3.3 -DHAVE_CONFIG_H -I/Users/vasi/Desktop/xmoto/src/curl-7.16.2/include -I../lib -I/Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib -Os -isysroot=/Developer/SDKs/MacOSX10.2.8.sdk -arch=ppc -DCURL_DISABLE_NTLM -MT http.lo -MD -MP -MF .deps/http.Tpo -c -o http.lo /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c
gcc-3.3 -DHAVE_CONFIG_H -I/Users/vasi/Desktop/xmoto/src/curl-7.16.2/include -I../lib -I/Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib -Os -isysroot=/Developer/SDKs/MacOSX10.2.8.sdk -arch=ppc -DCURL_DISABLE_NTLM -MT http.lo -MD -MP -MF .deps/http.Tpo -c /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c -fno-common -DPIC -o .libs/http.o
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:51:1: warning: "POLLIN" redefined
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:29,
from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/usr/include/sys/poll.h:62:1: warning: this is the location of the previous definition
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:52:1: warning: "POLLPRI" redefined
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:29,
from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/usr/include/sys/poll.h:63:1: warning: this is the location of the previous definition
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:53:1: warning: "POLLOUT" redefined
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:29,
from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/usr/include/sys/poll.h:64:1: warning: this is the location of the previous definition
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:54:1: warning: "POLLERR" redefined
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:29,
from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/usr/include/sys/poll.h:83:1: warning: this is the location of the previous definition
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:55:1: warning: "POLLHUP" redefined
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:29,
from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/usr/include/sys/poll.h:84:1: warning: this is the location of the previous definition
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:56:1: warning: "POLLNVAL" redefined
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:29,
from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/usr/include/sys/poll.h:85:1: warning: this is the location of the previous definition
In file included from /Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/http.c:96:
/Users/vasi/Desktop/xmoto/src/curl-7.16.2/lib/select.h:59: error: redefinition of `struct pollfd'
make[2]: *** [http.lo] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2007-06-14

    Logged In: YES
    user_id=1110
    Originator: NO

    Thanks for your report. Does the following patch fix the problem for you?

    http://cool.haxx.se/cvs.cgi/curl/lib/select.h.diff?r2=1.13&r1=1.12&diff_format=u

    (Please consider helping us out by providing autobuilds for OS X, as that will make us notice build breakage or build failures before releases while developing...)

     
  • Daniel Stenberg

    Daniel Stenberg - 2007-06-14
    • status: open --> open-fixed
     
  • Dave Vasilevsky

    Dave Vasilevsky - 2007-06-14

    Logged In: YES
    user_id=363364
    Originator: YES

    That seems to fix things. Thanks for the quick response! I'd love to be able to help with autobuilds, but I don't have a spare machine, sorry.

     
  • Daniel Stenberg

    Daniel Stenberg - 2007-06-14

    Logged In: YES
    user_id=1110
    Originator: NO

    Great, case closed!

     
  • Daniel Stenberg

    Daniel Stenberg - 2007-06-14
    • status: open-fixed --> closed-fixed