cotire icon indicating copy to clipboard operation
cotire copied to clipboard

cotire and clang, modificated system header files fail build

Open karolherbst opened this issue 11 years ago • 6 comments

Currently if a system header file included in a generated pch file gets trivially changed (like new write date without modifications) clang errors due to

fatal error: file '/usr/include/pthread.h' has been modified since the precompiled header '...' was built
note: please rebuild precompiled header '...'

Is there someway cotire could add checks so that it rebuilds them if needed? compiling an empty file with included pch seems to be a valid check for it.

karolherbst avatar Nov 22 '14 14:11 karolherbst

Which generator due you use?

sakra avatar Nov 22 '14 16:11 sakra

Makefile

karolherbst avatar Nov 22 '14 16:11 karolherbst

Dependencies are completely handled by the build system that CMake creates. Cotire is passive and relies on the build system triggering a re-build of the precompiled header when it is necessary. For that purpose cotire uses the IMPLICIT_DEPENDS option which makes CMake scan the precompiled header dependencies at build time. Interestingly this does not seem to work in your case.

Which compiler do you use? Do you also use a compiler wrapper (e.g., ccache)?

sakra avatar Nov 22 '14 17:11 sakra

I am using Clang without any wrapper.

If I change include files inside the project everything works fine. I am talking about system wide header files, which are not included tracked by cmake in any way.

karolherbst avatar Nov 22 '14 19:11 karolherbst

This still happens regularly. CMake triggers a rebuild of every affected in-project source file but not the PCH. It also affects GCC. There it doesn’t even warn – not even with -Winvalid-pch, it just uses the outdated PCH.

+: I also came across Clang’s -verify-pch, although according to the above explanation that shouldn’t be necessary.

Optiligence avatar Oct 12 '17 01:10 Optiligence

Still an issue for me with clang

xgdgsc avatar May 08 '18 01:05 xgdgsc