Skip to content

compile-error w/gcc 4.9.4 #1371

@tehranian

Description

@tehranian

Greetings! I was trying to compile the top of master w/gcc-4.9.4 and hit the following error:

ERROR: /home/dtehranian/envoy/source/common/thread_local/BUILD:11:1: C++ compilation of rule '//source/common/thread_local:thread_local_lib' failed (Exit 1).
source/common/thread_local/thread_local_impl.cc: In member function 'virtual Envoy::ThreadLocal::SlotPtr Envoy::ThreadLocal::InstanceImpl::allocateSlot()':
source/common/thread_local/thread_local_impl.cc:31:14: error: cannot bind 'std::unique_ptr<Envoy::ThreadLocal::InstanceImpl::SlotImpl>' lvalue to 'std::unique_ptr<Envoy::ThreadLocal::InstanceImpl::SlotImpl>&&'
       return slot;
              ^
In file included from /ephemeral/envoy-root/gcc-4.9.4/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/../../../../include/c++/4.9.4/memory:81:0,
                 from bazel-out/local-fastbuild/bin/include/envoy/thread_local/_virtual_includes/thread_local_interface/envoy/thread_local/thread_local.h:5,
                 from bazel-out/local-fastbuild/bin/source/common/thread_local/_virtual_includes/thread_local_lib/common/thread_local/thread_local_impl.h:8,
                 from source/common/thread_local/thread_local_impl.cc:1:
/ephemeral/envoy-root/gcc-4.9.4/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/../../../../include/c++/4.9.4/bits/unique_ptr.h:220:2: note: initializing argument 1 of 'std::unique_ptr<_Tp, _Dp>::unique_ptr(std::unique_ptr<_Up, _Ep>&&) [with _Up = Envoy::ThreadLocal::InstanceImpl::SlotImpl; _Ep = std::default_delete<Envoy::ThreadLocal::InstanceImpl::SlotImpl>; <template-parameter-2-3> = void; _Tp = Envoy::ThreadLocal::Slot; _Dp = std::default_delete<Envoy::ThreadLocal::Slot>]'
  unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
  ^
source/common/thread_local/thread_local_impl.cc:37:10: error: cannot bind 'std::unique_ptr<Envoy::ThreadLocal::InstanceImpl::SlotImpl>' lvalue to 'std::unique_ptr<Envoy::ThreadLocal::InstanceImpl::SlotImpl>&&'
   return slot;
          ^
In file included from /ephemeral/envoy-root/gcc-4.9.4/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/../../../../include/c++/4.9.4/memory:81:0,
                 from bazel-out/local-fastbuild/bin/include/envoy/thread_local/_virtual_includes/thread_local_interface/envoy/thread_local/thread_local.h:5,
                 from bazel-out/local-fastbuild/bin/source/common/thread_local/_virtual_includes/thread_local_lib/common/thread_local/thread_local_impl.h:8,
                 from source/common/thread_local/thread_local_impl.cc:1:
/ephemeral/envoy-root/gcc-4.9.4/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/../../../../include/c++/4.9.4/bits/unique_ptr.h:220:2: note: initializing argument 1 of 'std::unique_ptr<_Tp, _Dp>::unique_ptr(std::unique_ptr<_Up, _Ep>&&) [with _Up = Envoy::ThreadLocal::InstanceImpl::SlotImpl; _Ep = std::default_delete<Envoy::ThreadLocal::InstanceImpl::SlotImpl>; <template-parameter-2-3> = void; _Tp = Envoy::ThreadLocal::Slot; _Dp = std::default_delete<Envoy::ThreadLocal::Slot>]'
  unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
  ^
source/common/thread_local/thread_local_impl.cc:38:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
cc1plus: all warnings being treated as errors
Target //source/exe:envoy-static failed to build

Given that the Docker builds use gcc-5.4.0, I re-tried w/the build with the newer gcc and it completed successfully.

I think either:

FWIW - I used git bisect to track down when the build first started breaking w/gcc-4.9.4. Here's what I found:

63a88acb01e3fbfcb0fe129c53003cd2be713590 is the first bad commit

commit 63a88acb01e3fbfcb0fe129c53003cd2be713590
Author: Matt Klein <mattklein123@users.noreply.github.com>
Date:   Fri Jul 28 09:26:05 2017 -0700

    tls: refactor tls to work better with lds and cds (#1333)

    Previously, TLS slots would be leaked if either clusters or listeners
    transitively allocated a slot. This commit refactors TLS so that slots
    are hidden behind an interface and are freed properly. As part of this
    change shutdown() has been removed from the thread local object interface
    so that proper RAII semantics can be used. The one special case to this
    relates to stat flushing; special code is needed so that once shutdown
    begins no flushing of timers/histograms happens. It seems better to
    have this one special case vs. requiring everyone to implement a
    shutdown() method.

    A few test changes are also included:
    1) We now use the real thread local stat store in integration tests since
       it provides better coverage.
    2) Added two integration tests that cover the server being shutdown with
       active connection pool connections which expose TLS ordering issues.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions