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.
2.87k stars 782 forks source link

Build of version 22.05 fails with GCC12 - `error: ‘strlen’ was not declared in this scope` #979

Closed ggardet closed 2 years ago

ggardet commented 2 years ago

Output of 'strings libarm_compute.so | grep arm_compute_version': 22.05

Platform: aarch64

Operating System: openSUSE Tumbleweed

Problem description:

Build of version 22.05 fails with GCC12 with 2 errors:

  1. error: ‘ostream_iterator’ is not a member of ‘std’ is the same as https://github.com/ARM-software/ComputeLibrary/issues/975
  2. error: ‘strlen’ was not declared in this scope

Error log:

[  437s] g++ -o build/examples/graph_deepspeech_v0_4_1.o -c -Wall -DARCH_ARM -Wextra -Wdisabled-optimization -Wformat=2 -Winit-self -Wstrict-overflow=2 -Wswitch-default -Woverloaded-virtual -Wformat-security -Wctor-dtor-privacy -Wsign-promo -Weffc++ -Wno-overlength-strings -std=c++14 -pedantic -Wlogical-op -Wnoexcept -Wstrict-null-sentinel -Wno-misleading-indentation -C -fPIC -Wno-ignored-attributes -DENABLE_FP16_KERNELS -DENABLE_FP32_KERNELS -DENABLE_QASYMM8_KERNELS -DENABLE_QASYMM8_SIGNED_KERNELS -DENABLE_QSYMM16_KERNELS -DENABLE_INTEGER_KERNELS -DENABLE_NHWC_KERNELS -DENABLE_NCHW_KERNELS -O3 -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -m64 -D_GLIBCXX_USE_NANOSLEEP -DARM_COMPUTE_CPP_SCHEDULER=1 -DENABLE_NEON -DARM_COMPUTE_ENABLE_NEON -DARM_COMPUTE_GRAPH_ENABLED -DARM_COMPUTE_OPENCL_ENABLED -DEMBEDDED_KERNELS -Iinclude -I. -I. examples/graph_deepspeech_v0_4_1.cpp
[  438s] In file included from utils/Utils.h:39,
[  438s]                  from utils/Utils.cpp:24:
[  438s] include/libnpy/npy.hpp: In function ‘std::string npy::pyparse::write_tuple(const std::vector<T>&)’:
[  438s] include/libnpy/npy.hpp:298:42: error: ‘ostream_iterator’ is not a member of ‘std’
[  438s]   298 |     std::copy(v.begin(), v.end()-1, std::ostream_iterator<T>(ss, delimiter.c_str()));
[  438s]       |                                          ^~~~~~~~~~~~~~~~
[  438s] include/libnpy/npy.hpp:38:1: note: ‘std::ostream_iterator’ is defined in header ‘<iterator>’; did you forget to ‘#include <iterator>’?
[  438s]    37 | #include <unordered_map>
[  438s]   +++ |+#include <iterator>
[  438s]    38 | 
[  438s] include/libnpy/npy.hpp:298:60: error: expected primary-expression before ‘>’ token
[  438s]   298 |     std::copy(v.begin(), v.end()-1, std::ostream_iterator<T>(ss, delimiter.c_str()));
[  438s]       |                                                            ^
[  439s] In file included from utils/CommonGraphOptions.h:28,
[  439s]                  from utils/CommonGraphOptions.cpp:24:
[  439s] ./utils/command_line/CommandLineParser.h: In member function ‘void arm_compute::utils::CommandLineParser::parse(int, char**)’:
[  439s] ./utils/command_line/CommandLineParser.h:142:55: error: ‘strlen’ was not declared in this scope
[  439s]   142 |         int         pos        = (equal_sign == -1) ? strlen(argv[i]) : equal_sign;
[  439s]       |                                                       ^~~~~~
[  439s] ./utils/command_line/CommandLineParser.h:38:1: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
[  439s]    37 | #include <vector>
[  439s]   +++ |+#include <cstring>
[  439s]    38 | 
morgolock commented 2 years ago

Hi @ggardet

Please cherry-pick this patch to fix the problem: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7682

Hope this helps