absl::flat_hash_map sample program doesnt compile #1768
Unanswered
adsharma2309
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the issue
$ g++ -std=c++20 -I{installDir}/include helloworld.cpp -o out
/tmp/ccLPFfxw.o: In function
absl::container_internal::EmptyGroup()': helloworld.cpp:(.text._ZN4absl18container_internal10EmptyGroupEv[_ZN4absl18container_internal10EmptyGroupEv]+0x5): undefined reference to
absl::container_internal::kEmptyGroup'/tmp/ccLPFfxw.o: In function
absl::container_internal::SooControl()': helloworld.cpp:(.text._ZN4absl18container_internal10SooControlEv[_ZN4absl18container_internal10SooControlEv]+0x5): undefined reference to
absl::container_internal::kSooControl'/tmp/ccLPFfxw.o: In function
absl::container_internal::AssertIsFull(absl::container_internal::ctrl_t const*, unsigned char, unsigned char const*, char const*)': helloworld.cpp:(.text._ZN4absl18container_internal12AssertIsFullEPKNS0_6ctrl_tEhPKhPKc[_ZN4absl18container_internal12AssertIsFullEPKNS0_6ctrl_tEhPKhPKc]+0x62): undefined reference to
absl::raw_log_internal::RawLog(absl::LogSeverity, char const*, int, char const*, ...)'helloworld.cpp:(.text._ZN4absl18container_internal12AssertIsFullEPKNS0_6ctrl_tEhPKhPKc[_ZN4absl18container_internal12AssertIsFullEPKNS0_6ctrl_tEhPKhPKc]+0xc1): undefined reference to
absl::raw_log_internal::RawLog(absl::LogSeverity, char const*, int, char const*, ...)' helloworld.cpp:(.text._ZN4absl18container_internal12AssertIsFullEPKNS0_6ctrl_tEhPKhPKc[_ZN4absl18container_internal12AssertIsFullEPKNS0_6ctrl_tEhPKhPKc]+0x129): undefined reference to
absl::raw_log_internal::RawLog(absl::LogSeverity, char const*, int, char const*, ...)'helloworld.cpp:(.text._ZN4absl18container_internal12AssertIsFullEPKNS0_6ctrl_tEhPKhPKc[_ZN4absl18container_internal12AssertIsFullEPKNS0_6ctrl_tEhPKhPKc]+0x191): undefined reference to
absl::raw_log_internal::RawLog(absl::LogSeverity, char const*, int, char const*, ...)' helloworld.cpp:(.text._ZN4absl18container_internal12AssertIsFullEPKNS0_6ctrl_tEhPKhPKc[_ZN4absl18container_internal12AssertIsFullEPKNS0_6ctrl_tEhPKhPKc]+0x1f5): undefined reference to
absl::raw_log_internal::RawLog(absl::LogSeverity, char const*, int, char const*, ...)'/tmp/ccLPFfxw.o:helloworld.cpp:(.text._ZN4absl18container_internal26AssertIsValidForComparisonEPKNS0_6ctrl_tEhPKh[_ZN4absl18container_internal26AssertIsValidForComparisonEPKNS0_6ctrl_tEhPKh]+0x9f): more undefined references to
absl::raw_log_internal::RawLog(absl::LogSeverity, char const*, int, char const*, ...)' follow /tmp/ccLPFfxw.o: In function
absl::container_internal::raw_hash_set<absl::container_internal::FlatHashMapPolicy<int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, absl::hash_internal::Hash, std::equal_to, std::allocator<std::pair<int const, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > >::resize_impl(absl::container_internal::CommonFields&, unsigned long, absl::container_internal::HashtablezInfoHandle)::{lambda(absl::container_internal::map_slot_type<int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >)#1}::operator()(absl::container_internal::map_slot_type<int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >) const':helloworld.cpp:(.text.ZZN4absl18container_internal12raw_hash_setINS0_17FlatHashMapPolicyIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_13hash_internal4HashIiEESt8equal_toIiESaISt4pairIKiS8_EEE11resize_implERNS0_12CommonFieldsEmNS0_20HashtablezInfoHandleEENKUlPNS0_13map_slot_typeIiS8_EEE_clESP[ZZN4absl18container_internal12raw_hash_setINS0_17FlatHashMapPolicyIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_13hash_internal4HashIiEESt8equal_toIiESaISt4pairIKiS8_EEE11resize_implERNS0_12CommonFieldsEmNS0_20HashtablezInfoHandleEENKUlPNS0_13map_slot_typeIiS8_EEE_clESP]+0x5c): undefined reference to
absl::container_internal::FindInfo absl::container_internal::find_first_non_full<void>(absl::container_internal::CommonFields const&, unsigned long)' /tmp/ccLPFfxw.o: In function
bool absl::container_internal::HashSetResizeHelper::InitializeSlots<std::allocator, 40ul, false, false, 8ul>(absl::container_internal::CommonFields&, std::allocator, absl::container_internal::ctrl_t, unsigned long, unsigned long)':helloworld.cpp:(.text._ZN4absl18container_internal19HashSetResizeHelper15InitializeSlotsISaIcELm40ELb0ELb0ELm8EEEbRNS0_12CommonFieldsET_NS0_6ctrl_tEmm[_ZN4absl18container_internal19HashSetResizeHelper15InitializeSlotsISaIcELm40ELb0ELb0ELm8EEEbRNS0_12CommonFieldsET_NS0_6ctrl_tEmm]+0x1db): undefined reference to
absl::container_internal::HashSetResizeHelper::GrowIntoSingleGroupShuffleControlBytes(absl::container_internal::ctrl_t*, unsigned long) const' /tmp/ccLPFfxw.o: In function
std::pair<absl::container_internal::raw_hash_set<absl::container_internal::FlatHashMapPolicy<int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, absl::hash_internal::Hash, std::equal_to, std::allocator<std::pair<int const, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > >::iterator, bool> absl::container_internal::raw_hash_set<absl::container_internal::FlatHashMapPolicy<int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, absl::hash_internal::Hash, std::equal_to, std::allocator<std::pair<int const, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > >::find_or_prepare_insert_soo(int const&)':helloworld.cpp:(.text.ZN4absl18container_internal12raw_hash_setINS0_17FlatHashMapPolicyIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_13hash_internal4HashIiEESt8equal_toIiESaISt4pairIKiS8_EEE26find_or_prepare_insert_sooIiEESF_INSJ_8iteratorEbERKT[ZN4absl18container_internal12raw_hash_setINS0_17FlatHashMapPolicyIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_13hash_internal4HashIiEESt8equal_toIiESaISt4pairIKiS8_EEE26find_or_prepare_insert_sooIiEESF_INSJ_8iteratorEbERKT]+0x1a8): undefined reference to
absl::container_internal::PrepareInsertAfterSoo(unsigned long, unsigned long, absl::container_internal::CommonFields&)' /tmp/ccLPFfxw.o: In function
std::pair<absl::container_internal::raw_hash_set<absl::container_internal::FlatHashMapPolicy<int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, absl::hash_internal::Hash, std::equal_to, std::allocator<std::pair<int const, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > >::iterator, bool> absl::container_internal::raw_hash_set<absl::container_internal::FlatHashMapPolicy<int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, absl::hash_internal::Hash, std::equal_to, std::allocator<std::pair<int const, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > >::find_or_prepare_insert_non_soo(int const&)':helloworld.cpp:(.text.ZN4absl18container_internal12raw_hash_setINS0_17FlatHashMapPolicyIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_13hash_internal4HashIiEESt8equal_toIiESaISt4pairIKiS8_EEE30find_or_prepare_insert_non_sooIiEESF_INSJ_8iteratorEbERKT[ZN4absl18container_internal12raw_hash_setINS0_17FlatHashMapPolicyIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_13hash_internal4HashIiEESt8equal_toIiESaISt4pairIKiS8_EEE30find_or_prepare_insert_non_sooIiEESF_INSJ_8iteratorEbERKT]+0x302): undefined reference to
absl::container_internal::ShouldInsertBackwardsForDebug(unsigned long, unsigned long, absl::container_internal::ctrl_t const*)' helloworld.cpp:(.text._ZN4absl18container_internal12raw_hash_setINS0_17FlatHashMapPolicyIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_13hash_internal4HashIiEESt8equal_toIiESaISt4pairIKiS8_EEE30find_or_prepare_insert_non_sooIiEESF_INSJ_8iteratorEbERKT_[_ZN4absl18container_internal12raw_hash_setINS0_17FlatHashMapPolicyIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_13hash_internal4HashIiEESt8equal_toIiESaISt4pairIKiS8_EEE30find_or_prepare_insert_non_sooIiEESF_INSJ_8iteratorEbERKT_]+0x384): undefined reference to
absl::container_internal::PrepareInsertNonSoo(absl::container_internal::CommonFields&, unsigned long, absl::container_internal::FindInfo, absl::container_internal::PolicyFunctions const&)'/tmp/ccLPFfxw.o: In function
unsigned long absl::hash_internal::MixingHashState::hash<int, 0>(int)': helloworld.cpp:(.text._ZN4absl13hash_internal15MixingHashState4hashIiLi0EEEmT_[_ZN4absl13hash_internal15MixingHashState4hashIiLi0EEEmT_]+0xd): undefined reference to
absl::hash_internal::MixingHashState::kSeed'/tmp/ccLPFfxw.o:(.rodata._ZZN4absl18container_internal12raw_hash_setINS0_17FlatHashMapPolicyIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_13hash_internal4HashIiEESt8equal_toIiESaISt4pairIKiS8_EEE18GetPolicyFunctionsEvE5value[_ZZN4absl18container_internal12raw_hash_setINS0_17FlatHashMapPolicyIiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENS_13hash_internal4HashIiEESt8equal_toIiESaISt4pairIKiS8_EEE18GetPolicyFunctionsEvE5value]+0x8): undefined reference to `absl::container_internal::GetHashRefForEmptyHasher(absl::container_internal::CommonFields const&)'
collect2: error: ld returned 1 exit status
Any suggestions on what I am missing ,maybe some include libraries or a mistake at compilation step
The same helloworld program works fine when used btree_map instead of flat hash_map
Steps to reproduce the problem
checkout the source code, master branch and used cmake build system for compiling
a helloworld.cpp for flat_hash_map usage
$ g++ -std=c++20 -I{installDir}/include helloworld.cpp -o out
What version of Abseil are you using?
master branch
What operating system and version are you using?
CentOS Linux 7 (Core)
What compiler and version are you using?
gcc 11.3.0
What build system are you using?
cmake version 3.20.0
g++ 11.3.0
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions