google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.58k stars 5.16k forks source link

C++ bazel build for many applications fails with the same error message #4755

Closed shreshtashetty closed 1 year ago

shreshtashetty commented 1 year ago

OS Platform and Distribution

Ubuntu 18.04.6 LTS

Compiler version

gcc version 7.5.0

Programming Language and version

C++

Installed using virtualenv? pip? Conda?(if python)

N/A

MediaPipe version

Mediapipe Github Repository, latest (cloned a week ago)

Bazel version

bazel 6.1.1

XCode and Tulsi versions (if iOS)

N/A

Android SDK and NDK versions (if android)

N/A

Android AAR (if android)

N/A

OpenCV version (if running on desktop)

opencv 4.5.2

Describe the problem

Building the object_detection application works, but building face_mesh, hand_tracking, face_detection, iris_tracking and pose_tracking fails giving the same error message. For example, bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/face_mesh:face_mesh_cpu for face_mesh gives the following error message:-

Complete Logs

WARNING: Ignoring JAVA_HOME, because it must point to a JDK, not a JRE.
WARNING: /media/ubuntu/apps1/apps/mediapipe/mediapipe/framework/BUILD:59:24: in cc_library rule //mediapipe/framework:calculator_cc_proto: target '//mediapipe/framework:calculator_cc_proto' depends on deprecated target '@com_google_protobuf//:cc_wkt_protos': Only for backward compatibility. Do not use.
WARNING: /media/ubuntu/apps1/apps/mediapipe/mediapipe/framework/tool/BUILD:197:24: in cc_library rule //mediapipe/framework/tool:field_data_cc_proto: target '//mediapipe/framework/tool:field_data_cc_proto' depends on deprecated target '@com_google_protobuf//:cc_wkt_protos': Only for backward compatibility. Do not use.
INFO: Analyzed target //mediapipe/examples/desktop/face_mesh:face_mesh_cpu (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /media/ubuntu/apps1/apps/mediapipe/mediapipe/calculators/tensor/BUILD:511:23: Compiling mediapipe/calculators/tensor/inference_interpreter_delegate_runner.cc failed: (Exit 1): gcc failed: error executing command (from target //mediapipe/calculators/tensor:inference_interpreter_delegate_runner) /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 84 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from /usr/include/c++/7/memory:64:0,
                 from ./mediapipe/calculators/tensor/inference_interpreter_delegate_runner.h:18,
                 from mediapipe/calculators/tensor/inference_interpreter_delegate_runner.cc:15:
/usr/include/c++/7/bits/stl_construct.h: In instantiation of 'void std::_Construct(_T1*, _Args&& ...) [with _T1 = mediapipe::Tensor; _Args = {const mediapipe::Tensor&}]':
/usr/include/c++/7/bits/stl_uninitialized.h:83:18:   required from 'static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const mediapipe::Tensor*, std::vector<mediapipe::Tensor> >; _ForwardIterator = mediapipe::Tensor*; bool _TrivialValueTypes = false]'
/usr/include/c++/7/bits/stl_uninitialized.h:134:15:   required from '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const mediapipe::Tensor*, std::vector<mediapipe::Tensor> >; _ForwardIterator = mediapipe::Tensor*]'
/usr/include/c++/7/bits/stl_uninitialized.h:289:37:   required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = __gnu_cxx::__normal_iterator<const mediapipe::Tensor*, std::vector<mediapipe::Tensor> >; _ForwardIterator = mediapipe::Tensor*; _Tp = mediapipe::Tensor]'
/usr/include/c++/7/bits/stl_vector.h:331:31:   required from 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = mediapipe::Tensor; _Alloc = std::allocator<mediapipe::Tensor>]'
external/com_google_absl/absl/status/internal/statusor_internal.h:201:42:   required from 'absl::lts_20230125::internal_statusor::StatusOrData<T>::StatusOrData(std::in_place_t, Args&& ...) [with Args = {std::vector<mediapipe::Tensor, std::allocator<mediapipe::Tensor> >&}; T = std::vector<mediapipe::Tensor>]'
external/com_google_absl/absl/status/statusor.h:669:55:   required from 'absl::lts_20230125::StatusOr<T>::StatusOr(std::in_place_t, Args&& ...) [with Args = {std::vector<mediapipe::Tensor, std::allocator<mediapipe::Tensor> >&}; T = std::vector<mediapipe::Tensor>]'
external/com_google_absl/absl/status/statusor.h:456:52:   required from 'absl::lts_20230125::StatusOr<T>::StatusOr(U&&) [with U = std::vector<mediapipe::Tensor>&; typename std::enable_if<absl::lts_20230125::conjunction<absl::lts_20230125::disjunction<std::is_same<T, typename std::remove_cv<typename std::remove_reference<U&&>::type>::type>, absl::lts_20230125::negation<absl::lts_20230125::disjunction<std::is_same<absl::lts_20230125::StatusOr<T>, typename std::remove_cv<typename std::remove_reference<U&&>::type>::type>, std::is_same<absl::lts_20230125::Status, typename std::remove_cv<typename std::remove_reference<U&&>::type>::type>, std::is_same<std::in_place_t, typename std::remove_cv<typename std::remove_reference<U&&>::type>::type>, absl::lts_20230125::internal_statusor::IsDirectInitializationAmbiguous<T, U&&> > > >, std::is_constructible<_Tp, _Up&&>, std::is_convertible<_Up&&, _Tp>, absl::lts_20230125::disjunction<std::is_same<typename std::remove_cv<typename std::remove_reference<_SrcTuple>::type>::type, T>, absl::lts_20230125::conjunction<absl::lts_20230125::negation<std::is_convertible<U&&, absl::lts_20230125::Status> >, absl::lts_20230125::negation<absl::lts_20230125::internal_statusor::HasConversionOperatorToStatusOr<T, U&&, void> > > > >::value, int>::type <anonymous> = 0; T = std::vector<mediapipe::Tensor>]'
mediapipe/calculators/tensor/inference_interpreter_delegate_runner.cc:207:10:   required from here
/usr/include/c++/7/bits/stl_construct.h:75:7: error: use of deleted function 'mediapipe::Tensor::Tensor(const mediapipe::Tensor&)'
     { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./mediapipe/calculators/tensor/inference_runner.h:6:0,
                 from ./mediapipe/calculators/tensor/inference_interpreter_delegate_runner.h:22,
                 from mediapipe/calculators/tensor/inference_interpreter_delegate_runner.cc:15:
./mediapipe/framework/formats/tensor.h:152:3: note: declared here
   Tensor(const Tensor&) = delete;
   ^~~~~~
Target //mediapipe/examples/desktop/face_mesh:face_mesh_cpu failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 13.486s, Critical Path: 13.30s
INFO: 11 processes: 4 internal, 7 linux-sandbox.
FAILED: Build did NOT complete successfully
kuaashish commented 1 year ago

@shreshtashetty,

We are already aware of this issue, and we are actively working towards a resolution. As a temporary workaround, could you please consider upgrading the GCC version to 8 by using the command provided below:

sudo apt-get install gcc-8 g++-8 -y

Also, Please let us know if this works for you. Thank you

shreshtashetty commented 1 year ago

Thanks for the reply @kuaashish.

Upgrading to gcc 8 (along with running bazel clean and deleting the bazel cache folder on /home/username/.cache/bazel) worked.

google-ml-butler[bot] commented 1 year ago

Are you satisfied with the resolution of your issue? Yes No