0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

google test trouble shoot

Last updated at Posted at 2023-02-24

まず

sudo apt install googletest

を使うのが一番楽です。

buildするときは・・・

$ sudo apt install build-essential git cmake libgtest-dev libstdc++-dev clang lldb lld

libstdc++-devlibstdc++-12-devでもよいかもです(環境による)

$ git clone https://github.com/google/googletest.git
$ cd googletest
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

trouble

build$ cmake ..
-- The CXX compiler identification is GNU 11.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - broken
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
  The C++ compiler

    "/usr/bin/c++"

  is not able to compile a simple test program.
..snip..
$ sudo apt remove gcc
$ sudo apt install clang-15
$ sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 1
$ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 1
$ cd ~/work/googletest
$ rm -rf build
$ mkdir build
$ cd build
$ cmake ..
$ make -j 4
$ sudo make install

のように、一度clang++に切り替えて、再度buildフォルダーを作って、cmake ..し直せばうまくいきます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?