Use of builtin timezones does not work on Linux
Milan Crha
mcrha at redhat.com
Mon Jul 27 10:05:22 EDT 2020
Hi,
when I configure libical with -DUSE_BUILTIN_TZDATA=ON then a simple
program like this one fails:
----------------------------------------------------------------------
/* gcc `pkg-config --cflags --libs libical` icaltz.c -g -O0 -o icaltz && ./icaltz */
#include <stdio.h>
#include <libical/ical.h>
int
main (int argc,
char *argv[])
{
icaltimezone *tz;
tz = icaltimezone_get_builtin_timezone ("Indian/Cocos");
printf ("%s: tz:%p id:'%s'\n", __FUNCTION__, tz, icaltimezone_get_tzid (tz));
return 0;
}
----------------------------------------------------------------------
because it cannot find the time zone. I found out the problem is in the
src/libical/CMakeLists.txt, which has this:
set(PACKAGE_DATA_DIR "\\\"${CMAKE_INSTALL_PREFIX}/share/libical\\\"")
The problem are the extra double quotes around the path, which are
propagated to the sources, which means the:
#define ZONEINFO_DIRECTORY PACKAGE_DATA_DIR "/zoneinfo"
evaluates to:
"\"/my/prefix/share/libical\"/zoneinfo"
which cannot by accessed/opened. I do not know when this behavior
changed, the git blame on the CMakeLists.txt identifies the last change
on the PACKAGE_DATA_DIR (and some other variables) in commit 4b9de15e8,
made back in 2008, as "fixes for cmake 2.4.8". The double quotes were
there before this commit.
This change does not influence libical tests, but it causes a failure
of two libical-glib tests (part of `make test`), due to not being able
to open some time zones.
I tried to remove the extra double quotes in the PACKAGE_DATA_DIR, aka:
set(PACKAGE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/libical")
which helped, but my prefix doesn't contain any spaces and I do not
know what that would do on Windows.
I've currently installed CMake 3.17.3.
Bye,
Milan
More information about the libical-devel
mailing list