Search code examples
linuxmakefilegoogletest

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


I'm trying to build googletest package from: https://github.com/google/googletest/archive/release-1.8.0.tar.gz

using:

autoreconf -ivf

./configure

make

sudo make install

but on make it fails with:

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

it is looking for 3 header files (allocators.h, stream.h, rapidjson.h) in the parent directory for some reason (/usr/local), so I tried copying them there and got even more errors.

I'm using Linux Mint 18.2

Thanks!


Solution

  • No... these header files should not be in the directory /usr/local. They should be in one of the directories listed with -I options on the g++ line. Either add another directory with -I pointing to where they are, or move the files to one of the existing -I directories. DO NOT copy files around (if you absolutely have to, move them). That is very poor practice and will get you in trouble.