On 13:14 Thu 04 Jan 2024, Baesken, Matthias wrote:
> 
> >I have no idea why disabling PCH might change things in this area.
> 
> Good question, seems there is something  'special' with PCH  .
> 
> 
> Best regards, Matthias
> 
> 

I'm very late on this one, but we're now encountering the same problem
in a different form with 11u [0].  This time, autoconf is adding
-std=gnu23 to the C compiler and I'm hoping backporting the more
general fix to this, JDK-8323672 [1], will fix this.

Regarding if there is something special about PCH, there is.  The
precompiled header is generated by the C compiler, but with the -x
c++-header option.

I believe what we are currently seeing on 11u is that clang does not
like the C compiler being used for C++ code with an option for C
standards, -std=gnu23:

Generating precompiled header
error: invalid argument '-std=gnu23' not allowed with 'C++'

It's hard to tell for sure because the default build logs are not
verbose and I can't replicate this with the GNU/Linux clang (the
failure is on MacOS only and only on 11u)

What I think you were seeing a couple of years ago was the opposite;
the precompiled header was generated without the -std=gnu+11 option - 
because it was done using clang not clang++ - and then the later
usages of clang++ -std=gnu++11 complained about this with:

error: C++11 was disabled in PCH file but is currently enabled

Disabling PCH left everything compiled with -std=gnu++11, fixing the
issue.

On a local GNU/Linux build with verbose logging and gcc, the
invocation looks roughly like this:

+ /usr/bin/gcc <flags inc. -std=gnu++98> -x c++-header -c -MMD -MF \
<builddir>/hotspot/variant-server/libjvm/gtest/objs/precompiled/precompiled.hpp.gch.d.tmp
 \
<srcdir>/src/hotspot/share/precompiled/precompiled.hpp \
-o 
<builddir>/hotspot/variant-server/libjvm/gtest/objs/precompiled/precompiled.hpp.gch

the key bit being the use of /usr/bin/gcc not /usr/bin/g++.

[0] https://github.com/openjdk/jdk11u-dev/pull/3169
[1] https://bugs.openjdk.org/browse/JDK-8323672
-- 
Andrew :)
Pronouns: he / him or they / them

PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04  C5A0 CFDA 0F9B 3596 4222

Please contact via e-mail, not proprietary chat networks

Reply via email to