构建 googletest 失败 ../allocators.h: 没有这样的文件或目录(但它存在于 /usr/local/include/ 中)

Building googletest fails ../allocators.h: No such file or directory (but it's present in /usr/local/include/)

我正在尝试构建 googletest 包: https://github.com/google/googletest/archive/release-1.8.0.tar.gz

使用:

autoreconf -ivf

./configure

make

sudo make install

但在 make 上它失败了:

depbase=`echo src/gtest-all.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/bash ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I./build-aux  -I. -I./include  -pthread -DGTEST_HAS_PTHREAD=1 -g -O2 -MT src/gtest-all.lo -MD -MP -MF $depbase.Tpo -c -o src/gtest-all.lo src/gtest-all.cc &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./build-aux -I. -I./include -pthread -DGTEST_HAS_PTHREAD=1 -g -O2 -MT src/gtest-all.lo -MD -MP -MF src/.deps/gtest-all.Tpo -c src/gtest-all.cc  -fPIC -DPIC -o src/.libs/gtest-all.o
In file included from ./include/gtest/internal/gtest-port.h:435:0,
                 from ./include/gtest/internal/gtest-internal.h:40,
                 from ./include/gtest/gtest.h:58,
                 from src/gtest-all.cc:39:
/usr/local/include/regex.h:18:27: fatal error: ../allocators.h: No such file or directory
compilation terminated.
Makefile:1043: recipe for target 'src/gtest-all.lo' failed
make: *** [src/gtest-all.lo] Error 1

出于某种原因(/usr/local),它正在父目录中寻找 3 个头文件(allocators.h、stream.h、rapidjson.h),所以我尝试复制他们在那里得到了更多的错误。

我正在使用 Linux Mint 18.2

谢谢!

不...这些头文件不应该在目录 /usr/local 中。它们应该位于 g++ 行上用 -I 选项列出的目录之一。添加另一个目录 -I 指向它们所在的位置,或者将文件移动到现有的 -I 目录之一。不要四处复制文件(如果绝对必要,请移动它们)。这是非常糟糕的做法,会给你带来麻烦。