[tz] Errors compiling 2022f on macOS

Gilmore Davidson gilmoreorless at gmail.com
Sat Oct 29 22:29:59 UTC 2022


Hi, I’m getting errors when running make on the 2022f release, on my macOS Monterrey (12.6.1) machine.

There are two separate errors. When I run `make` with no arguments, I get the following:

cc -DTZDIR='"/usr/share/zoneinfo"'    -c -o zic.o zic.c
zic.c:1194:11: error: implicit declaration of function 'getrandom' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      s = getrandom(entropy_buffer, sizeof entropy_buffer, 0);
          ^
1 error generated.


After some digging, I tried running `make CFLAGS="-DHAVE_GETRANDOM=0”`, which then presents a different error:

cc -DTZDIR='"/usr/share/zoneinfo"' -o zic -DHAVE_GETRANDOM=0  zic.o
Undefined symbols for architecture x86_64:
  "_libintl_gettext", referenced from:
      _main in zic.o
      _close_file in zic.o
      _usage in zic.o
      _warning in zic.o
      _infile in zic.o
      _adjleap in zic.o
      _associate in zic.o
      ...
  "_libintl_setlocale", referenced from:
      _main in zic.o
  "_libintl_textdomain", referenced from:
      _main in zic.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


I’m not a C programmer so I’m out of my depth with trying to diagnose workarounds. Possibly there’s just another CFLAGS argument I need to provide, or I’ve got something else weird in my environment?

Some extra bits of context:

These errors also happen on latest `main` branch (commit 9f1f40cd).
I can compile 2022e without issue.
The getrandom error appears in commit 0733c65c ("Improve randomness of zic temp file names”).
The linking error appears in commit e5b2ee63 ("Use C23 __has_include if available”).
masOS 12.6.1 / Make 3.81 / clang 14.0.0

Also, the Makefile comment for the HAVE_GETRANDOM flag says "-DHAVE_GETRANDOM if getgrandom works (e.g., GNU/Linux)*” — is “getgrandom” a typo?

Cheers,
Gil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mm.icann.org/pipermail/tz/attachments/20221030/468d7c3c/attachment-0001.html>


More information about the tz mailing list