tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Host requirements to build the Tools binaries
So this boils down to: What APIs / standards does NetBSD (while
building `tools`) expect to be implemented?
strptime is marked as XSI[1], so you'll need to add `_XOPEN_SOURCE' as the
man-page on Linux indicates (either on the cmd. line, or before any headers
are included, or in the very first header read as tsutsui@ said):
[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html
```
$ uname -a
Linux CoreBook 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
$ cat t.c
// #define _XOPEN_SOURCE // for testing
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int
main(void)
{
struct tm tm;
char buf[255];
memset(&tm, 0, sizeof(tm));
strptime("2001-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", &tm);
strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
puts(buf);
exit(EXIT_SUCCESS);
}
$ cc -Wall -Werror -o /dev/null t.c
t.c: In function ʽmainʼ:
t.c:14:5: error: implicit declaration of function ʽstrptimeʼ; did you mean ʽstrftimeʼ? [-Werror=implicit-function-declaration]
14 | strptime("2001-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", &tm);
| ^~~~~~~~
| strftime
cc1: all warnings being treated as errors
$ cc -D_XOPEN_SOURCE -Wall -Werror -o /dev/null t.c
$
```
It's been like this on Linux for years and years now.
-RVP
Home |
Main Index |
Thread Index |
Old Index