Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to build #1797

Closed
chengm349 opened this issue Jun 6, 2024 · 10 comments
Closed

Failed to build #1797

chengm349 opened this issue Jun 6, 2024 · 10 comments

Comments

@chengm349
Copy link

Describe the bug
I download the git and tried to build. But failed with "cmake --build "build" --config Release"

System
3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux

To reproduce
Steps to reproduce the behavior:
just follow the build steps. My cmake is 3.20.

Expected behavior
/benchmark
/build
/src
/libbenchmark.a
/libbenchmark_main.a

to have 2 lib files.
Screenshots
/usr/local/cmake3.20/bin/cmake --build "build" --config Release
Consolidate compiler generated dependencies of target benchmark
[ 1%] Building CXX object src/CMakeFiles/benchmark.dir/benchmark.cc.o
[ 2%] Building CXX object src/CMakeFiles/benchmark.dir/benchmark_api_internal.cc.o
[ 3%] Building CXX object src/CMakeFiles/benchmark.dir/benchmark_name.cc.o
[ 4%] Building CXX object src/CMakeFiles/benchmark.dir/benchmark_register.cc.o
[ 5%] Building CXX object src/CMakeFiles/benchmark.dir/benchmark_runner.cc.o
[ 5%] Building CXX object src/CMakeFiles/benchmark.dir/check.cc.o
[ 6%] Building CXX object src/CMakeFiles/benchmark.dir/colorprint.cc.o
[ 7%] Building CXX object src/CMakeFiles/benchmark.dir/commandlineflags.cc.o
[ 8%] Building CXX object src/CMakeFiles/benchmark.dir/complexity.cc.o
[ 9%] Building CXX object src/CMakeFiles/benchmark.dir/console_reporter.cc.o
[ 10%] Building CXX object src/CMakeFiles/benchmark.dir/counter.cc.o
[ 11%] Building CXX object src/CMakeFiles/benchmark.dir/csv_reporter.cc.o
[ 12%] Building CXX object src/CMakeFiles/benchmark.dir/json_reporter.cc.o
[ 13%] Building CXX object src/CMakeFiles/benchmark.dir/perf_counters.cc.o
[ 13%] Building CXX object src/CMakeFiles/benchmark.dir/reporter.cc.o
[ 14%] Building CXX object src/CMakeFiles/benchmark.dir/statistics.cc.o
[ 15%] Building CXX object src/CMakeFiles/benchmark.dir/string_util.cc.o
[ 16%] Building CXX object src/CMakeFiles/benchmark.dir/sysinfo.cc.o
/fs02/home/mcheng/workspace/temp/benchmark/src/sysinfo.cc: In function ‘double benchmark::{anonymous}::GetCPUCyclesPerSecond(benchmark::CPUInfo::Scaling)’:
/fs02/home/mcheng/workspace/temp/benchmark/src/sysinfo.cc:822:22: error: call of overloaded ‘DoNotOptimize(Result&)’ is ambiguous
DoNotOptimize(state);
^
/fs02/home/mcheng/workspace/temp/benchmark/src/sysinfo.cc:822:22: note: candidates are:
In file included from /fs02/home/mcheng/workspace/temp/benchmark/src/sysinfo.cc:76:0:
/fs02/home/mcheng/workspace/temp/benchmark/include/benchmark/benchmark.h:554:37: note: void benchmark::DoNotOptimize(const Tp&) [with Tp = long unsigned int]
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
^
/fs02/home/mcheng/workspace/temp/benchmark/include/benchmark/benchmark.h:559:37: note: void benchmark::DoNotOptimize(Tp&) [with Tp = long unsigned int]
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp& value) {
^
/fs02/home/mcheng/workspace/temp/benchmark/include/benchmark/benchmark.h:565:37: note: void benchmark::DoNotOptimize(Tp&&) [with Tp = long unsigned int&]
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp&& value) {
^
gmake[2]: *** [src/CMakeFiles/benchmark.dir/sysinfo.cc.o] Error 1
gmake[1]: *** [src/CMakeFiles/benchmark.dir/all] Error 2
gmake: *** [all] Error 2

@chengm349
Copy link
Author

Also I have to ./src/CMakeFiles/benchmark.dir/flags.make -Wshadow to -Wno-shadow. Otherwise I'll get

Consolidate compiler generated dependencies of target benchmark
[ 1%] Building CXX object src/CMakeFiles/benchmark.dir/benchmark.cc.o
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc: In constructor ‘benchmark::State::State(std::string, benchmark::IterationCount, const std::vector&, int, int, benchmark::internal::ThreadTimer*, benchmark::internal::ThreadManager*, benchmark::internal::PerfCountersMeasurement*)’:
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc:171:74: error: declaration of ‘name’ shadows a member of 'this' [-Werror=shadow]
internal::PerfCountersMeasurement* perf_counters_measurement)
^
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc: In member function ‘void benchmark::State::PauseTiming()’:
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc:249:26: error: declaration of ‘name’ shadows a member of 'this' [-Werror=shadow]
const std::string& name = name_and_measurement.first;
^
cc1plus: all warnings being treated as errors

@LebedevRI
Copy link
Collaborator

Which compiler is that? I suspect our compiler requirements are stricter than the lax wishlist suggests.

@chengm349
Copy link
Author

I did these:

[mcheng@sg1-ldev-pioneer benchmark]$ which g++
/usr/lib64/ccache/g++
[mcheng@sg1-ldev-pioneer benchmark]$ /usr/lib64/ccache/g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[mcheng@sg1-ldev-pioneer benchmark]$ setenv CXX /usr/lib64/ccache/g++

[mcheng@sg1-ldev-pioneer benchmark]$ cmake320 -DCMAKE_BUILD_TYPE=Release -S . -B "build" -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on
-- Failed to find LLVM FileCheck
-- Google Benchmark version: v1.8.4-4-g7f0e99af, normalized to 1.8.4.4
-- Performing Test HAVE_STD_REGEX -- compiled but failed to run
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Performing Test HAVE_PTHREAD_AFFINITY -- failed to compile
-- Looking for Google Test sources
-- Looking for Google Test sources in /fs02/home/mcheng/workspace/temp/benchmark/googletest
CMake Warning at CMakeLists.txt:37 (message):
Did not find Google Test sources! Fetching from web...

-- Configuring done
-- Generating done
-- Build files have been written to: /fs02/home/mcheng/workspace/temp/benchmark/build/third_party/googletest
[ 11%] Performing update step for 'googletest'
[ 22%] No patch step for 'googletest'
[ 33%] No configure step for 'googletest'
[ 44%] No build step for 'googletest'
[ 55%] No install step for 'googletest'
[ 66%] No test step for 'googletest'
[ 77%] Completed 'googletest'
[100%] Built target googletest
-- Configuring done
-- Generating done
-- Build files have been written to: /fs02/home/mcheng/workspace/temp/benchmark/build
[mcheng@sg1-ldev-pioneer benchmark]$ cmake320 --build "build" --config Release
Consolidate compiler generated dependencies of target benchmark
[ 1%] Building CXX object src/CMakeFiles/benchmark.dir/benchmark.cc.o
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc: In constructor ‘benchmark::State::State(std::string, benchmark::IterationCount, const std::vector&, int, int, benchmark::internal::ThreadTimer*, benchmark::internal::ThreadManager*, benchmark::internal::PerfCountersMeasurement*)’:
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc:171:74: error: declaration of ‘name’ shadows a member of 'this' [-Werror=shadow]
internal::PerfCountersMeasurement* perf_counters_measurement)
^
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc: In member function ‘void benchmark::State::PauseTiming()’:
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc:249:26: error: declaration of ‘name’ shadows a member of 'this' [-Werror=shadow]
const std::string& name = name_and_measurement.first;
^
cc1plus: all warnings being treated as errors
gmake[2]: *** [src/CMakeFiles/benchmark.dir/benchmark.cc.o] Error 1
gmake[1]: *** [src/CMakeFiles/benchmark.dir/all] Error 2
gmake: *** [all] Error 2

@chengm349
Copy link
Author

[mcheng@sg1-ldev-pioneer benchmark]$ cmake320 --build "build" --config Release -v
/usr/local/cmake3.20/bin/cmake -S/fs02/home/mcheng/workspace/temp/benchmark -B/fs02/home/mcheng/workspace/temp/benchmark/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/cmake3.20/bin/cmake -E cmake_progress_start /fs02/home/mcheng/workspace/temp/benchmark/build/CMakeFiles /fs02/home/mcheng/workspace/temp/benchmark/build//CMakeFiles/progress.marks
/bin/gmake -f CMakeFiles/Makefile2 all
gmake[1]: Entering directory /fs02/home/mcheng/workspace/temp/benchmark/build' /bin/gmake -f src/CMakeFiles/benchmark.dir/build.make src/CMakeFiles/benchmark.dir/depend gmake[2]: Entering directory /fs02/home/mcheng/workspace/temp/benchmark/build'
cd /fs02/home/mcheng/workspace/temp/benchmark/build && /usr/local/cmake3.20/bin/cmake -E cmake_depends "Unix Makefiles" /fs02/home/mcheng/workspace/temp/benchmark /fs02/home/mcheng/workspace/temp/benchmark/src /fs02/home/mcheng/workspace/temp/benchmark/build /fs02/home/mcheng/workspace/temp/benchmark/build/src /fs02/home/mcheng/workspace/temp/benchmark/build/src/CMakeFiles/benchmark.dir/DependInfo.cmake --color=
Dependencies file "src/CMakeFiles/benchmark.dir/benchmark.cc.o.d" is newer than depends file "/fs02/home/mcheng/workspace/temp/benchmark/build/src/CMakeFiles/benchmark.dir/compiler_depend.internal".
Consolidate compiler generated dependencies of target benchmark
gmake[2]: Leaving directory /fs02/home/mcheng/workspace/temp/benchmark/build' /bin/gmake -f src/CMakeFiles/benchmark.dir/build.make src/CMakeFiles/benchmark.dir/build gmake[2]: Entering directory /fs02/home/mcheng/workspace/temp/benchmark/build'
[ 1%] Building CXX object src/CMakeFiles/benchmark.dir/benchmark.cc.o
cd /fs02/home/mcheng/workspace/temp/benchmark/build/src && /usr/lib64/ccache/c++ -DBENCHMARK_STATIC_DEFINE -DHAVE_POSIX_REGEX -DHAVE_STEADY_CLOCK -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DBENCHMARK_VERSION="v1.8.4-4-g7f0e99af" -I/fs02/home/mcheng/workspace/temp/benchmark/include -I/fs02/home/mcheng/workspace/temp/benchmark/src -Wall -Wextra -Wshadow -Wfloat-equal -Wold-style-cast -Wconversion -Werror -pedantic -pedantic-errors -fstrict-aliasing -Wno-deprecated-declarations -Wno-deprecated -Wstrict-aliasing -O3 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden -pthread -std=c++11 -MD -MT src/CMakeFiles/benchmark.dir/benchmark.cc.o -MF CMakeFiles/benchmark.dir/benchmark.cc.o.d -o CMakeFiles/benchmark.dir/benchmark.cc.o -c /fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc: In constructor ‘benchmark::State::State(std::string, benchmark::IterationCount, const std::vector&, int, int, benchmark::internal::ThreadTimer*, benchmark::internal::ThreadManager*, benchmark::internal::PerfCountersMeasurement*)’:
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc:171:74: error: declaration of ‘name’ shadows a member of 'this' [-Werror=shadow]
internal::PerfCountersMeasurement* perf_counters_measurement)
^
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc: In member function ‘void benchmark::State::PauseTiming()’:
/fs02/home/mcheng/workspace/temp/benchmark/src/benchmark.cc:249:26: error: declaration of ‘name’ shadows a member of 'this' [-Werror=shadow]
const std::string& name = name_and_measurement.first;
^
cc1plus: all warnings being treated as errors
gmake[2]: *** [src/CMakeFiles/benchmark.dir/benchmark.cc.o] Error 1
gmake[2]: Leaving directory /fs02/home/mcheng/workspace/temp/benchmark/build' gmake[1]: *** [src/CMakeFiles/benchmark.dir/all] Error 2 gmake[1]: Leaving directory /fs02/home/mcheng/workspace/temp/benchmark/build'
gmake: *** [all] Error 2

[mcheng@sg1-ldev-pioneer benchmark]$ /usr/lib64/ccache/c++ --version
c++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@LebedevRI
Copy link
Collaborator

g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)

Yeah that's quite ancient. It's unfortunate that we claim to support such old versions
without actually supporting them via the CI testing.

@chengm349
Copy link
Author

[mcheng@sg1-ldev-pioneer benchmark]$ setenv CXX /opt/rh/devtoolset-10/root/bin/c++
[mcheng@sg1-ldev-pioneer benchmark]$ cmake320 -DCMAKE_BUILD_TYPE=Release -S . -B "build" -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on

@chengm349
Copy link
Author

thanks. newer compiler solved the issue.

@dmah42
Copy link
Member

dmah42 commented Jun 7, 2024

g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)

Yeah that's quite ancient. It's unfortunate that we claim to support such old versions without actually supporting them via the CI testing.

we don't.

https://google.github.io/benchmark/dependencies.html -> https://opensource.google/documentation/policies/cplusplus-support#build_systems which says "we will drop support for our oldest supported C++ standard ... When 10 years pass since the standard's release date".

ie, as of 2024 we no longer support C++11 or older. C++14 was not supported in gcc 4.8.5 as far as i'm aware.

@LebedevRI
Copy link
Collaborator

LebedevRI commented Jun 7, 2024

https://github.com/google/benchmark/blob/83939d0bd447eaf958f2dc26aad8d08899d9dd0d/README.md#requirements says:

The following minimum versions are required to build the library:

  • GCC 4.8

@dmah42
Copy link
Member

dmah42 commented Jun 7, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants