google / benchmark

A microbenchmark support library
Apache License 2.0
8.94k stars 1.62k forks source link

Failed to build #1678

Closed chengm204 closed 11 months ago

chengm204 commented 11 months ago

Describe the bug I followed https://github.com/google/benchmark make/build guide. Got some error.

System Which OS, compiler, and compiler version are you using: Linux sg1-ldev-pioneer 3.10.0-1160.99.1.el7.x86_64 #1 SMP Thu Aug 10 10:46:21 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux

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.

I sent command cmake320 -DCMAKE_BUILD_TYPE=Release -S . -B "build" ..... [100%] Completed 'googletest' [100%] Built target googletest -- The C compiler identification is GNU 4.8.5 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/lib64/ccache/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Found Python: /bin/python3.6 (found version "3.6.8") found components: Interpreter -- Performing Test BENCHMARK_HAS_O3_FLAG -- Performing Test BENCHMARK_HAS_O3_FLAG - Success -- Performing Test BENCHMARK_HAS_DEPRECATED_DECLARATIONS_FLAG -- Performing Test BENCHMARK_HAS_DEPRECATED_DECLARATIONS_FLAG - Success -- Performing Test BENCHMARK_HAS_WNO_ODR -- Performing Test BENCHMARK_HAS_WNO_ODR - Success -- Performing Test BENCHMARK_HAS_WNO_LTO_TYPE_MISMATCH -- Performing Test BENCHMARK_HAS_WNO_LTO_TYPE_MISMATCH - Success -- Configuring done -- Generating done -- Build files have been written to: /fs02/home/mcheng/workspace/temp/benchmark/build $ cmake320 --build "build" --config Release [ 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:163: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:241: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

dmah42 commented 11 months ago

edited because i learned something

we enable -Werror by default except for PGI and NVHPC compilers. given our CI jobs aren't catching these errors i'm a bit confused.

can you share more about your project configuration?

chengm204 commented 11 months ago

Glad to know that. Please let me know when it's ready.

On Thu, 12 Oct 2023, 21:32 dominic, @.***> wrote:

adding a new CI job to try to catch any new warnings in #1679 https://github.com/google/benchmark/pull/1679

— Reply to this email directly, view it on GitHub https://github.com/google/benchmark/issues/1678#issuecomment-1759620988, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCWSL2ALC3ZBCE3I37RJGGDX67WODANCNFSM6AAAAAA55GUJOQ . You are receiving this because you authored the thread.Message ID: @.***>

chengm204 commented 11 months ago

I did these:

$ git clone https://github.com/google/benchmark.git $ cd benchmark $ cmake -E make_directory "build" // my cmake version is 3.20

cmake -DCMAKE_BUILD_TYPE=Release -S . -B "build"

Build the library.

$ cmake --build "build" --config Release

Then I encountered the reported error. It's a standalone project and just want to generated the library for other project to use.

chengm204 commented 11 months ago

I deleted "benchmark" folder on my server and git clone one more time.

result.txt

command "cmake320 -DCMAKE_BUILD_TYPE=Release -S . -B "build" " result is attached.

chengm204 commented 11 months ago

solved the problem. version 4.8.5 does not work. need newer gcc version