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

Problem with absl #1268

Closed
PawBlo opened this issue Aug 20, 2024 · 2 comments
Closed

Problem with absl #1268

PawBlo opened this issue Aug 20, 2024 · 2 comments

Comments

@PawBlo
Copy link

PawBlo commented Aug 20, 2024

I have problem to compile & run alpha_zero_torch_example.cc. I build open_spiel from source. When I try to build
clang++ -I${HOME}/open_spiel -I${HOME}/open_spiel/open_spiel/abseil-cpp -std=c++17 -o az alpha_zero_torch_example.cc -L${HOME}/open_spiel/build -lopen_spiel
alpha_zero_torch_example.cc i get this error:

/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `main':
alpha_zero_torch_example.cc:(.text+0xb5): undefined reference to `absl::lts_20230125::ParseCommandLine(int, char**)'
/usr/bin/ld: alpha_zero_torch_example.cc:(.text+0x95d): undefined reference to `open_spiel::algorithms::torch_az::AlphaZero(open_spiel::algorithms::torch_az::AlphaZeroConfig, open_spiel::StopToken*, bool)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `absl::lts_20230125::flags_internal::FlagRegistrar<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, true>::FlagRegistrar(absl::lts_20230125::flags_internal::Flag<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >&, char const*)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012514flags_internal13FlagRegistrarINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb1EEC2ERNS1_4FlagIS8_EEPKc[_ZN4absl12lts_2023012514flags_internal13FlagRegistrarINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb1EEC2ERNS1_4FlagIS8_EEPKc]+0x27): undefined reference to `absl::lts_20230125::flags_internal::RegisterCommandLineFlag(absl::lts_20230125::CommandLineFlag&, char const*)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `absl::lts_20230125::flags_internal::FlagRegistrar<int, true>::FlagRegistrar(absl::lts_20230125::flags_internal::Flag<int>&, char const*)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012514flags_internal13FlagRegistrarIiLb1EEC2ERNS1_4FlagIiEEPKc[_ZN4absl12lts_2023012514flags_internal13FlagRegistrarIiLb1EEC2ERNS1_4FlagIiEEPKc]+0x27): undefined reference to `absl::lts_20230125::flags_internal::RegisterCommandLineFlag(absl::lts_20230125::CommandLineFlag&, char const*)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `absl::lts_20230125::flags_internal::FlagRegistrar<double, true>::FlagRegistrar(absl::lts_20230125::flags_internal::Flag<double>&, char const*)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012514flags_internal13FlagRegistrarIdLb1EEC2ERNS1_4FlagIdEEPKc[_ZN4absl12lts_2023012514flags_internal13FlagRegistrarIdLb1EEC2ERNS1_4FlagIdEEPKc]+0x27): undefined reference to `absl::lts_20230125::flags_internal::RegisterCommandLineFlag(absl::lts_20230125::CommandLineFlag&, char const*)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `absl::lts_20230125::flags_internal::FlagRegistrar<bool, true>::FlagRegistrar(absl::lts_20230125::flags_internal::Flag<bool>&, char const*)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012514flags_internal13FlagRegistrarIbLb1EEC2ERNS1_4FlagIbEEPKc[_ZN4absl12lts_2023012514flags_internal13FlagRegistrarIbLb1EEC2ERNS1_4FlagIbEEPKc]+0x27): undefined reference to `absl::lts_20230125::flags_internal::RegisterCommandLineFlag(absl::lts_20230125::CommandLineFlag&, char const*)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `bool absl::lts_20230125::flags_internal::InvokeParseFlag<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012514flags_internal15InvokeParseFlagINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEbSt17basic_string_viewIcS6_EPT_PS8_[_ZN4absl12lts_2023012514flags_internal15InvokeParseFlagINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEbSt17basic_string_viewIcS6_EPT_PS8_]+0x39): undefined reference to `absl::lts_20230125::flags_internal::AbslParseFlag(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > absl::lts_20230125::flags_internal::Unparse<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012514flags_internal7UnparseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEES8_RKT_[_ZN4absl12lts_2023012514flags_internal7UnparseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEES8_RKT_]+0x39): undefined reference to `absl::lts_20230125::flags_internal::AbslUnparseFlag[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > absl::lts_20230125::UnparseFlag<int>(int const&)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012511UnparseFlagIiEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_[_ZN4absl12lts_2023012511UnparseFlagIiEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_]+0x21): undefined reference to `absl::lts_20230125::flags_internal::Unparse[abi:cxx11](int)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `bool absl::lts_20230125::flags_internal::InvokeParseFlag<int>(std::basic_string_view<char, std::char_traits<char> >, int*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012514flags_internal15InvokeParseFlagIiEEbSt17basic_string_viewIcSt11char_traitsIcEEPT_PNSt7__cxx1112basic_stringIcS5_SaIcEEE[_ZN4absl12lts_2023012514flags_internal15InvokeParseFlagIiEEbSt17basic_string_viewIcSt11char_traitsIcEEPT_PNSt7__cxx1112basic_stringIcS5_SaIcEEE]+0x39): undefined reference to `absl::lts_20230125::flags_internal::AbslParseFlag(std::basic_string_view<char, std::char_traits<char> >, int*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > absl::lts_20230125::UnparseFlag<double>(double const&)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012511UnparseFlagIdEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_[_ZN4absl12lts_2023012511UnparseFlagIdEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_]+0x23): undefined reference to `absl::lts_20230125::flags_internal::Unparse[abi:cxx11](double)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `bool absl::lts_20230125::flags_internal::InvokeParseFlag<double>(std::basic_string_view<char, std::char_traits<char> >, double*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012514flags_internal15InvokeParseFlagIdEEbSt17basic_string_viewIcSt11char_traitsIcEEPT_PNSt7__cxx1112basic_stringIcS5_SaIcEEE[_ZN4absl12lts_2023012514flags_internal15InvokeParseFlagIdEEbSt17basic_string_viewIcSt11char_traitsIcEEPT_PNSt7__cxx1112basic_stringIcS5_SaIcEEE]+0x39): undefined reference to `absl::lts_20230125::flags_internal::AbslParseFlag(std::basic_string_view<char, std::char_traits<char> >, double*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > absl::lts_20230125::UnparseFlag<bool>(bool const&)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012511UnparseFlagIbEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_[_ZN4absl12lts_2023012511UnparseFlagIbEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_]+0x26): undefined reference to `absl::lts_20230125::flags_internal::Unparse[abi:cxx11](bool)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `bool absl::lts_20230125::flags_internal::InvokeParseFlag<bool>(std::basic_string_view<char, std::char_traits<char> >, bool*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
alpha_zero_torch_example.cc:(.text._ZN4absl12lts_2023012514flags_internal15InvokeParseFlagIbEEbSt17basic_string_viewIcSt11char_traitsIcEEPT_PNSt7__cxx1112basic_stringIcS5_SaIcEEE[_ZN4absl12lts_2023012514flags_internal15InvokeParseFlagIbEEbSt17basic_string_viewIcSt11char_traitsIcEEPT_PNSt7__cxx1112basic_stringIcS5_SaIcEEE]+0x39): undefined reference to `absl::lts_20230125::flags_internal::AbslParseFlag(std::basic_string_view<char, std::char_traits<char> >, bool*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `absl::lts_20230125::flags_internal::Flag<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::Get() const':
alpha_zero_torch_example.cc:(.text._ZNK4absl12lts_2023012514flags_internal4FlagINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE3GetEv[_ZNK4absl12lts_2023012514flags_internal4FlagINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE3GetEv]+0x40): undefined reference to `absl::lts_20230125::flags_internal::FlagImpl::AssertValidType(void const*, std::type_info const* (*)()) const'
/usr/bin/ld: alpha_zero_torch_example.cc:(.text._ZNK4absl12lts_2023012514flags_internal4FlagINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE3GetEv[_ZNK4absl12lts_2023012514flags_internal4FlagINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE3GetEv]+0x84): undefined reference to `absl::lts_20230125::flags_internal::FlagImpl::Read(void*) const'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `absl::lts_20230125::flags_internal::Flag<int>::Get() const':
alpha_zero_torch_example.cc:(.text._ZNK4absl12lts_2023012514flags_internal4FlagIiE3GetEv[_ZNK4absl12lts_2023012514flags_internal4FlagIiE3GetEv]+0x31): undefined reference to `absl::lts_20230125::flags_internal::FlagImpl::AssertValidType(void const*, std::type_info const* (*)()) const'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `void absl::lts_20230125::flags_internal::FlagImpl::Read<int, 0>(int*) const':
alpha_zero_torch_example.cc:(.text._ZNK4absl12lts_2023012514flags_internal8FlagImpl4ReadIiLi0EEEvPT_[_ZNK4absl12lts_2023012514flags_internal8FlagImpl4ReadIiLi0EEEvPT_]+0x15): undefined reference to `absl::lts_20230125::flags_internal::FlagImpl::ReadOneWord() const'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `absl::lts_20230125::flags_internal::Flag<bool>::Get() const':
alpha_zero_torch_example.cc:(.text._ZNK4absl12lts_2023012514flags_internal4FlagIbE3GetEv[_ZNK4absl12lts_2023012514flags_internal4FlagIbE3GetEv]+0x31): undefined reference to `absl::lts_20230125::flags_internal::FlagImpl::AssertValidType(void const*, std::type_info const* (*)()) const'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `absl::lts_20230125::flags_internal::FlagImpl::Read(bool*) const':
alpha_zero_torch_example.cc:(.text._ZNK4absl12lts_2023012514flags_internal8FlagImpl4ReadEPb[_ZNK4absl12lts_2023012514flags_internal8FlagImpl4ReadEPb]+0x15): undefined reference to `absl::lts_20230125::flags_internal::FlagImpl::ReadOneBool() const'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `absl::lts_20230125::flags_internal::Flag<double>::Get() const':
alpha_zero_torch_example.cc:(.text._ZNK4absl12lts_2023012514flags_internal4FlagIdE3GetEv[_ZNK4absl12lts_2023012514flags_internal4FlagIdE3GetEv]+0x31): undefined reference to `absl::lts_20230125::flags_internal::FlagImpl::AssertValidType(void const*, std::type_info const* (*)()) const'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o: in function `void absl::lts_20230125::flags_internal::FlagImpl::Read<double, 0>(double*) const':
alpha_zero_torch_example.cc:(.text._ZNK4absl12lts_2023012514flags_internal8FlagImpl4ReadIdLi0EEEvPT_[_ZNK4absl12lts_2023012514flags_internal8FlagImpl4ReadIdLi0EEEvPT_]+0x15): undefined reference to `absl::lts_20230125::flags_internal::FlagImpl::ReadOneWord() const'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o:(.data+0x0): undefined reference to `vtable for absl::lts_20230125::flags_internal::FlagImpl'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o:(.data+0x70): undefined reference to `vtable for absl::lts_20230125::flags_internal::FlagImpl'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o:(.data+0xe0): undefined reference to `vtable for absl::lts_20230125::flags_internal::FlagImpl'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o:(.data+0x150): undefined reference to `vtable for absl::lts_20230125::flags_internal::FlagImpl'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o:(.data+0x1c0): undefined reference to `vtable for absl::lts_20230125::flags_internal::FlagImpl'
/usr/bin/ld: /tmp/alpha_zero_torch_example-8f9c6c.o:(.data+0x218): more undefined references to `vtable for absl::lts_20230125::flags_internal::FlagImpl' follow
  1. How to solve this problem?
  2. Do you have any specific requirements for the library to ensure everything works properly? Like Ubuntu version, cuda version, tensorflow version, clang version, ld version?
    My env:
    open_spiel - master
    Ubuntu 22.04.4 LTS
    GNU ld (GNU Binutils for Ubuntu) 2.38
    Python 3.10.12
    Ubuntu clang version 14.0.0-1ubuntu1.1
@lanctot
Copy link
Collaborator

lanctot commented Aug 20, 2024

Yes, this is a known problem. There is a solution described in here: #966, but it would be good to finally fix this properly.

@lanctot lanctot closed this as completed Sep 23, 2024
@lanctot
Copy link
Collaborator

lanctot commented Sep 23, 2024

Closing due to inactivity, please re-open if you want to follow-up.

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