dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00521
Re: OS X Lion: strnlen
Hi Daniele,
On 08/06/11 13:51, Daniele Sluijters wrote:
> Hi Jelmer,
>
> Did some Google'ing:
>
> gcc -dM -E -x c - <<<'' should provide you with some useful things I
> think.
>
> I ran into this one too:
> #define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 1070
>
Thanks; I don't have a Mac though, so I can't run that command nor test
any patches. It's probably easier if somebody who does submitted a patch.
Cheers,
Jelmer
> On 8 June 2011 14:45, Jelmer Vernooij <jelmer@xxxxxxxxx
> <mailto:jelmer@xxxxxxxxx>> wrote:
>
> Hi Daniele,
>
> On Wed, 2011-06-08 at 14:39 +0200, Daniele Sluijters wrote:
> > Yup it's the irritating Mac-guy again.
> >
> >
> > Ran into a new problem with Lion Developer Preview 4 when trying to
> > build dulwich with Python 2.7,1 and Xcode 4.1 Developer Preview 6.
> >
> >
> > It seems that Apple's string.h now has a strnlen definition but
> > dulwich isn't aware of that yet.
>
> > The following code causes the build to break:
> > #if defined(__MINGW32_VERSION) || defined(__APPLE__)
> > size_t strnlen(char *text, size_t maxlen)
> > {
> > const char *last = memchr(text, '\0', maxlen);
> > return last ? (size_t) (last - text) : maxlen;
> > }
> > #endif
> Thanks for letting us know.
>
> CC'ing the bug tracker:
>
> affects dulwich
> status triaged
> importance medium
> tags +macosx
>
> > Resulting in:
> > dulwich/_objects.c:30: error: conflicting types for ‘strnlen’
> > /usr/include/string.h:143: error: previous declaration of ‘strnlen’
> > was here
> > dulwich/_objects.c:30: error: conflicting types for ‘strnlen’
> > /usr/include/string.h:143: error: previous declaration of ‘strnlen’
> > was here
> > + d/_objects.c
> >
> > lipo: can't open input
> > file: /var/folders/vx/4kr3q0s955n5kqxcc5c5j0xh0000gn/T//ccdwFWxq.out
> > (No such file or directory)
> > error: command '/usr/bin/cc' failed with exit status 1
> >
> >
> > Remove the || defined(__APPLE__) and it builds fine on Lion but will
> > obviously break on pre-Lion versions of OS X.
> >
> >
> > I'm no friends with C so I have no idea how to patch that one but I
> > figured you might.
> I'm familiar with C, but not really aware of the names of the defines
> involved on Mac OS X. Any Mac people around who can provide a patch?
>
References