-
Notifications
You must be signed in to change notification settings - Fork 13.5k
"--sysroot /" mess up overlaid VFS #28283
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
Comments
Thanks for reporting this! Which version of LLVM did you use? Did you tests this on ToT? There were lots of VFS changes in the past month and I wonder whether they fix this. Thanks, |
I tested with Ubuntu 15.10 clang and https://github.com/apple/swift-llvm stable branch I will try official trunk/trunk from now. |
Reproduced with trunk $ ~/Documents/repos/build/bin/clang -v --sysroot / -ivfsoverlay overlay.yml foo.c |
This is because: Now, I'm not sure which we should fix, Driver or RedirectingFileSystem. The really quick fix would be: ===================================================================
But maybe, we should replace every |
We may want to explicitly teach the VFS that if it gets a root that is a net name (like //foo) and it doesn't find it, it should try treating it as "/foo". |
Currently if `--sysroot /` is passed to the Clang driver, the include paths generated by the Clang driver will start with a double slash: `//usr/include/...`. If VFS is used to inject files into the include paths (for example, the Swift compiler does this), VFS will get confused and the injected files won't be visible. This change makes sure that the include paths start with a single slash. Fixes llvm#28283. Differential Revision: https://reviews.llvm.org/D126289
Currently if `--sysroot /` is passed to the Clang driver, the include paths generated by the Clang driver will start with a double slash: `//usr/include/...`. If VFS is used to inject files into the include paths (for example, the Swift compiler does this), VFS will get confused and the injected files won't be visible. This change makes sure that the include paths start with a single slash. Fixes llvm#28283. Differential Revision: https://reviews.llvm.org/D126289
@llvm/issue-subscribers-clang-driver |
Extended Description
Virtual file system cannot find overlaid file if "--sysroot /" is specified.
Way to reproduce:
$ cat overlay.yml
{
"version": 0,
"use-external-names": false,
"roots": [
{
"type": "file",
"name": "/usr/include/stdio_vfs.h",
"external-contents": "/usr/include/stdio.h"
}
]
}
$ cat foo.c
#include <stdio_vfs.h>
int main() {
printf("foo");
}
$ clang -ivfsoverlay overlay.yml foo.c # NO PROBLEM
$ clang --sysroot / -ivfsoverlay overlay.yml foo.c
foo.c:1:10: fatal error: 'stdio_vfs.h' file not found
#include <stdio_vfs.h>
^
1 error generated.
$
The text was updated successfully, but these errors were encountered: