| Issue |
174037
|
| Summary |
clang modules incompatible between windows and linux
|
| Labels |
clang
|
| Assignees |
matts1
|
| Reporter |
matts1
|
The scheduler for the build system I use has the ability to start the job both locally and remotely, and uses the output of whichever one finishes first.
All our remote executors use linux, which means that the following is possible if compiling from a windows host.
#### Compile a PCM
```
# Remotely cross-compiling to windows from a linux worker
clang-cl ... foo/bar.h -emit-module -o out/foo/bar.pcm
# Locally compiling from your windows host
clang-cl.exe ... foo/bar.h -emit-module -o out/foo/bar.pcm
```
#### Use the PCM
```
# From a remote worker
clang-cl ... -fmodule-file=out/foo/foo.pcm
# From a local worker
clang-cl.exe ... -fmodule-file=out/foo/foo.pcm
```
The problem is that the PCM generated by a windows host is incompatible with linux. More specifically, when you attempt to use it, you get the error:
```
fatal error: malformed or corrupted precompiled file: 'could not find file 'foo\bar.h' referenced by AST file 'out/foo/foo.pcm''
```
Upon digging deeper, the root cause appears to be that the generated pcm file references `foo\bar.h` (a windows path with a backslash), instead of `foo/bar.h` (a unix path with a forward slash).
In order to ensure that clang on different platforms outputs the same PCM file, I thus propose that we:
* If on windows, normalize all paths to unix paths upon writing the PCM file
* If on windows, restore windows paths upon reading the PCM file
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs