我在安装时遇到问题谷歌/基准在 Ubuntu 16.04.4 LTS 上使用 cmake。
以下是我目前所做的:
$ git clone https://github.com/google/benchmark.git
[...]
$ git clone https://github.com/google/googletest.git
[...]
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_BUILD_TYPE=RELEASE
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is Clang 3.8.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Failed to find LLVM FileCheck
-- Found Git: /usr/bin/git (found version "2.7.4")
-- git Version: v1.4.0-4c2af078
-- Version: 1.4.0
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Success
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Success
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- failed to compile
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- success
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Error at src/CMakeLists.txt:14 (list):
list does not recognize sub-command FILTER
-- Performing Test BENCHMARK_HAS_O3_FLAG
-- Performing Test BENCHMARK_HAS_O3_FLAG - Success
-- Performing Test BENCHMARK_HAS_CXX03_FLAG
-- Performing Test BENCHMARK_HAS_CXX03_FLAG - Success
-- Performing Test BENCHMARK_HAS_WNO_ODR
-- Performing Test BENCHMARK_HAS_WNO_ODR - Success
-- Configuring incomplete, errors occurred!
See also "/home/%%%%%%/benchmark/build/CMakeFiles/CMakeOutput.log".
See also "/home/%%%%%%/benchmark/build/CMakeFiles/CMakeError.log".
CMakeError.log
包含以下内容:
Performing C++ SOURCE FILE Test HAVE_CXX_FLAG_WD654 failed with the following output:
Change Dir: /home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_5b357/fast"
/usr/bin/make -f CMakeFiles/cmTC_5b357.dir/build.make CMakeFiles/cmTC_5b357.dir/build
make[1]: Entering directory '/home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_5b357.dir/src.cxx.o
/usr/bin/c++ -std=c++11 -Wall -Wextra -Wshadow -pedantic -pedantic-errors -Wshorten-64-to-32 -Wfloat-equal -fstrict-aliasing -Wno-deprecated-declarations -Wstrict-aliasing -DHAVE_CXX_FLAG_WD654 -wd654 -wd654 -o CMakeFiles/cmTC_5b357.dir/src.cxx.o -c /home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp/src.cxx
clang: error: unknown argument: '-wd654'
clang: error: unknown argument: '-wd654'
CMakeFiles/cmTC_5b357.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_5b357.dir/src.cxx.o' failed
make[1]: *** [CMakeFiles/cmTC_5b357.dir/src.cxx.o] Error 1
make[1]: Leaving directory '/home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_5b357/fast' failed
make: *** [cmTC_5b357/fast] Error 2
Source file was:
int main() { return 0; }
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_58255/fast"
/usr/bin/make -f CMakeFiles/cmTC_58255.dir/build.make CMakeFiles/cmTC_58255.dir/build
make[1]: Entering directory '/home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_58255.dir/CheckSymbolExists.c.o
/usr/bin/cc -o CMakeFiles/cmTC_58255.dir/CheckSymbolExists.c.o -c /home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_58255
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_58255.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_58255.dir/CheckSymbolExists.c.o -o cmTC_58255 -rdynamic
CMakeFiles/cmTC_58255.dir/CheckSymbolExists.c.o: In function `main':
CheckSymbolExists.c:(.text+0x16): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_58255.dir/build.make:97: recipe for target 'cmTC_58255' failed
make[1]: *** [cmTC_58255] Error 1
make[1]: Leaving directory '/home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_58255/fast' failed
make: *** [cmTC_58255/fast] Error 2
File /home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_3057e/fast"
/usr/bin/make -f CMakeFiles/cmTC_3057e.dir/build.make CMakeFiles/cmTC_3057e.dir/build
make[1]: Entering directory '/home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_3057e.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_3057e.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.5/Modules/CheckFunctionExists.c
Linking C executable cmTC_3057e
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3057e.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_3057e.dir/CheckFunctionExists.c.o -o cmTC_3057e -rdynamic -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_3057e.dir/build.make:97: recipe for target 'cmTC_3057e' failed
make[1]: *** [cmTC_3057e] Error 1
make[1]: Leaving directory '/home/%%%%%%/benchmark/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_3057e/fast' failed
make: *** [cmTC_3057e/fast] Error 2
我尝试在两台不同的机器上进行安装,但无法正常工作。