Without looking at the code, I have to guess that -DHAVE_ISSETUGID=0 is part of the problem. This is going to trigger the compatibility code to build. However, since we have a issetugid(), this is going to cause a problem.
The actual problem call to setugid() doesn't seem to be guarded. Further down there is another call to setugid() that is guarded by HAVE_ISSETUGID. As a single user system it seems we can define it to 0.
/* Return 1 if the process is privileged, 0 otherwise. */
/* static int */
int
issetugid(void)
{
# if HAVE_SYS_AUXV_H && defined AT_SECURE
unsigned long val;
errno = 0;
val = getauxval(AT_SECURE);
if (val || errno != ENOENT)
return !!val;
# endif
# if HAVE_GETRESUID
{
uid_t ruid, euid, suid;
gid_t rgid, egid, sgid;
if (0 <= getresuid (&ruid, &euid, &suid)) {
if ((ruid ^ euid) | (ruid ^ suid))
return 1;
if (0 <= getresgid (&rgid, &egid, &sgid))
return !!((rgid ^ egid) | (rgid ^ sgid));
}
}
# endif
The problem with the duplicate symbols comes from strftime.c, in the case of 32bit time_t, including localtime.c, which has already been compiled.
Seems to me the call to issetugid() could be simply replaced with return 0. Not sure the best way to do that for a void function. Perhaps this?
#ifndef __OS2__
static int
issetugid(void)
#else
return 0;
#endif
Edit: Note I had to remove the static due to conflicts with our headers where issetugid() is not static.
Edit2: Testing,
localtime.c:391:1: error: expected identifier or '(' before 'return'
391 | return 0;
| ^~~~~~
localtime.c:393:1: error: expected identifier or '(' before '{' token
393 | {
| ^
make: *** [<builtin>: localtime.o] Error 1