OpenJDK fails to build with GCC when the #include<time.h> inside zip.cpp comes from a non-sysroot path
Florian Weimer
fweimer at redhat.com
Wed Nov 28 15:26:54 UTC 2018
* Patrick Zhang:
> When I build on the latest jdk/jdk code base with GCC 8.2 (configured
> sysroot as a customized path instead of default root directory of the
> linux system),
I doubt it has anything to do with a sysroot vs non-sysroot
configuration.
> it failed with error:
> "jdk.pack/share/native/common-unpack/zip.cpp:420:23: error:
> declaration of 'tm* gmtime_r(const time_t*, tm*)' has a different
> exception specifier".
The declaration of gmtime_r should be removed. Apparently, the comment
in the OpenJDK is wrong and the declaration is included even on
non-Solaris systems.
With glibc, you can declare your own gmtime_r function this way, but not
if you include the <time.h> header. GCC 9 will also warn if we add
additional attributes (e.g. for nonnull warnings), so replicating the
declaration from <time.h> is a losing battle.
Which system needs the gmtime_r macro definition? Windows?
Thanks,
Florian
More information about the jdk-dev
mailing list