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

Debug build failure: gtest_label_1081 used but not defined #159

Closed
wjywbs opened this issue Aug 15, 2018 · 2 comments
Closed

Debug build failure: gtest_label_1081 used but not defined #159

wjywbs opened this issue Aug 15, 2018 · 2 comments
Assignees

Comments

@wjywbs
Copy link

wjywbs commented Aug 15, 2018

ubuntu 16.04, default gcc 5.4

git clone https://github.com/abseil/abseil-cpp.git
cd abseil-cpp
bazel build ...
ERROR: abseil-cpp/absl/strings/BUILD.bazel:235:1: C++ compilation of rule '//absl/strings:string_view_test' failed (Exit 1)
In file included from external/com_google_googletest/googletest/include/gtest/gtest.h:58:0,
                 from absl/strings/string_view_test.cc:28:
absl/strings/string_view_test.cc: In member function 'virtual void {anonymous}::NonNegativeLenTest_NonNegativeLen_Test::TestBody()':
absl/strings/string_view_test.cc:38:40: error: label 'gtest_label_1081' used but not defined
 #define ABSL_EXPECT_DEATH_IF_SUPPORTED EXPECT_DEATH_IF_SUPPORTED
                                        ^
absl/strings/string_view_test.cc:1080:3: note: in expansion of macro 'ABSL_EXPECT_DEATH_IF_SUPPORTED'
   ABSL_EXPECT_DEATH_IF_SUPPORTED(absl::string_view("xyz", -1),
   ^
absl/strings/string_view_test.cc: In member function 'virtual void {anonymous}::LenExceedsMaxSizeTest_LenExceedsMaxSize_Test::TestBody()':
absl/strings/string_view_test.cc:38:40: error: label 'gtest_label_1092' used but not defined
 #define ABSL_EXPECT_DEATH_IF_SUPPORTED EXPECT_DEATH_IF_SUPPORTED
                                        ^
absl/strings/string_view_test.cc:1091:3: note: in expansion of macro 'ABSL_EXPECT_DEATH_IF_SUPPORTED'
   ABSL_EXPECT_DEATH_IF_SUPPORTED(absl::string_view("", max_size + 1),
   ^

git bisect shows 99477fa is the first bad commit.

This is a quick fix:

diff --git a/absl/strings/str_cat_test.cc b/absl/strings/str_cat_test.cc
index e9d67690..9c6e4df1 100644
--- a/absl/strings/str_cat_test.cc
+++ b/absl/strings/str_cat_test.cc
@@ -405,8 +405,7 @@ TEST(StrAppend, Death) {
   std::string s = "self";
   // on linux it's "assertion", on mac it's "Assertion",
   // on chromiumos it's "Assertion ... failed".
-  ABSL_EXPECT_DEBUG_DEATH(absl::StrAppend(&s, s.c_str() + 1),
-                          "ssertion.*failed");
+  ABSL_EXPECT_DEBUG_DEATH(absl::StrAppend(&s, s.c_str() + 1), "ssertion.*failed");
   ABSL_EXPECT_DEBUG_DEATH(absl::StrAppend(&s, s), "ssertion.*failed");
 }
 #endif  // GTEST_HAS_DEATH_TEST
diff --git a/absl/strings/string_view_test.cc b/absl/strings/string_view_test.cc
index fffa7b99..9fecf655 100644
--- a/absl/strings/string_view_test.cc
+++ b/absl/strings/string_view_test.cc
@@ -1077,8 +1077,7 @@ TEST(HugeStringView, TwoPointTwoGB) {
 
 #if !defined(NDEBUG) && !defined(ABSL_HAVE_STD_STRING_VIEW)
 TEST(NonNegativeLenTest, NonNegativeLen) {
-  ABSL_EXPECT_DEATH_IF_SUPPORTED(absl::string_view("xyz", -1),
-                                 "len <= kMaxSize");
+  ABSL_EXPECT_DEATH_IF_SUPPORTED(absl::string_view("xyz", -1), "len <= kMaxSize");
 }
 
 TEST(LenExceedsMaxSizeTest, LenExceedsMaxSize) {
@@ -1088,8 +1087,7 @@ TEST(LenExceedsMaxSizeTest, LenExceedsMaxSize) {
   absl::string_view ok_view("", max_size);
 
   // Adding one to the max should trigger an assertion.
-  ABSL_EXPECT_DEATH_IF_SUPPORTED(absl::string_view("", max_size + 1),
-                                 "len <= kMaxSize");
+  ABSL_EXPECT_DEATH_IF_SUPPORTED(absl::string_view("", max_size + 1), "len <= kMaxSize");
 }
 #endif  // !defined(NDEBUG) && !defined(ABSL_HAVE_STD_STRING_VIEW)
 
@derekmauro
Copy link
Member

Thanks for the report. I've managed to reproduce this in a VM. I have no idea why it doesn't reproduce on any of the compilers I normally use.

I have a different fix in mind though:
#define ABSL_EXPECT_DEATH_IF_SUPPORTED EXPECT_DEATH_IF_SUPPORTED
becomes
#define ABSL_EXPECT_DEATH_IF_SUPPORTED(s, r) EXPECT_DEATH_IF_SUPPORTED(s, r)

@derekmauro derekmauro self-assigned this Aug 17, 2018
absl-federation-github pushed a commit that referenced this issue Aug 20, 2018
--
c508ee8bcc38dad1019c0ad744c47ac70efd36b7 by Derek Mauro <dmauro@google.com>:

Opensource the Linux specific SpinLock Wait/Wake implementation.

PiperOrigin-RevId: 209420888

--
c13113e19973d496f3e798c0e6d5569c78e41466 by Derek Mauro <dmauro@google.com>:

Fix build error from #159

PiperOrigin-RevId: 209152118
GitOrigin-RevId: c508ee8bcc38dad1019c0ad744c47ac70efd36b7
Change-Id: I1a287df973198f9e26936d8f91031bb354db0c71
@derekmauro
Copy link
Member

Fixed by d8cfe9f.

4s5t2os41n added a commit to 4s5t2os41n/abseil-cpp that referenced this issue Jul 4, 2024
--
c508ee8bcc38dad1019c0ad744c47ac70efd36b7 by Derek Mauro <dmauro@google.com>:

Opensource the Linux specific SpinLock Wait/Wake implementation.

PiperOrigin-RevId: 209420888

--
c13113e19973d496f3e798c0e6d5569c78e41466 by Derek Mauro <dmauro@google.com>:

Fix build error from abseil/abseil-cpp#159

PiperOrigin-RevId: 209152118
GitOrigin-RevId: c508ee8bcc38dad1019c0ad744c47ac70efd36b7
Change-Id: I1a287df973198f9e26936d8f91031bb354db0c71
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

2 participants