[MacPorts] #54638: mesa @17.1.6_0: error: implicit declaration of function 'fstatat' is invalid in C99
MacPorts
noreply at macports.org
Wed Nov 21 02:28:20 UTC 2018
#54638: mesa @17.1.6_0: error: implicit declaration of function 'fstatat' is
invalid in C99
-------------------------+-------------------------------------------------
Reporter: tehcog | Owner: jeremyhu
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version: 2.4.1
Resolution: | Keywords: tiger leopard snowleopard lion
Port: mesa | mountainlion mavericks
-------------------------+-------------------------------------------------
Comment (by kencu):
OK. This compiles without any particular issue. You need these added to
`<sys/fcntl.h>`, possibly without the initial guard, but probably with the
guard:
{{{
#if __DARWIN_C_LEVEL >= 200809L
/*
* Descriptor value for the current working directory
*/
#define AT_FDCWD -2
/*
* Flags for the at functions
*/
#define AT_EACCESS 0x0010 /* Use effective ids in access
check */
#define AT_SYMLINK_NOFOLLOW 0x0020 /* Act on the symlink itself not
the target */
#define AT_SYMLINK_FOLLOW 0x0040 /* Act on target of symlink */
#define AT_REMOVEDIR 0x0080 /* Path refers to directory */
#endif
}}}
you need to add a definition for `getattrlistat` to avoid an implicit
declaration error:
{{{
int getattrlistat(int dirfd, const char *pathname, struct attrlist *a,
void *buf, size_t size, unsigned long
flags);
}}}
and there is some secret sauce, info for which is found here
<https://gist.github.com/bnoordhuis/4221344>
{{{
/* this is some apple internal magic */
#include <sys/syscall.h>
#ifndef SYS___pthread_chdir
# define SYS___pthread_chdir 348
#endif
#ifndef SYS___pthread_fchdir
# define SYS___pthread_fchdir 349
#endif
int __pthread_chdir(const char *path)
{
return syscall(SYS___pthread_chdir, path);
}
int __pthread_fchdir(int dirfd)
{
return syscall(SYS___pthread_fchdir, dirfd);
}
/* extern int __pthread_fchdir(int fd); */
}}}
and then it compiles through to an object file without any troubles, at
least on this 10.6.8 system I like to use, with clang-3.9 and libc++.
Perhaps Chris can help me come up with some test programs for it.
--
Ticket URL: <https://trac.macports.org/ticket/54638#comment:15>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list