ARM-software / ComputeLibrary

The Compute Library is a set of computer vision and machine learning functions optimised for both Arm CPUs and GPUs using SIMD technologies.
MIT License
2.75k stars 767 forks source link

Arm NN compute library build failure on Raspberry PI 4 #1110

Open pauljainta opened 2 weeks ago

pauljainta commented 2 weeks ago

Output of 'strings libarm_compute.so | grep arm_compute_version': arm_compute_version=v24.05 Build options: {'extra_cxx_flags': '-fPIC', 'Werror': '0', 'debug': '0', 'asserts': '0', 'neon': '1', 'opencl': '0', 'os': 'linux', 'arch': 'armv8a', 'examples': '1'} Git hash=b'a53ffdc87869399eb1ff2f9a20c69c8b962e27d2'

Platform: Raspberry PI 4

Operating System: Debian 12

Problem description: I have been trying to follow this documentation to build arm nn in my Raspberry PI 4, but it fails at the step

scons extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0 neon=1

I have attached an image of the failure logs. Screenshot from 2024-06-07 12-54-43

morgolock commented 2 weeks ago

Hi @pauljainta

Could you please let us know what version of gcc you are running? Could you please share the full error message as text rather than an image?

pauljainta commented 2 weeks ago

Hi @morgolock

  1. gcc (Debian 12.2.0-14) 12.2.0

  2. I tried to reproduce the error and now it says :

scons: Reading SConscript files ...
Mkdir("build")
Using compilers:
CC  arm-linux-gnueabihf-gcc
CXX  arm-linux-gnueabihf-g++
ERROR: Compiler ' arm-linux-gnueabihf-g++' not found

In both of the cases wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2 was not working since the link was I guess expired. So I used wget https://archives.boost.io/release/1.64.0/source/boost_1_64_0.tar.bz2

pauljainta commented 2 weeks ago

A followup : I used sudo apt-get install g++-arm-linux-gnueabihf command to install g++-arm-linux-gnueabihf. Then I ran the scons command and it gave me the following error log


In file included from /usr/arm-linux-gnueabihf/include/c++/12/vector:63,
                 from include/CL/opencl.hpp:596,
                 from ./arm_compute/core/CL/OpenCL.h:44,
                 from ./arm_compute/core/CL/ICLArray.h:27,
                 from ./arm_compute/core/CL/CLTypes.h:27,
                 from ./arm_compute/core/CL/ICLTensor.h:27,
                 from ./arm_compute/runtime/CL/CLTensor.h:27,
                 from ./src/gpu/cl/operators/ClWinogradConv2d.h:27,
                 from src/gpu/cl/operators/ClWinogradConv2d.cpp:24:
In function ‘_ForwardIterator std::__do_uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const pair<pair<int, int>, pair<int, int> >*; _ForwardIterator = pair<pair<int, int>, pair<int, int> >*]’,
    inlined from ‘static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const std::pair<std::pair<int, int>, std::pair<int, int> >*; _ForwardIterator = std::pair<std::pair<int, int>, std::pair<int, int> >*; bool _TrivialValueTypes = false]’ at /usr/arm-linux-gnueabihf/include/c++/12/bits/stl_uninitialized.h:137:32,
    inlined from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const pair<pair<int, int>, pair<int, int> >*; _ForwardIterator = pair<pair<int, int>, pair<int, int> >*]’ at /usr/arm-linux-gnueabihf/include/c++/12/bits/stl_uninitialized.h:185:15,
    inlined from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, allocator<_Tp>&) [with _InputIterator = const pair<pair<int, int>, pair<int, int> >*; _ForwardIterator = pair<pair<int, int>, pair<int, int> >*; _Tp = pair<pair<int, int>, pair<int, int> >]’ at /usr/arm-linux-gnueabihf/include/c++/12/bits/stl_uninitialized.h:372:37,
    inlined from ‘void std::vector<_Tp, _Alloc>::_M_range_initialize(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator = const std::pair<std::pair<int, int>, std::pair<int, int> >*; _Tp = std::pair<std::pair<int, int>, std::pair<int, int> >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >]’ at /usr/arm-linux-gnueabihf/include/c++/12/bits/stl_vector.h:1690:33,
    inlined from ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::pair<std::pair<int, int>, std::pair<int, int> >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >]’ at /usr/arm-linux-gnueabihf/include/c++/12/bits/stl_vector.h:677:21,
    inlined from ‘bool arm_compute::opencl::{anonymous}::check_support_fast_math(const arm_compute::Size2D&, const arm_compute::Size2D&)’ at src/gpu/cl/operators/ClWinogradConv2d.cpp:94:84,
    inlined from ‘arm_compute::Status arm_compute::opencl::{anonymous}::validate_arguments(const arm_compute::ITensorInfo*, const arm_compute::ITensorInfo*, const arm_compute::ITensorInfo*, const arm_compute::ITensorInfo*, const arm_compute::PadStrideInfo&, const arm_compute::ActivationLayerInfo&, bool)’ at src/gpu/cl/operators/ClWinogradConv2d.cpp:131:9:
/usr/arm-linux-gnueabihf/include/c++/12/bits/stl_uninitialized.h:119:48: error: pointer used after ‘void operator delete(void*, std::size_t)’ [-Werror=use-after-free]
  119 |           for (; __first != __last; ++__first, (void)++__cur)
      |                                                ^~~~~~~~~~~~~
In file included from /usr/arm-linux-gnueabihf/include/c++/12/arm-linux-gnueabihf/bits/c++allocator.h:33,
                 from /usr/arm-linux-gnueabihf/include/c++/12/bits/allocator.h:46,
                 from /usr/arm-linux-gnueabihf/include/c++/12/string:41,
                 from ./arm_compute/core/CL/OpenCL.h:27:
In member function ‘void std::__new_allocator<_Tp>::deallocate(_Tp*, size_type) [with _Tp = std::pair<std::pair<int, int>, std::pair<int, int> >]’,
    inlined from ‘static void std::allocator_traits<std::allocator<_CharT> >::deallocate(allocator_type&, pointer, size_type) [with _Tp = std::pair<std::pair<int, int>, std::pair<int, int> >]’ at /usr/arm-linux-gnueabihf/include/c++/12/bits/alloc_traits.h:496:23,
    inlined from ‘void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(pointer, std::size_t) [with _Tp = std::pair<std::pair<int, int>, std::pair<int, int> >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >]’ at /usr/arm-linux-gnueabihf/include/c++/12/bits/stl_vector.h:387:19,
    inlined from ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::pair<std::pair<int, int>, std::pair<int, int> >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >]’ at /usr/arm-linux-gnueabihf/include/c++/12/bits/stl_vector.h:366:15,
    inlined from ‘std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::pair<std::pair<int, int>, std::pair<int, int> >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >]’ at /usr/arm-linux-gnueabihf/include/c++/12/bits/stl_vector.h:733:7,
    inlined from ‘bool arm_compute::opencl::{anonymous}::check_support_fast_math(const arm_compute::Size2D&, const arm_compute::Size2D&)’ at src/gpu/cl/operators/ClWinogradConv2d.cpp:100:1,
    inlined from ‘arm_compute::Status arm_compute::opencl::{anonymous}::validate_arguments(const arm_compute::ITensorInfo*, const arm_compute::ITensorInfo*, const arm_compute::ITensorInfo*, const arm_compute::ITensorInfo*, const arm_compute::PadStrideInfo&, const arm_compute::ActivationLayerInfo&, bool)’ at src/gpu/cl/operators/ClWinogradConv2d.cpp:131:9:
/usr/arm-linux-gnueabihf/include/c++/12/bits/new_allocator.h:158:33: note: call to ‘void operator delete(void*, std::size_t)’ here
  158 |         _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
      |                                 ^
cc1plus: all warnings being treated as errors
scons: *** [build/src/gpu/cl/operators/ClWinogradConv2d.o] Error 1
scons: building terminated because of errors
pauljainta commented 2 weeks ago

logs.txt I have uploaded the full logs file here

pauljainta commented 1 week ago

@morgolock Did u find any solution?

JuanMARM commented 1 week ago

Hi @pauljainta , we will get back to you early next week when @morgolock is back in the office. I hope that is ok?

morgolock commented 1 week ago

Hi @pauljainta

It looks like you're trying to build ArmNN, if this is so I'd recommend downloading the ArmNN prebuilt binaries: https://github.com/ARM-software/armnn/releases/download/v24.05/MULTI_ISA-GCC11-ArmNN+ACL-linux-armv8a.tar.gz You could also get ACL prebuilt binaries https://github.com/ARM-software/ComputeLibrary/releases/download/v24.06/arm_compute-v24.06-bin-linux-arm64-v8a-cl.tar.gz

The error you get it seems to be a toolchain problem, could you please try building with scons extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0 neon=1 opencl=0 ?

You could also try downloading a different version of gcc from https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads