googletest icon indicating copy to clipboard operation
googletest copied to clipboard

[Bug]: make fails to compile googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o every time, on Ubuntu 22.04

Open holta opened this issue 1 year ago • 4 comments

Describe the issue

Running the following...

apt install build-essential cmake
git clone https://github.com/google/googletest
cd googletest
mkdir build
cd build
cmake ..
make

...fails with this error every time:

[ 12%] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [googletest/CMakeFiles/gtest.dir/build.make:76: googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:172: googletest/CMakeFiles/gtest.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

Also reported at:

  • transmission/transmission#5634

Steps to reproduce the problem

See above.

What version of GoogleTest are you using?

9b12f749fa972d08703d8459e9bf3239617491ca

What operating system and version are you using?

Ubuntu 22.04

What compiler and version are you using?

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04.1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-aYxV0E/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-aYxV0E/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1)

What build system are you using?

# cmake --version
cmake version 3.22.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Additional context

No response

holta avatar Jun 18 '23 21:06 holta

Is it perhaps possible that your computer is running out of memory?

lighterowl avatar Jun 19 '23 19:06 lighterowl

Is it perhaps possible that your computer is running out of memory?

Have googletest's requirements changed in the past week?

Certainly this worked a week ago.

(And a week later, this fails on 3 different Ubuntu VM's, each with 2GB RAM.)

holta avatar Jun 19 '23 19:06 holta

I just tried a 4th VM (Ubuntu 22.04, also with 2GB RAM) and very mysteriously today make works:

[ 12%] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 25%] Linking CXX static library ../lib/libgtest.a
[ 25%] Built target gtest
[ 37%] Building CXX object googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
[ 50%] Linking CXX static library ../lib/libgmock.a
[ 50%] Built target gmock
[ 62%] Building CXX object googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
[ 75%] Linking CXX static library ../lib/libgmock_main.a
[ 75%] Built target gmock_main
[ 87%] Building CXX object googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[100%] Linking CXX static library ../lib/libgtest_main.a
[100%] Built target gtest_main

(Is it possible googletest is relying on some kind of upstream/online dependencies, that caused all installs to fail yesterday?)

holta avatar Jun 19 '23 20:06 holta

Reconfirmed on 2 additional/equivalent VM's (Ubuntu 22.04, 2GB RAM).

In any case, if only to document the (somewhat disturbing!) mystery:

  • 3 identical Ubuntu VM's failed to compile googletest yesterday, in the exact same way — freezing (hanging) for about 5 minutes, before returning to the prompt, with the error pasted in above.
  • Now about 24h later, 3 additional fully equivalent VM's work (Ubuntu 22.04, 2GB RAM) compiled googletest successfully, in about 8 seconds each.

holta avatar Jun 19 '23 20:06 holta

I'm not able to reproduce this on Ubuntu 22.04.1 with the latest GCC I see available (11.2.0), so I will close the issue. It may be an issue related to your system.

higher-performance avatar Jun 27 '23 19:06 higher-performance

It may be an issue related to your system.

Seems unlikely as the problem occured on 3 separate Ubuntu 22.04 VM's.

And then the very next day — no problem at all — on 3 additional Ubuntu 22.04 VM's.

(The most likely scenario would appear to be that googletest depends on a fragile upstream download/mirror or package dependency or some kind, that was not available on that particular day.)

holta avatar Jun 27 '23 19:06 holta

I'm not sure. If you manage to track it down feel free to let us know.

higher-performance avatar Jun 27 '23 19:06 higher-performance