failed to build unit test when -DNDEBUG flag is set
- Dominant language
- C++
- Stars
- 39.6k
- Forks
- 10.9k
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
Unit test build failed with -DNDEBUG. Building it with GCC 7.4 on Linux 2.6
uname -a
Linux uswxapacfc024.uspilcp.amrs.bankofamerica.com 2.6.32-754.9.1.el6.x86_64 #1 SMP Wed Nov 21 15:08:21 EST 2018 x86_64 x86_64 x86_64 GNU/Linux
**Below is the error:**
Scanning dependencies of target gmock-generated-actions_test
make -f _deps/googletest-build/googlemock/CMakeFiles/gmock-generated-actions_test.dir/build.make _deps/googletest-build/googlemock/CMakeFiles/gmock-generated-actions_test.dir/build
cd /data/local/local0/_zkn8etz_cmake_build/gmts/release/_deps/googletest-build/googlemock && /efs/dist/fsf/gcc/7.4.0/exec/bin/c++ -isystem /home/zkn8etz/source/third_party/googletest@master/googlemock/include -isystem /home/zkn8etz/source/third_party/googletest@master/googlemock -isystem /home/zkn8etz/source/third_party/googletest@master/googletest/include -isystem /home/zkn8etz/source/third_party/googletest@master/googletest -O2 -g -DNDEBUG -Wall -Wshadow -Werror -Wno-error=dangling-else -DGTEST_HAS_PTHREAD=1 -fexceptions -pthread -std=c++11 -o CMakeFiles/gmock-generated-actions_test.dir/test/gmock-generated-actions_test.cc.o -c /home/zkn8etz/source/third_party/googletest@master/googlemock/test/gmock-generated-actions_test.cc
In file included from /home/zkn8etz/source/third_party/googletest@master/googlemock/test/gmock-spec-builders_test.cc:35:0:
/home/zkn8etz/source/third_party/googletest@master/googlemock/include/gmock/gmock-spec-builders.h:1082:15: error: 'testing::Expectation testing::internal::TypedExpectation::GetHandle() [with F = {anonymous}::NonDefaultConstructible()]' declared 'static' but never defined [-Werror=unused-function]
Expectation GetHandle() override { return owner_->GetHandleOf(this); }
^~~~~~~~~
/home/zkn8etz/source/third_party/googletest@master/googlemock/include/gmock/gmock-spec-builders.h:1082:15: error: 'testing::Expectation testing::internal::TypedExpectation::GetHandle() [with F = void(bool, int, std::__cxx11::basic_string, void*, const {anonymous}::Printable&, {anonymous}::Unprintable)]' declared 'static' but never defined [-Werror=unused-function]
Contributor guide
Research direction
Start by reproducing the unit-test build with GCC 7.4, Linux, CMake, and -DNDEBUG, focusing on the gmock-generated-actions_test target. Read googlemock/include/gmock/gmock-spec-builders.h around TypedExpectation::GetHandle and the related test sources shown in the error. Done means the unit tests build successfully with -DNDEBUG and -Werror enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, linux
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100