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

Cannot compile in g++ environment #352

Closed
dust1 opened this issue Nov 3, 2023 · 3 comments
Closed

Cannot compile in g++ environment #352

dust1 opened this issue Nov 3, 2023 · 3 comments

Comments

@dust1
Copy link

dust1 commented Nov 3, 2023

Expected behavior

compile fail in g++-13, If it is g++-12, it still can't compiled.

Actual behavior

compile fail

Steps to reproduce the behavior

gcc & g++ version

gcc (Debian 13.2.0-4) 13.2.0
g++ (Debian 13.2.0-4) 13.2.0
gcc (Debian 12.2.0-9) 12.2.0
g++ (Debian 12.2.0-9) 12.2.0

error log:

  CC       options/customizable_test.o
In file included from /usr/include/c++/13/functional:59,
                 from ./db/db_impl/db_impl.h:13,
                 from ./db/db_test_util.h:24,
                 from options/customizable_test.cc:17:
In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = rocksdb::Status; _ArgTypes = {const rocksdb::ConfigOptions&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, void*}]’,
    inlined from ‘rocksdb::OptionTypeInfo::OptionTypeInfo(int, rocksdb::OptionType, rocksdb::OptionVerificationType, rocksdb::OptionTypeFlags, const rocksdb::ParseFunc&, const rocksdb::SerializeFunc&, const rocksdb::EqualsFunc&)’ at ./include/rocksdb/utilities/options_type.h:240:9,
    inlined from ‘static rocksdb::OptionTypeInfo rocksdb::OptionTypeInfo::AsCustomSharedPtr(int, rocksdb::OptionVerificationType, rocksdb::OptionTypeFlags, const rocksdb::SerializeFunc&, const rocksdb::EqualsFunc&) [with T = rocksdb::{anonymous}::TestCustomizable]’ at ./include/rocksdb/utilities/options_type.h:441:36,
    inlined from ‘static rocksdb::OptionTypeInfo rocksdb::OptionTypeInfo::AsCustomSharedPtr(int, rocksdb::OptionVerificationType, rocksdb::OptionTypeFlags) [with T = rocksdb::{anonymous}::TestCustomizable]’ at ./include/rocksdb/utilities/options_type.h:419:69:
/usr/include/c++/13/bits/std_function.h:391:17: error: ‘<anonymous>’ may be used uninitialized [-Werror=maybe-uninitialized]
  391 |             __x._M_manager(_M_functor, __x._M_functor, __clone_functor);
      |             ~~~~^~~~~~~~~~
/usr/include/c++/13/bits/std_function.h: In function ‘static rocksdb::OptionTypeInfo rocksdb::OptionTypeInfo::AsCustomSharedPtr(int, rocksdb::OptionVerificationType, rocksdb::OptionTypeFlags) [with T = rocksdb::{anonymous}::TestCustomizable]’:
/usr/include/c++/13/bits/std_function.h:267:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = rocksdb::Status; _Functor = rocksdb::OptionTypeInfo::AsCustomSharedPtr<rocksdb::{anonymous}::TestCustomizable>(int, rocksdb::OptionVerificationType, rocksdb::OptionTypeFlags, const rocksdb::SerializeFunc&, const rocksdb::EqualsFunc&)::<lambda(const rocksdb::ConfigOptions&, const std::string&, const std::string&, void*)>; _ArgTypes = {const rocksdb::ConfigOptions&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, void*}]’ declared here
  267 |       _M_manager(_Any_data& __dest, const _Any_data& __source,
      |       ^~~~~~~~~~
In file included from ./monitoring/statistics_impl.h:19,
                 from ./monitoring/statistics.h:10,
                 from ./monitoring/perf_step_timer.h:9,
                 from ./monitoring/perf_context_imp.h:7,
                 from ./util/user_comparator_wrapper.h:11,
                 from ./db/dbformat.h:22,
                 from ./db/memtable.h:20,
                 from ./db/memtable_list.h:16,
                 from ./db/column_family.h:17,
                 from ./db/db_impl/db_impl.h:22:
./include/rocksdb/utilities/options_type.h:428:12: note: ‘<anonymous>’ declared here
  428 |     return OptionTypeInfo(
      |            ^~~~~~~~~~~~~~~
  429 |         offset, OptionType::kCustomizable, ovt,
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  430 |         flags | OptionTypeFlags::kShared,
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  431 |         [](const ConfigOptions& opts, const std::string& name,
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  432 |            const std::string& value, void* addr) {
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  433 |           auto* shared = static_cast<std::shared_ptr<T>*>(addr);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  434 |           if (name == kIdPropName() && value.empty()) {
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  435 |             shared->reset();
      |             ~~~~~~~~~~~~~~~~
  436 |             return Status::OK();
      |             ~~~~~~~~~~~~~~~~~~~~
  437 |           } else {
      |           ~~~~~~~~
  438 |             return T::CreateFromString(opts, value, shared);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  439 |           }
      |           ~
  440 |         },
      |         ~~
  441 |         serialize_func, equals_func);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make: *** [Makefile:2466: options/customizable_test.o] Error 1

@Connor1996
Copy link
Member

looks like facebook#9633 You can work around it

@dust1
Copy link
Author

dust1 commented Nov 3, 2023

After I use DISABLE_WARNING_AS_ERROR=1 can compile😀.
Will this problem be solved in the future? ceresdb depends on it and cannot be compiled in a gcc-13 environment

@dust1 dust1 closed this as completed Nov 7, 2023
@Connor1996
Copy link
Member

We have no enviorment for reproducing this, welcome to file a PR to fix it

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