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

Can not compile with clang 16 and libc++ #2241

Closed
owent opened this issue Jul 20, 2023 · 0 comments · Fixed by #2242
Closed

Can not compile with clang 16 and libc++ #2241

owent opened this issue Jul 20, 2023 · 0 comments · Fixed by #2242
Labels
bug Something isn't working

Comments

@owent
Copy link
Member

owent commented Jul 20, 2023

Describe your environment

OS: Linux
Compiler: Clang 16.0.6 with libc++

What is the actual behavior?

[ 50%] Building CXX object sdk/src/logs/CMakeFiles/opentelemetry_logs.dir/simple_log_record_processor_factory.cc.o
In file included from /data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/src/logs/simple_log_record_processor_factory.cc:6:
In file included from /data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h:8:
In file included from /opt/llvm-16.0/bin/../include/c++/v1/memory:898:
In file included from /opt/llvm-16.0/bin/../include/c++/v1/__memory/shared_ptr.h:31:
/opt/llvm-16.0/bin/../include/c++/v1/__memory/unique_ptr.h:63:19: error: invalid application of 'sizeof' to an incomplete type 'opentelemetry::sdk::logs::LogRecordExporter'
    static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
                  ^~~~~~~~~~~
/opt/llvm-16.0/bin/../include/c++/v1/__memory/unique_ptr.h:297:7: note: in instantiation of member function 'std::default_delete<opentelemetry::sdk::logs::LogRecordExporter>::operator()' requested here
      __ptr_.second()(__tmp);
      ^
/opt/llvm-16.0/bin/../include/c++/v1/__memory/unique_ptr.h:263:75: note: in instantiation of member function 'std::unique_ptr<opentelemetry::sdk::logs::LogRecordExporter>::reset' requested here
  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
                                                                          ^
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h:36:3: note: in instantiation of member function 'std::unique_ptr<opentelemetry::sdk::logs::LogRecordExporter
>::~unique_ptr' requested here
  ~SimpleLogRecordProcessor() override = default;
  ^
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h:36:3: note: in defaulted destructor for 'opentelemetry::sdk::logs::SimpleLogRecordProcessor' first required 
here
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h:17:7: note: forward declaration of 'opentelemetry::sdk::logs::LogRecordExporter'
class LogRecordExporter;
      ^
1 error generated.
gmake[2]: *** [sdk/src/logs/CMakeFiles/opentelemetry_logs.dir/build.make:188: sdk/src/logs/CMakeFiles/opentelemetry_logs.dir/simple_log_record_processor_factory.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:615: sdk/src/logs/CMakeFiles/opentelemetry_logs.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
'/opt/cmake/bin/cmake' '--build' '.'

[ 29%] Building CXX object sdk/src/metrics/CMakeFiles/opentelemetry_metrics.dir/data/circular_buffer.cc.o
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/src/metrics/data/circular_buffer.cc:58:5: error: no matching function for call to 'fill'
    std::fill(backing.begin(), backing.end(), static_cast<T>(0));
    ^~~~~~~~~
/opt/llvm-16.0/bin/../include/c++/v1/__functional/invoke.h:394:23: note: in instantiation of function template specialization 'opentelemetry::sdk::metrics::(anonymous namespace)::AdaptingIntegerArrayClear::operator()<unsigned char>' requested 
here
    { return          static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
                      ^
/opt/llvm-16.0/bin/../include/c++/v1/__bit_reference:422:1: note: candidate template ignored: could not match '__bit_iterator' against '__wrap_iter'
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value)
^
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/src/metrics/data/circular_buffer.cc:58:5: error: no matching function for call to 'fill'
    std::fill(backing.begin(), backing.end(), static_cast<T>(0));
    ^~~~~~~~~
/opt/llvm-16.0/bin/../include/c++/v1/__functional/invoke.h:394:23: note: in instantiation of function template specialization 'opentelemetry::sdk::metrics::(anonymous namespace)::AdaptingIntegerArrayClear::operator()<unsigned short>' requested
 here
    { return          static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
                      ^
/opt/llvm-16.0/bin/../include/c++/v1/__bit_reference:422:1: note: candidate template ignored: could not match '__bit_iterator' against '__wrap_iter'
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value)
^
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/src/metrics/data/circular_buffer.cc:58:5: error: no matching function for call to 'fill'
    std::fill(backing.begin(), backing.end(), static_cast<T>(0));
    ^~~~~~~~~
/opt/llvm-16.0/bin/../include/c++/v1/__functional/invoke.h:394:23: note: in instantiation of function template specialization 'opentelemetry::sdk::metrics::(anonymous namespace)::AdaptingIntegerArrayClear::operator()<unsigned int>' requested h
ere
    { return          static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
                      ^
/opt/llvm-16.0/bin/../include/c++/v1/__bit_reference:422:1: note: candidate template ignored: could not match '__bit_iterator' against '__wrap_iter'
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value)
^
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/src/metrics/data/circular_buffer.cc:58:5: error: no matching function for call to 'fill'
    std::fill(backing.begin(), backing.end(), static_cast<T>(0));
    ^~~~~~~~~
/opt/llvm-16.0/bin/../include/c++/v1/__functional/invoke.h:394:23: note: in instantiation of function template specialization 'opentelemetry::sdk::metrics::(anonymous namespace)::AdaptingIntegerArrayClear::operator()<unsigned long>' requested 
here
    { return          static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
                      ^
/opt/llvm-16.0/bin/../include/c++/v1/__bit_reference:422:1: note: candidate template ignored: could not match '__bit_iterator' against '__wrap_iter'
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value)
^
4 errors generated.
gmake[2]: *** [sdk/src/metrics/CMakeFiles/opentelemetry_metrics.dir/build.make:328: sdk/src/metrics/CMakeFiles/opentelemetry_metrics.dir/data/circular_buffer.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:588: sdk/src/metrics/CMakeFiles/opentelemetry_metrics.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
'/opt/cmake/bin/cmake' '--build' '.' '--verbose'

Additional context

The problem of std::fill may be the BUG of libc++.But we may use std::vector::assign to avoid this problem.

@owent owent added the bug Something isn't working label Jul 20, 2023
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jul 20, 2023
@marcalff marcalff removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants