RFR: 8044797 Building with clang gives: fatal error: file '...' has been modified since the precompiled header was built
David Holmes
david.holmes at oracle.com
Thu Jun 5 11:38:27 UTC 2014
On 4/06/2014 11:54 PM, Staffan Larsen wrote:
> When building with clang and changing a file that is part of the precompiled header, you can get:
>
> fatal error: file '/Users/staffan/mercurial/jdk9-hs-rt/hotspot/src/share/vm/runtime/thread.hpp' has been modified since the precompiled header was built
>
> clang behaves differently than gcc here.
You mean clang reports an error when regenerating the pch file? That
seems like a bug to me.
Deleting the file first seems quite reasonable.
Thanks,
David
> Example with clang:
>
> $ ls
> test.h
> $ cat test.h
> #include <stdio.h>
> $ clang -x c-header -include test.h test.h -o test.h.pch
> $ touch test.h
> $ clang -x c-header -include test.h test.h -o test.h.pch
> fatal error: file '/Users/staffan/tmp/pch/test.h' has been modified since the precompiled header was built
> 1 error generated.
>
> Same with gcc:
>
> $ ls
> test.h
> $ cat test.h
> #include <stdio.h>
> $ gcc -x c-header -include test.h test.h -o test.h.pch
> $ touch test.h
> $ gcc -x c-header -include test.h test.h -o test.h.pch
>
>
> The proposed fix is to delete the .pch file before calling clang or gcc.
>
> diff --git a/make/bsd/makefiles/vm.make b/make/bsd/makefiles/vm.make
> --- a/make/bsd/makefiles/vm.make
> +++ b/make/bsd/makefiles/vm.make
> @@ -295,6 +295,7 @@
> $(PRECOMPILED_HEADER):
> $(QUIETLY) echo Generating precompiled header $@
> $(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
> + $(QUIETLY) rm -f $@
> $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
>
> # making the library:
>
>
> Thanks,
> /Staffan
>
More information about the hotspot-dev
mailing list