-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
After 578a4716f Clang -MD by default produces different dependecies file. #70011
After 578a4716f Clang -MD by default produces different dependecies file. #70011
Comments
@llvm/issue-subscribers-clang-frontend Author: None (kbelochapka)
commit 578a471
Author: Arthur Eubanks <[email protected]>
It appears that this commit unintentionally made -canonical-system-headers==true as default. This change in the clang default behavior causes some other tools that rely on the older format of the dependencies file to work incorrectly. (for example we have Visual Studio extension software that relies on the dependencies file) On Windows platform, if your system headers located a network drive or on drive that was created by the SUBST command For example; before the commit a path to a include file in the dependencies file looked like:
After the commit the include file path looks like that:
|
@llvm/issue-subscribers-clang-driver Author: None (kbelochapka)
commit 578a471
Author: Arthur Eubanks <[email protected]>
It appears that this commit unintentionally made -canonical-system-headers==true as default. This change in the clang default behavior causes some other tools that rely on the older format of the dependencies file to work incorrectly. (for example we have Visual Studio extension software that relies on the dependencies file) On Windows platform, if your system headers located a network drive or on drive that was created by the SUBST command For example; before the commit a path to a include file in the dependencies file looked like:
After the commit the include file path looks like that:
|
CC @aeubanks |
|
I had looked up for the -canonical-prefixes default value and it is ON. Then you are right, if the -canonical-prefixes==ON The problem is that, on Windows platform a path to include file in the dependencies file will be not just in the canonical form. This happens because on Windows, the llvm::sys::fs::real_path() function internally calls For example, you have SUBST drive D: which points to C:\FOLDER, and you have the include file on D:\INC\abc.h. As I mentioned in my previous comments, sometimes when a combined length of a path pieces goes over 260 limit, we can have a bogus path as an output. Another problem, this creates inconsistency between any include paths in a preprocessed file and paths in a dependencies file. |
In the short term, I think it would be reasonable to default system header canonicalization to false on Windows. In other words, go here:
And change the default to be false if the host is Windows. Changing behavior depending on the host can be awkward, since now clang will produce very different looking .d files on different platforms, but I think this actually makes clang's output more consistent, since Windows As a longer term fix, symlinks do exist on Windows. I would try to replicate the issue described at ninja-build/ninja#1330 on Windows by creating a symlink using sysroot.py for use with CMAKE_SYSROOT on Windows, and see if that can be used to reproduce the dirty build issues described there. We need a set of Windows API calls that: 1. resolve symlinks 2. resolve parent path components (..) and 3. doesn't change the drive letter from the original path, or uses the currently active drive letter for relative paths. And, I don't know how to do that, maybe someone else does. |
Canonicalizing paths on Windows leads to unexpected things like changing drive letters. As a short term fix, do not canonicalize system headers on Windows by default. Fixes llvm#70011
This change also caused a performance regression when using |
I'll add |
@aeubanks Having -f[no-]canonical-system-headers seems fine, but we should not make the default to be calling realpath on every system header when that causes a compile time regression. |
Yes, having it off by default sounds good. Actually I'll just revert the patch to start with and then rework it |
Thanks @aeubanks ! Feel free to tag me for a review when you rework it. |
… when -canonical-prefixes" This reverts commit 578a471. This causes multiple issues. Compile time slowdown due to more path canonicalization, and weird behavior on Windows. Fixes llvm#70011.
… when -canonical-prefixes" (#71697) This reverts commit 578a471. This causes multiple issues. Compile time slowdown due to more path canonicalization, and weird behavior on Windows. Will reland under a separate flag `-f[no-]canonical-system-headers` to match gcc in the future and further limit when it's passed by default. Fixes #70011.
… when -canonical-prefixes" (llvm#71697) This reverts commit 578a471. This causes multiple issues. Compile time slowdown due to more path canonicalization, and weird behavior on Windows. Will reland under a separate flag `-f[no-]canonical-system-headers` to match gcc in the future and further limit when it's passed by default. Fixes llvm#70011. (cherry picked from commit 955dd88) rdar://118178759
… when -canonical-prefixes" (llvm#71697) This reverts commit 578a471. This causes multiple issues. Compile time slowdown due to more path canonicalization, and weird behavior on Windows. Will reland under a separate flag `-f[no-]canonical-system-headers` to match gcc in the future and further limit when it's passed by default. Fixes llvm#70011. (cherry picked from commit 955dd88) rdar://118178759
/cherry-pick 955dd88 |
Failed to cherry-pick: 955dd88 https://github.com/llvm/llvm-project/actions/runs/6854110849 Please manually backport the fix and push it to your github fork. Once this is done, please add a comment like this:
|
/branch aeubanks/llvm-project/backport |
/pull-request llvm/llvm-project-release-prs#776 |
… when -canonical-prefixes" (llvm#71697) This reverts commit 578a471. This causes multiple issues. Compile time slowdown due to more path canonicalization, and weird behavior on Windows. Will reland under a separate flag `-f[no-]canonical-system-headers` to match gcc in the future and further limit when it's passed by default. Fixes llvm#70011.
/branch aeubanks/llvm-project/backport |
… when -canonical-prefixes" (#71697) This reverts commit 578a471. This causes multiple issues. Compile time slowdown due to more path canonicalization, and weird behavior on Windows. Will reland under a separate flag `-f[no-]canonical-system-headers` to match gcc in the future and further limit when it's passed by default. Fixes #70011.
commit 578a471
Author: Arthur Eubanks [email protected]
It appears that this commit unintentionally made -canonical-system-headers==true as default.
If anyone needs the old behavior he needs to specify -no-canonical-prefixes option.
Logically it should be visa-versa, if anyone needs the new behavior, let him use -canonical-prefixes option.
This change in the clang default behavior causes some other tools that rely on the older format of the dependencies file to work incorrectly. (for example we have Visual Studio extension software that relies on the dependencies file)
On Windows platform, if your system headers located a network drive or on drive that was created by the SUBST command
you will get a fully resolved real file path in the dependencies file
For example;
Lets assume that you have a network drive H: on which you have system headers.
before the commit a path to a include file in the dependencies file looked like:
After the commit the include file path looks like that:
The text was updated successfully, but these errors were encountered: