-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base_dir does not play well with Clang relocatable PCH #1322
Comments
LLVM confirmed that isysroot is not resolved in any way so ccache should not modify it when "relocatable-pch" is seen. It seems that proper way would be to use relative isysroot in caching key though, so the same PCH will get a cache hit when compiled from different folder but changing isysroot will not result in false cache hit. |
Would you be interested in working on a proposed fix? |
Yes, I'm already doing it but it may take some time. |
How to reproduce
touch pch.h
clang-16 -isysroot ${PWD} --relocatable-pch -x c++-header pch.h -o pch1.pch
CCACHE_BASEDIR=${PWD} ccache clang-16 -isysroot ${PWD} --relocatable-pch -x c++-header pch.h -o pch2.pch
Actual behavior
pch1.pch is relocatable relative to current directory, i.e. it contains relative path
pch.h
. pch2.pch is not relocatable because ccache modifiedisysroot
argument to.
which Clang then failed to match header path against.I am not 100% sure that this is ccache's fault instead of clang's. I think there might be situations where you may want PCH to be relocated against relative path, will clarify it with LLVM devs.
Expected behavior
Produced PCH files are binary identical (which they are if you do not pass CCACHE_BASEDIR).
Environment
ccache version 4.8
The text was updated successfully, but these errors were encountered: