You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to integrate a btree_multiset into our project. So far I haven't needed to build or link the abseil project itself, the btree types seem to be header-only for the most part (yay!).
However, once I got to testing I turned on ASan and ran into this compilation error:
/usr/bin/x86_64-pc-linux-gnu-ld.bfd: obj/blockmap_btree.o: in function `void absl::lts_20240116::container_internal::btree_iterator_generation_info_enabled::assert_valid_generation<absl::lts_20240116::container_internal::btree_node<absl::lts_20240116::container_internal::set_params<blockmap_btree_entry, std::less<blockmap_btree_entry>, std::allocator<blockmap_btree_entry>, 256, true> > >(absl::lts_20240116::container_internal::btree_node<absl::lts_20240116::container_internal::set_params<blockmap_btree_entry, std::less<blockmap_btree_entry>, std::allocator<blockmap_btree_entry>, 256, true> > const*) const':
/depot/out/Asan/../../vendor/abseil-cpp/absl/container/internal/btree.h:1082: undefined reference to `absl::lts_20240116::raw_log_internal::internal_log_function[abi:cxx11]'
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
I don't actually see any definition of internal_log_function, so I'm guessing it's generated or templated out somewhere during the full abseil build? In any case we don't need or want the logging at all, so I was hoping to basically
in our code. Unfortunately that leads to a 'ABSL_INTERNAL_LOG' macro redefined error since there's no #ifdef check first.
Since this is the only instance of logging in the btree types, I went ahead and swapped it out with an assert() that I think is more consistent with the rest of the btree code. Is there any interest in upstreaming this change and/or adding the ability to disable internal logging so that the btree containers can keep being header-only?
diff --git a/absl/container/internal/btree.h b/absl/container/internal/btree.h
index 91df57a3..d590e4a4 100644
--- a/absl/container/internal/btree.h
+++ b/absl/container/internal/btree.h
@@ -58,7 +58,6 @@
#include <type_traits>
#include <utility>
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
#include "absl/container/internal/common.h"
#include "absl/container/internal/common_policy_traits.h"
@@ -1078,12 +1077,9 @@ class btree_iterator_generation_info_enabled {
template <typename Node>
void assert_valid_generation(const Node *node) const {
- if (node != nullptr && node->generation() != generation_) {
- ABSL_INTERNAL_LOG(
- FATAL,
- "Attempting to use an invalidated iterator. The corresponding b-tree "
- "container has been mutated since this iterator was constructed.");
- }
+ // Attempting to use an invalidated iterator. The corresponding b-tree
+ // container has been mutated since this iterator was constructed.
+ assert(node == nullptr || node->generation() == generation_);
}
Steps to reproduce the problem
I tried to repro on godbolt.org, but that correctly links in the full library. I did a straight up git clone into my vendor/ folder and started using it without any build config:
Since you are using make instead of CMake and mention header-only, I'm going to guess that you forgot to link a library. But I can't help you since you did not provide reproduction instructions.
Describe the issue
I'm attempting to integrate a
btree_multiset
into our project. So far I haven't needed to build or link the abseil project itself, the btree types seem to be header-only for the most part (yay!).However, once I got to testing I turned on ASan and ran into this compilation error:
I don't actually see any definition of
internal_log_function
, so I'm guessing it's generated or templated out somewhere during the full abseil build? In any case we don't need or want the logging at all, so I was hoping to basicallyin our code. Unfortunately that leads to a
'ABSL_INTERNAL_LOG' macro redefined
error since there's no#ifdef
check first.Since this is the only instance of logging in the btree types, I went ahead and swapped it out with an
assert()
that I think is more consistent with the rest of the btree code. Is there any interest in upstreaming this change and/or adding the ability to disable internal logging so that the btree containers can keep being header-only?Steps to reproduce the problem
I tried to repro on godbolt.org, but that correctly links in the full library. I did a straight up
git clone
into myvendor/
folder and started using it without any build config:What version of Abseil are you using?
20240116.2
What operating system and version are you using?
Linux, custom Gentoo
What compiler and version are you using?
What build system are you using?
Additional context
No response
The text was updated successfully, but these errors were encountered: