Re: fix compilation on MacOS

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

 



A properly formatted patch can be found here:
https://raw.githubusercontent.com/NixOS/nixpkgs/3020abe5b591d201cc6b760f3a9c6e4b94cfca2d/pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch

all the best

Adrian

On Fri, Jul 24, 2020 at 11:58 PM Adrian Gierakowski
<agierakowski@xxxxxxxxx> wrote:
>
> Hi
>
> Sent the message below some time ago but just realised it got rejected
> due to HTML content. Any chance for a minor release with a fix any
> time soon? Thanks!
>
> Adrian
>
> On Tue, Jul 21, 2020 at 5:30 PM Adrian Gierakowski
> <agierakowski@xxxxxxxxx> wrote:
> >
> > Hi
> >
> > Build on MacOS seems to be broken since v0.5.11. At least on 10.14.6 (Mojave) and when compiling for darwin under NixOS. The attached patch fixes it for me.
> >
> > The errors I'm seeing are as follows:
> > ```
> > expand.c:1365:9: error: incomplete definition of type 'struct dirent64'
> >                 if (dp->d_name[0] == '.' && ! matchdot)
> >                     ~~^
> > expand.c:1287:9: note: forward declaration of 'struct dirent64'
> >         struct dirent64 *dp;
> > ```
> > etc.
> >
> > The patch below seems to fix it (I pasted it in since email with attachment got rejected).
> >
> > There is also a bunch of deprecation warning (the patch doesn't address those), which look as follows:
> >
> > ```
> > cd.c:135:7: warning: 'stat64' is deprecated: first deprecated in macOS 10.6 [-Wdeprecated-declarations]
> >                 if (stat64(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) {
> > ```
> > Similar warnings repeat for `lstat64` and `fstat64`.
> >
> > Best regards
> > Adrian
> >
> > ========================================================================
> >
> > From 7e75779eaeacdbb46a387a59d9aaf1481a1da3e5 Mon Sep 17 00:00:00 2001
> > From: Adrian Gierakowski <agierakowski@xxxxxxxxx>
> > Date: Sun, 19 Jul 2020 08:38:05 +0100
> > Subject: [PATCH] fix dirent64 et al on darwin
> >
> > ---
> >  configure.ac | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/configure.ac b/configure.ac
> > index b8faca9..cee1e4d 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -139,6 +139,7 @@ if test "$ac_cv_func_signal" != yes; then
> >   [klibc has bsd_signal instead of signal])])
> >  fi
> >
> > +dnl TODO: stat64 is deprecated since macOS 10.6
> >  dnl Check for stat64 (dietlibc/klibc).
> >  AC_CHECK_FUNC(stat64,, [
> >   AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit])
> > @@ -155,6 +156,16 @@ AC_CHECK_FUNC(open64,, [
> >   AC_DEFINE(open64, open, [64-bit operations are the same as 32-bit])
> >  ])
> >
> > +dnl OS X apparently has stat64 but not readdir64.
> > +AC_CHECK_FUNC(readdir64,, [
> > + AC_DEFINE(readdir64, readdir, [64-bit operations are the same as 32-bit])
> > +])
> > +
> > +dnl OS X apparently has stat64 but not dirent64.
> > +AC_CHECK_TYPE(struct dirent64,, [
> > + AC_DEFINE(dirent64, dirent, [64-bit operations are the same as 32-bit])
> > +],[#include <dirent.h>])
> > +
> >  dnl Check if struct stat has st_mtim.
> >  AC_MSG_CHECKING(for stat::st_mtim)
> >  AC_COMPILE_IFELSE(
> > --
> > 2.15.1
> >
>
>
> --
> Adrian Gierakowski



-- 
Adrian Gierakowski



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux