Open Quuxplusone opened 8 years ago
Bugzilla Link | PR27909 |
Status | NEW |
Importance | P normal |
Reported by | Rintaro Ishizaki (fs.output@gmail.com) |
Reported on | 2016-05-27 09:02:36 -0700 |
Last modified on | 2018-10-25 20:12:05 -0700 |
Version | unspecified |
Hardware | PC Linux |
CC | blangmuir@apple.com, bruno.cardoso@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
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
Ubuntu clang version 3.6.2-1 (tags/RELEASE_362/final) (based on LLVM 3.6.2)
and
https://github.com/apple/swift-llvm stable branch
https://github.com/apple/swift-clang stable branch
build.
I will try official trunk/trunk from now.
Reproduced with trunk
$ ~/Documents/repos/build/bin/clang -v --sysroot / -ivfsoverlay overlay.yml
foo.c
clang version 3.9.0 (trunk 271088) (llvm/trunk 271087)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/rintaro/Documents/repos/build/bin
Found candidate GCC installation: //usr/lib/gcc/i686-linux-gnu/5.2.1
Found candidate GCC installation: //usr/lib/gcc/x86_64-linux-gnu/5.2.1
Selected GCC installation: //usr/lib/gcc/x86_64-linux-gnu/5.2.1
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
"/home/rintaro/Documents/repos/build/bin/clang-3.9" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name foo.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -resource-dir /home/rintaro/Documents/repos/build/bin/../lib/clang/3.9.0 -ivfsoverlay overlay.yml -isysroot / -internal-isystem //usr/local/include -internal-isystem /home/rintaro/Documents/repos/build/bin/../lib/clang/3.9.0/include -internal-externc-isystem //usr/include/x86_64-linux-gnu -internal-externc-isystem //include -internal-externc-isystem //usr/include -fdebug-compilation-dir /home/rintaro -ferror-limit 19 -fmessage-length 191 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/foo-1cae04.o -x c foo.c
clang -cc1 version 3.9.0 based upon LLVM 3.9.0svn default target x86_64-unknown-
linux-gnu
ignoring nonexistent directory "//include"
#include "..." search starts here:
#include <...> search starts here:
//usr/local/include
/home/rintaro/Documents/repos/build/bin/../lib/clang/3.9.0/include
//usr/include/x86_64-linux-gnu
//usr/include
End of search list.
foo.c:1:10: fatal error: 'stdio_vfs.h' file not found
#include <stdio_vfs.h>
^
1 error generated.
This is because: llvm::sys::path splits "//usr/include/vfs_stdio.h" as: { "//usr", "/", "include", "vfs_stdio.h" } It doesn't match the path components in the YAML: { "/", "usr", "include", "vfs_stdio.h" }
Now, I'm not sure which we should fix, Driver or RedirectingFileSystem.
The really quick fix would be:
=================================================================== --- lib/Driver/Driver.cpp (revision 271112) +++ lib/Driver/Driver.cpp (working copy) @@ -490,6 +490,9 @@ } if (const Arg *A = Args.getLastArg(options::OPT__sysroot_EQ)) SysRoot = A->getValue();
But maybe, we should replace every SysRoot + ...
in lib/Driver/Toolchain.cpp
with llvm::sys::path::append or such.
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".