Re: git no longer builds on SunOS 5.10, a report
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 14, 2024, 06:20 UTC
- Message-ID
- <Zwy4NUHQ3zpzkaXU@pks.im>
- In-Reply-To
- <CAOO-Oz2gN1Y9h-p_AJ=7iKzxOK2ShmgEmWzpFrpwwAD2GH=6TQ@mail.gmail.com>
On Sun, Oct 13, 2024 at 06:50:09PM -0400, Alejandro R. Sedeño wrote:
Show 14 quoted lines
> On Sun, Oct 13, 2024 at 3:57 PM Patrick Steinhardt <ps@pks.im> wrote: > > diff --git a/t/unit-tests/clar/clar.c b/t/unit-tests/clar/clar.c > > index cef0f023c2..064ca5c2ea 100644 > > --- a/t/unit-tests/clar/clar.c > > +++ b/t/unit-tests/clar/clar.c > > @@ -4,6 +4,10 @@ > > * This file is part of clar, distributed under the ISC license. > > * For full terms see the included COPYING file. > > */ > > + > > +#define _DARWIN_C_SOURCE > > +#define _POSIX_C_SOURCE=200809L > > token "=" is not valid in preprocessor expressions.
Yeah, typoed this one.
Show 21 quoted lines
> 2008 postdates my available compiler by many years, so trying to define this > is not going to get you everything you might expect here. > > Fixing the #define to use a space and not = results in > > /usr/include/sys/feature_tests.h:332:2: #error "Compiler or options > invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX > applications" > > The relevant bits of the header: > > #if defined(_STDC_C99) && (defined(__XOPEN_OR_POSIX) && !defined(_XPG6)) > #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \ > and pre-2001 POSIX applications" > #elif !defined(_STDC_C99) && \ > (defined(__XOPEN_OR_POSIX) && defined(_XPG6)) > #error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications \ > require the use of c99" > #endif > > Removing `#define _POSIX_C_SOURCE 200809L` results in successful compilation.
Ah, I didn't even know that headers would bail out in case they don't support the standard, but it makes sense in retrospect. My current version is:
#define _BSD_SOURCE #define _DEFAULT_SOURCE #define _DARWIN_C_SOURCE
I hope that should work fine on all platforms. In any case, I have created [1] upstream now.
[1]: https://github.com/clar-test/clar/pull/107
Show 27 quoted lines
> > +
> > #include <assert.h>
> > #include <setjmp.h>
> > #include <stdlib.h>
> > @@ -271,9 +275,7 @@ static double clar_time_diff(clar_time *start, clar_time *end)
> >
> > static void clar_time_now(clar_time *out)
> > {
> > - struct timezone tz;
> > -
> > - gettimeofday(out, &tz);
> > + gettimeofday(out, NULL);
> > }
> >
> > static double clar_time_diff(clar_time *start, clar_time *end)
> > diff --git a/t/unit-tests/clar/clar/sandbox.h b/t/unit-tests/clar/clar/sandbox.h
> > index e25057b7c4..b499d2e1e6 100644
> > --- a/t/unit-tests/clar/clar/sandbox.h
> > +++ b/t/unit-tests/clar/clar/sandbox.h
> > @@ -122,7 +122,7 @@ static int build_sandbox_path(void)
> >
> > if (mkdir(_clar_path, 0700) != 0)
> > return -1;
> > -#elif defined(__TANDEM)
> > +#elif defined(__sunos) || defined(__TANDEM)
>
> I think we want __sun here, not __sunos.And typoed that one, as well :)
Patrick