[cfe-dev] clang PCH and strace

dawn at burble.org dawn at burble.org
Tue Sep 28 13:59:18 PDT 2010


Why would strace (on Linux) cause clang to fail to read a PCH? :

1. $ clang -cc1 -emit-pch -I/tmp/ /tmp/m.h -o m.pch
   $ clang -cc1 -include-pch m.pch -I/tmp/ /tmp/m.c

2. $ clang -cc1 -emit-pch -I/tmp/ /tmp/m.h -o m.pch
   $ strace -o bla -e open clang -cc1 -include-pch m.pch -I/tmp/ /tmp/m.c
   error: PCH file uses a newer PCH format that cannot be read
   1 error generated.

1st command works, 2nd command (with strace) fails.


strace also causes clang to generate a bad PCH:

1. $ clang -cc1 -emit-pch -I/tmp/ /tmp/m.h -o m.pch
   $ clang -cc1 -include-pch m.pch -I/tmp/ /tmp/m.c

2. $ strace -o bla clang -cc1 -emit-pch -I/tmp/ /tmp/m.h -o m.pch
   $ clang -cc1 -include-pch m.pch -I/tmp/ /tmp/m.c
   error: PCH file uses an older PCH format that is no longer supported
   1 error generated.


Source:
    #include "m.h"
    int main() {
        return foo();
    }

Header:
    #ifndef M_H
    #define M_H
    int foo();
    #endif

Thanks,
-Dawn



More information about the cfe-dev mailing list