[llvm] r240981 - Fix bug #23967. The gtest and gtest_main targets were exported into the

Dan Liew dan at su-root.co.uk
Mon Jul 6 07:58:37 PDT 2015


On 6 July 2015 at 06:21, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
> You broke clang build with installed llvm, aka clang standalone build.
> http://bb.pgr.jp/builders/msbuild-llvmclang-x64-msc18-DA/builds/389

That build shows multiple errors at different stages. Do you mean [1]?
The error I see is

```

fatal error C1083: Cannot open include file: 'llvm/Config/config.h':
No such file or directory
[C:\bb-win7\msbuild-llvmclang-x64-msc18-DA\builds\clang\utils\unittest\UnitTestMain\gtest_main.vcxproj]

```

I'm confused. This error "shouldn't" have anything to do with the
patch I made because I've not changed whether or not
``llvm/Config/config.h`` is installed. Also note that running
``llvm-config --libs all`` from install tree doesn't include the gtest
libraries (but does from the build tree) prior to my patch (which I
believe the out of tree clang CMake build relies on) so I'm surprised
you were able to build Clang's unit tests against an installed LLVM at
all prior to my patch.

> I have a few options;
>
>   1) Revert yours and rework just to exclude gtest* from "all".


This isn't sufficient on it's own. My patch did two things

- effectively removes ``gtest`` and ``gtest_main`` targets from the
``all`` component for both the CMake (for building against build or
install tree) and Autoconf build systems (for building against install
tree only).
- Prevents installation of ``gtest`` and ``gtest_main`` libraries. The
libraries should **not** be installed because they will conflict with
existing gtest installations on Linux/OSX. The Autoconf build system
does not install the gtest* libraries and neither should the CMake
build system. If we really want to install LLVM's version of the gtest
libraries they need to be renamed. I strongly advise against
installing LLVM's gtest however as we don't install the corresponding
header files.


>   2) Rework gtestmain not to depend on config.h (to build gtest in
> clang build tree from llvm source tree).
>   3) Abandon building clang's unittests in clang standalone tree.

I'm not entirely sure about these other options. I need to understand
why my patch broke your build.

[1] http://bb.pgr.jp/builders/msbuild-llvmclang-x64-msc18-DA/builds/389/steps/build_clang_tools/logs/stdio

Thanks,
Dan.



More information about the llvm-commits mailing list