Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Clang does not find precompiled header under some circumstances #15136

Open Quuxplusone opened 11 years ago

Quuxplusone commented 11 years ago
Bugzilla Link PR15136
Status NEW
Importance P normal
Reported by jpakkane@gmail.com
Reported on 2013-02-01 04:27:20 -0800
Last modified on 2018-10-25 20:11:56 -0700
Version trunk
Hardware PC Linux
CC geek4civic@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments pchbug.zip (1515 bytes, application/zip)
Blocks
Blocked by
See also
I'm using nevest SVN on Ubuntu Raring but this problem also occurred in Precise.

I use precompiled headers but they are not found under certain circumstances.
Here's how to replicate the issue:

sudo apt-get install ninja-build
sudo apt-get install libicu-dev
bzr branch lp:libcolumbus
cd libcolumbus
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=debug -G Ninja ..
ninja

You get an error message saying that the pch can not be found. If you use the
Make backend, the pch is found. With gcc both Make and Ninja work without
problems.

What happens in the build is that the precompiled header is written to
BUILDDIR/src and that directory is then added to the command line with -I.

The only difference between the two invocations I can see is that Make uses
global paths like this:

-I[/path/to/build/dir]/src

whereas Ninja cd's into the build root and specifies the path with this:

-Isrc

The latter invocation is in the correct directory, since it refers to the
source file like this: ../src/ErrorValues.cc and it works just fine if
precompiled headers are disabled.

Thus the include paths should be set up correctly but Clang does not seem to be
able to find the pch.
Quuxplusone commented 11 years ago

Attached pchbug.zip (1515 bytes, application/zip): Reduced test case