SkyAPM / cpp2sky

Distributed tracing and monitor SDK in CPP for Apache SkyWalking APM
https://skywalking.apache.org
Apache License 2.0
58 stars 18 forks source link

A compiler error #109

Closed xlj closed 2 years ago

xlj commented 2 years ago

I got an compiler error when I build the project。 environment:gcc 4.8.5 tool: bazel Command Line:bazel build -c opt --cxxopt='-std=c++11' source:all error for detail: INFO: Build options --compilation_mode and --cxxopt have changed, discarding analysis cache. INFO: Analyzed 2 targets (0 packages loaded, 3669 targets configured). INFO: Found 2 targets... ERROR: /var/www/apps/cpp2sky/source/BUILD:39:11: C++ compilation of rule '//source:cpp2sky_data_lib' failed (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 46 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 46 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox source/tracing_context_impl.cc: In member function 'cpp2sky::TracingContextPtr cpp2sky::TracingContextFactory::create(cpp2sky::SpanContextPtr, cpp2sky::SpanContextExtensionPtr)': source/tracing_context_impl.cc:280:10: error: cannot bind 'std::unique_ptr<cpp2sky::TracingContextImpl, std::default_delete >' lvalue to 'std::unique_ptr<cpp2sky::TracingContextImpl, std::default_delete >&&' return context; ^ In file included from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/memory:82:0, from external/com_google_protobuf/src/google/protobuf/stubs/common.h:41, from external/com_google_protobuf/src/google/protobuf/io/coded_stream.h:154, from bazel-out/k8-opt/bin/cpp2sky/config.pb.h:23, from ./source/tracing_context_impl.h:18, from source/tracing_context_impl.cc:15: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/shared_ptr.h:257:2: error: initializing argument 1 of 'std::shared_ptr<_Tp>::shared_ptr(std::unique_ptr<_Up, _Ep>&&) [with _Tp1 = cpp2sky::TracingContextImpl; _Del = std::default_delete; _Tp = cpp2sky::TracingContext]' shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r) ^ source/tracing_context_impl.cc:281:1: error: control reaches end of non-void function [-Werror=return-type] } ^ cc1plus: all warnings being treated as errors INFO: Elapsed time: 3.815s, Critical Path: 1.50s INFO: 7 processes: 5 internal, 2 processwrapper-sandbox. FAILED: Build did NOT complete successfully

Hope to receive reply. thank you。

xlj commented 2 years ago

branch for main also for tag v0.5.1

wbpcode commented 2 years ago

Thanks. Got it. I will check it. 🤔

wbpcode commented 2 years ago

Sorry, I cannot reproduce this compile error in my local env. Seems that this is an error of specific version's compiler.

But may be #111 will fix this error.

xlj commented 2 years ago

Sorry, I cannot reproduce this compile error in my local env. Seems that this is an error of specific version's compiler.

But may be #111 will fix this error.

thank you for your reply,You are right. It‘s fixed in new main branch,but I got a new compiler error。 environment:gcc 4.8.5 tool: bazel 4.0 Command Line:bazel build -c opt --cxxopt='-std=c++11' source:all error for detail: Use --sandbox_debug to see verbose messages from the sandbox In file included from external/com_google_absl/absl/algorithm/container.h:55:0, from external/com_google_absl/absl/container/flat_hash_map.h:38, from external/upb/upbc/message_layout.h:6, from external/upb/upbc/message_layout.cc:2: external/com_google_absl/absl/meta/type_traits.h:55:53: error: 'max_align_t' is not a member of 'std'

define ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT alignof(std::max_align_t)

                                                 ^

external/com_google_absl/absl/container/internal/inlined_vector.h:130:40: note: in expansion of macro 'ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT' (alignof(ValueType) > ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT)> ^ external/com_google_absl/absl/meta/type_traits.h:55:53: note: suggested alternative:

define ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT alignof(std::max_align_t)

                                                 ^

external/com_google_absl/absl/container/internal/inlined_vector.h:130:40: note: in expansion of macro 'ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT' (alignof(ValueType) > ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT)> ^ In file included from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/cstddef:42:0, from external/com_google_absl/absl/base/macros.h:32, from external/upb/upbc/message_layout.h:5, from external/upb/upbc/message_layout.cc:2: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/stddef.h:425:3: note: 'max_align_t' } max_align_t; ^ In file included from external/com_google_absl/absl/container/inlined_vector.h:53:0, from external/com_google_absl/absl/strings/cord.h:79, from external/com_google_absl/absl/container/internal/hash_function_defaults.h:56, from external/com_google_absl/absl/container/flat_hash_map.h:41, from external/upb/upbc/message_layout.h:6, from external/upb/upbc/message_layout.cc:2: external/com_google_absl/absl/container/internal/inlined_vector.h: In destructor 'absl::inlined_vector_internal::AllocationTransaction::~AllocationTransaction()': external/com_google_absl/absl/container/internal/inlined_vector.h:225:22: error: template argument 2 is invalid MallocAdapter::Deallocate(GetAllocator(), GetData(), GetCapacity()); ^ external/com_google_absl/absl/container/internal/inlined_vector.h:225:35: error: invalid type in declaration before '(' token MallocAdapter::Deallocate(GetAllocator(), GetData(), GetCapacity()); ^ external/com_google_absl/absl/container/internal/inlined_vector.h:225:76: error: expression list treated as compound expression in initializer [-fpermissive] MallocAdapter::Deallocate(GetAllocator(), GetData(), GetCapacity()); ^ external/com_google_absl/absl/container/internal/inlined_vector.h: In member function 'absl::inlined_vector_internal::Pointer absl::inlined_vector_internal::AllocationTransaction::Allocate(absl::inlined_vector_internal::SizeType)': external/com_google_absl/absl/container/internal/inlined_vector.h:240:24: error: template argument 2 is invalid MallocAdapter::Allocate(GetAllocator(), requested_capacity); ^ external/com_google_absl/absl/container/internal/inlined_vector.h: In member function 'void absl::inlined_vector_internal::Storage<T, N, A>::DeallocateIfAllocated()': external/com_google_absl/absl/container/internal/inlined_vector.h:453:22: error: template argument 2 is invalid MallocAdapter::Deallocate(GetAllocator(), GetAllocatedData(), ^ external/com_google_absl/absl/container/internal/inlined_vector.h:453:35: error: invalid type in declaration before '(' token MallocAdapter::Deallocate(GetAllocator(), GetAllocatedData(), ^ external/com_google_absl/absl/container/internal/inlined_vector.h:454:58: error: expression list treated as compound expression in initializer [-fpermissive] GetAllocatedCapacity()); ^ external/com_google_absl/absl/container/internal/inlined_vector.h: In member function 'void absl::inlined_vector_internal::Storage<T, N, A>::InitFrom(const absl::inlined_vector_internal::Storage<T, N, A>&)': external/com_google_absl/absl/container/internal/inlined_vector.h:506:24: error: template argument 2 is invalid MallocAdapter::Allocate(GetAllocator(), requested_capacity); ^ external/com_google_absl/absl/container/internal/inlined_vector.h: In member function 'void absl::inlined_vector_internal::Storage<T, N, A>::Initialize(ValueAdapter, absl::inlined_vector_internal::SizeType)': external/com_google_absl/absl/container/internal/inlined_vector.h:537:24: error: template argument 2 is invalid MallocAdapter::Allocate(GetAllocator(), requested_capacity); ^ external/com_google_absl/absl/container/internal/inlined_vector.h: In member function 'void absl::inlined_vector_internal::Storage<T, N, A>::ShrinkToFit()': external/com_google_absl/absl/container/internal/inlined_vector.h:872:18: error: template argument 2 is invalid MallocAdapter::Deallocate(GetAllocator(), storage_view.data, ^ external/com_google_absl/absl/container/internal/inlined_vector.h:872:31: error: invalid type in declaration before '(' token MallocAdapter::Deallocate(GetAllocator(), storage_view.data, ^ external/com_google_absl/absl/container/internal/inlined_vector.h:873:53: error: expression list treated as compound expression in initializer [-fpermissive] storage_view.capacity); ^ INFO: Elapsed time: 233.334s, Critical Path: 16.69s INFO: 215 processes: 14 internal, 201 processwrapper-sandbox.

xlj commented 2 years ago

Sorry, I cannot reproduce this compile error in my local env. Seems that this is an error of specific version's compiler.

But may be #111 will fix this error.

thank you for your reply,You are right. It‘s fixed in new main branch,but I got a new compiler error。 environment:gcc 4.8.5 tool: bazel 4.0 Command Line:bazel build -c opt --cxxopt='-std=c++11' source:all error for detail: Use --sandbox_debug to see verbose messages from the sandbox In file included from external/com_google_absl/absl/algorithm/container.h:55:0, from external/com_google_absl/absl/container/flat_hash_map.h:38, from external/upb/upbc/message_layout.h:6, from external/upb/upbc/message_layout.cc:2: external/com_google_absl/absl/meta/type_traits.h:55:53: error: 'max_align_t' is not a member of 'std'

define ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT alignof(std::max_align_t)

                                                 ^

external/com_google_absl/absl/container/internal/inlined_vector.h:130:40: note: in expansion of macro 'ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT' (alignof(ValueType) > ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT)> ^ external/com_google_absl/absl/meta/type_traits.h:55:53: note: suggested alternative:

define ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT alignof(std::max_align_t)

                                                 ^

external/com_google_absl/absl/container/internal/inlined_vector.h:130:40: note: in expansion of macro 'ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT' (alignof(ValueType) > ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT)> ^ In file included from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/cstddef:42:0, from external/com_google_absl/absl/base/macros.h:32, from external/upb/upbc/message_layout.h:5, from external/upb/upbc/message_layout.cc:2: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/stddef.h:425:3: note: 'max_align_t' } max_align_t; ^ In file included from external/com_google_absl/absl/container/inlined_vector.h:53:0, from external/com_google_absl/absl/strings/cord.h:79, from external/com_google_absl/absl/container/internal/hash_function_defaults.h:56, from external/com_google_absl/absl/container/flat_hash_map.h:41, from external/upb/upbc/message_layout.h:6, from external/upb/upbc/message_layout.cc:2: external/com_google_absl/absl/container/internal/inlined_vector.h: In destructor 'absl::inlined_vector_internal::AllocationTransaction::~AllocationTransaction()': external/com_google_absl/absl/container/internal/inlined_vector.h:225:22: error: template argument 2 is invalid MallocAdapter::Deallocate(GetAllocator(), GetData(), GetCapacity()); ^ external/com_google_absl/absl/container/internal/inlined_vector.h:225:35: error: invalid type in declaration before '(' token MallocAdapter::Deallocate(GetAllocator(), GetData(), GetCapacity()); ^ external/com_google_absl/absl/container/internal/inlined_vector.h:225:76: error: expression list treated as compound expression in initializer [-fpermissive] MallocAdapter::Deallocate(GetAllocator(), GetData(), GetCapacity()); ^ external/com_google_absl/absl/container/internal/inlined_vector.h: In member function 'absl::inlined_vector_internal::Pointer absl::inlined_vector_internal::AllocationTransaction::Allocate(absl::inlined_vector_internal::SizeType)': external/com_google_absl/absl/container/internal/inlined_vector.h:240:24: error: template argument 2 is invalid MallocAdapter::Allocate(GetAllocator(), requested_capacity); ^ external/com_google_absl/absl/container/internal/inlined_vector.h: In member function 'void absl::inlined_vector_internal::Storage<T, N, A>::DeallocateIfAllocated()': external/com_google_absl/absl/container/internal/inlined_vector.h:453:22: error: template argument 2 is invalid MallocAdapter::Deallocate(GetAllocator(), GetAllocatedData(), ^ external/com_google_absl/absl/container/internal/inlined_vector.h:453:35: error: invalid type in declaration before '(' token MallocAdapter::Deallocate(GetAllocator(), GetAllocatedData(), ^ external/com_google_absl/absl/container/internal/inlined_vector.h:454:58: error: expression list treated as compound expression in initializer [-fpermissive] GetAllocatedCapacity()); ^ external/com_google_absl/absl/container/internal/inlined_vector.h: In member function 'void absl::inlined_vector_internal::Storage<T, N, A>::InitFrom(const absl::inlined_vector_internal::Storage<T, N, A>&)': external/com_google_absl/absl/container/internal/inlined_vector.h:506:24: error: template argument 2 is invalid MallocAdapter::Allocate(GetAllocator(), requested_capacity); ^ external/com_google_absl/absl/container/internal/inlined_vector.h: In member function 'void absl::inlined_vector_internal::Storage<T, N, A>::Initialize(ValueAdapter, absl::inlined_vector_internal::SizeType)': external/com_google_absl/absl/container/internal/inlined_vector.h:537:24: error: template argument 2 is invalid MallocAdapter::Allocate(GetAllocator(), requested_capacity); ^ external/com_google_absl/absl/container/internal/inlined_vector.h: In member function 'void absl::inlined_vector_internal::Storage<T, N, A>::ShrinkToFit()': external/com_google_absl/absl/container/internal/inlined_vector.h:872:18: error: template argument 2 is invalid MallocAdapter::Deallocate(GetAllocator(), storage_view.data, ^ external/com_google_absl/absl/container/internal/inlined_vector.h:872:31: error: invalid type in declaration before '(' token MallocAdapter::Deallocate(GetAllocator(), storage_view.data, ^ external/com_google_absl/absl/container/internal/inlined_vector.h:873:53: error: expression list treated as compound expression in initializer [-fpermissive] storage_view.capacity); ^ INFO: Elapsed time: 233.334s, Critical Path: 16.69s INFO: 215 processes: 14 internal, 201 processwrapper-sandbox.

wbpcode commented 2 years ago

seems that the gcc version is too old for the absl. 4.8.x gcc even have no a complete support for the c++11. 🤔

xlj commented 2 years ago

you are right ,again.This bug can close now.the error for “'max_align_t' is not a member of 'std'” is a bug for gcc 4.8.5.it has been fixed in 4.9.0. The detail is here "https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56019". I upgrade my gcc. The problem solved. thank you for your help.